界面库

popupmenu 以及coolbar
This commit is contained in:
JianjunLiu 2022-08-30 01:34:14 +08:00
parent fad69fa5e4
commit 8f64b3363f
7 changed files with 63 additions and 29 deletions

View File

@ -1685,11 +1685,12 @@ type TVclDesigner = class(tvcform)
v[0].SetComponentProperties(v[1],va.GetTrueComponent());
end
end
except
end ;
FTree.Loading := nil;
end
function loadtfmtotree(p,d,node,owner,prs,obarray);
function loadtfmtotree(p,d,node,wr,prs,obarray);
begin
{**
@explan(说明) 导入tfm文件 %%
@ -1712,7 +1713,7 @@ type TVclDesigner = class(tvcform)
it.Imgs := FImageList.GetImageId("tdcreateform");
FLoadInheritedName := array();
end
comp := it.ComponentCreater(node,owner);
comp := it.ComponentCreater(node,wr);
comp.name := d["name"];
obarray[d["name"]] := comp;
FVariableSelecter.additem(comp);

View File

@ -695,7 +695,7 @@ type tcontrol = class(tcomponent)
@param(e)(tuieventbase) ÏûÏ¢ %%
**}
if e.Result then exit;
if FPopupMenu is class(TcustomPopupmenu) then
if FPopupMenu is class({TcustomPopupmenu}TcustomMenu) then
begin
uf := TPM_LEFTALIGN .| TPM_TOPALIGN .| TPM_RIGHTBUTTON;
_wapi.TrackPopupMenu(FPopupMenu.Handle,uf,e.lolparamsigned,e.hilparamsigned,0,e.wparam,nil);

View File

@ -1010,7 +1010,7 @@ type TTray=class(TComponent)
function ShowPopUpMenu();
begin
if not FHaveadd then exit;
if FPopupMenu is class(TcustomPopupmenu)then
if FPopupMenu is class({TcustomPopupmenu}TcustomMenu)then
begin
ps := array(x,y);
_wapi.GetCursorPos(ps);
@ -1112,7 +1112,7 @@ type TVCForm = class(TScrollingWinControl)
if(FTray is class(TTray))then
begin
tp := FTray.PopupMenu;
if tp is class(TcustomPopupmenu)then
if tp is class({TcustomPopupmenu}TcustomMenu)then
begin
return tp;
end
@ -2490,7 +2490,7 @@ type tcoolbar = class(tcustomcoolbar)
end
function publishs();override;
begin
return array("name","enabled","caption","autosize","border","font","color","dragbtncolor","visible","arrange");
return array("name","enabled","caption","autosize","border","wsdlgmodalframe","font","color","dragbtncolor","visible","arrange");
end
end

View File

@ -937,15 +937,15 @@ type TWinControl = class(tcontrol)
end
function WMMENURBUTTONUP(o,e):WM_MENURBUTTONUP;virtual;
begin
if PopupMenu is class(TcustomPopupmenu)then PopupMenu.dispatch(e);
if PopupMenu is class({TcustomPopupmenu}TcustomMenu)then PopupMenu.dispatch(e);
end
function WMMENUSELECT(o,e):WM_MENUSELECT;virtual;
begin
if PopupMenu is class(TcustomPopupmenu)then PopupMenu.dispatch(e);
if PopupMenu is class({TcustomPopupmenu}TcustomMenu)then PopupMenu.dispatch(e);
end
function WMINITMENUPOPUP(o,e):WM_INITMENUPOPUP;virtual;
begin
if PopupMenu is class(TcustomPopupmenu)then PopupMenu.dispatch(e);
if PopupMenu is class({TcustomPopupmenu}TcustomMenu)then PopupMenu.dispatch(e);
end
function WMERASEBKGND(o,e):WM_ERASEBKGND;override;
begin
@ -998,7 +998,7 @@ type TWinControl = class(tcontrol)
//dc := _wapi.GetDC(SELF.hANDLE);
//dcid := _wapi.SaveDC(dc);
canvas.handle := dc;
if(e.wparam=0)and(PopupMenu is class(TcustomPopupmenu))then
if(e.wparam=0)and(PopupMenu is class({TcustomPopupmenu}TcustomMenu))then
begin
r := PopupMenu.dispatch(e);
if r then
@ -1032,7 +1032,7 @@ type TWinControl = class(tcontrol)
@param(o)()¿Ø¼þ±¾Éí %%
@param(e)(TMMEASUREITEM)²âÁ¿ÏûÏ¢ %%
**}
if(e.wparam=0 and e.ctltype=ODT_MENU)and(PopupMenu is class(TcustomPopupmenu))and PopupMenu.Dispatch(e)then exit;
if(e.wparam=0 and e.ctltype=ODT_MENU)and(PopupMenu is class({TcustomPopupmenu}TcustomMenu))and PopupMenu.Dispatch(e)then exit;
for i := 0 to FControls.count-1 do
begin
it := FControls[i];
@ -1090,7 +1090,7 @@ type TWinControl = class(tcontrol)
end
function WMCOMMAND(o,e):WM_COMMAND;virtual;
begin
if(popupmenu is class(TcustomPopupmenu))and popupmenu.dispatch(e)then exit;
if(popupmenu is class({TcustomPopupmenu}TcustomMenu))and popupmenu.dispatch(e)then exit;
hd := e.lparam;
if hd then
begin

View File

@ -162,7 +162,8 @@ type tcustomcoolbar=class(tcustomcontrol)
inherited;
end
function doControlALign();override;//µ÷ÕûλÖÃ
begin
begin
if not HandleAllocated() then return ;
mwid := 10;
swid := 10;
y := 0;
@ -176,7 +177,16 @@ type tcustomcoolbar=class(tcustomcontrol)
if abs(dh)>4 then
begin
Align := alNone;
Height := (border*2)+nh;
{if WSSizebox then
begin
bw := 16;
end else
if WsDlgModalFrame then
begin
bw := 6;
end else}
if Border then bw := 2;
Height := bw+nh;
Align := alTop;
return ;
end

View File

@ -582,7 +582,7 @@ private
begin
FHandle := CreateMenu();
end else
if self(true)is class(TcustomMainmenu)then //ÐÞ¸Ä
if self(true) is class(TcustomMainmenu)then //ÐÞ¸Ä
begin
FHandle := CreateMenu();
end

View File

@ -4116,7 +4116,7 @@ type TcustomToolButton=class(tcomponent)
if FStylesep then return ;
if Parent then
begin
if FPopupMenu is class(TcustomPopupmenu) then
if FPopupMenu is class({TcustomPopupmenu}TcustomMenu) then
begin
Parent.PopupMenu := FPopupMenu;
rec := GetRect();
@ -4188,7 +4188,10 @@ type TcustomToolButton=class(tcomponent)
if nv<>FStylesep then
begin
FStylesep := nv;
if FToolbar then FToolbar.BtnChanged();
if FToolbar then
begin
FToolbar.ExecuteCommand("btnchanged",0);
end
end
end
function getShortCut();
@ -4247,7 +4250,10 @@ type TcustomToolButton=class(tcomponent)
if nv <> FEnabled then
begin
FEnabled := nv;
if FToolbar then FToolbar.BtnChanged();
if FToolbar then
begin
FToolbar.ExecuteCommand("btnchanged",0);
end
end
end
function SetVisible(v);
@ -4256,7 +4262,10 @@ type TcustomToolButton=class(tcomponent)
if nv <> FVisible then
begin
FVisible := nv;
if FToolbar then FToolbar.BtnChanged();
if FToolbar then
begin
FToolbar.ExecuteCommand("btnchanged",0);
end
end
end
protected //action
@ -4316,7 +4325,10 @@ type TcustomToolButton=class(tcomponent)
if ifnumber(id)and id <> FImageId then
begin
FImageId := id; //Ë¢ÐÂÒ»ÏÂ
if FToolbar then FToolbar.BtnChanged(); //FToolbar.InvalidateRect(nil,false);
if FToolbar then
begin
FToolbar.ExecuteCommand("btnchanged",0);
end
end
end
private
@ -4369,10 +4381,14 @@ type TcustomToolBar=class(TCustomControl)
end
end
end
{function ContextMenu(o,e);override;
function ContextMenu(o,e);override;
begin
if csDesigning in ComponentState then
begin
return inherited;
end
e.skip := true;
end }
end
function MouseUp(o,e);override;
begin
if csDesigning in ComponentState then return;
@ -4447,7 +4463,7 @@ type TcustomToolBar=class(TCustomControl)
begin
bt := FButtons[idx];
st := bt.ShortCut;
if bt.PopupMenu is class(TcustomPopupmenu) then s1 := bt.PopupMenu.Caption;
if bt.PopupMenu is class({TcustomPopupmenu}TcustomMenu) then s1 := bt.PopupMenu.Caption;
else s1 := bt.Caption;
FTipWnd.Tip := s1+(st?(" ("+st+")"):"");
FTipWnd.ShowTIp();
@ -4743,11 +4759,18 @@ type TcustomToolBar=class(TCustomControl)
FCurrentPos := nil;
FMouseDownIdx :=-1;
end
function BtnChanged();
function ExecuteCommand(cmd,pm);override;
begin
CalcButtonsRect();
InvalidateRect(nil,false);
end
case cmd of
"btnchanged":
begin
CalcButtonsRect();
InvalidateRect(nil,false);
return 0;
end
end ;
return inherited;
end
protected
procedure SetAlign(Value:TAlign);override;
begin
@ -4784,8 +4807,8 @@ type TcustomToolBar=class(TCustomControl)
return;
end
imglst := ImageList; //ͼ±ê
imgw := 36;
imgh := 36;
imgw := 28;
imgh := 28;
if imglst is class(TCustomImageList)then
begin
imgw := imglst.Width+4;