界面库

优化coolbar
This commit is contained in:
JianjunLiu 2022-09-16 17:21:36 +08:00
parent 286af5904f
commit 476be4b95c
4 changed files with 75 additions and 97 deletions

View File

@ -5391,34 +5391,11 @@ type TGridCellVariabletimagelistEdit = class(TGridCellVariableTactionEdit)
inherited;
end
end
type TGridCellVariablehgtEdit = class(TGridCellVariableTactionEdit)
type TGridCellVariablehgtEdit = class(TGridCellVariabletimagelistEdit)
Function EditType();override;
begin
return "thighlighter";
end
function CellDrawLabel(dc,rect,d);override;
begin
v := d["value"];
if v is class(tcomponent) then
begin
dc.DrawText(v.name,rect,DT_VCENTER.|DT_LEFT .|DT_SINGLELINE);
end
end
function FormatTMF(d);override;
begin
if d is class(tcomponent) then
begin
r := d.name;
if r then return r;
end
return false;
end
function GetItemValue(V);override;
begin
if v is class(TDComponent) then r := v.GetTrueComponent();
return r;
end
function create(owner);override;
begin
inherited;

View File

@ -2518,7 +2518,7 @@ type tcoolbar = class(tcustomcoolbar)
end
function publishs();override;
begin
return array("name","enabled","caption","autosize","border","wsdlgmodalframe","font","color","dragbtncolor","visible","arrange");
return array("name","enabled","caption","autosize","align","border","wsdlgmodalframe","font","color","dragbtncolor","visible","arrange");
end
end
type tsplitter = class(tcustomsplitter)

View File

@ -26,7 +26,7 @@ type tcustomcoolbar=class(tcustomcontrol)
end
function ControlDeleted(AControl);override;
begin
fcoolbands.deleteitem(AControl);
fcoolbands.deleteitem(AControl,true);
end
function Notification(o,op);override;
begin
@ -47,86 +47,80 @@ type tcustomcoolbar=class(tcustomcontrol)
function WMLBUTTONUP(o,e);override;//ÍÏקʵÏÖ
begin
if csDesigning in ComponentState then exit;
//if e.button=mbLeft then
//begin
if FIs_Draging then
if FIs_Draging then
begin
_wapi.ImageList_DragLeave(self.Handle);
_wapi.ImageList_EndDrag();
if fdragenode then
begin
_wapi.ImageList_DragLeave(self.Handle);
_wapi.ImageList_EndDrag();
if fdragenode then
r := fcoolbands.getnodebyxy(e.xpos,e.ypos);
if fcoolbands.moveitemto(fdragenode,r[0],r[1]) then
begin
r := fcoolbands.getnodebyxy(e.xpos,e.ypos);
if fcoolbands.moveitemto(fdragenode,r[0],r[1]) then
doControlALign();
InvalidateRect(nil,false);
end
end else
if fsizenode then
begin
ctl := fsizenode.fctl;
clr := ctl.BoundsRect;
y := e.ypos;
if y> clr[1] and (y<clr[1]+clr[3]) then
begin
nwid := e.xpos-ctl.left;
if nwid>10 then
begin
ctl.Width := nwid;
doControlALign();
InvalidateRect(nil,false);
end
end else
if fsizenode then
begin
ctl := fsizenode.fctl;
clr := ctl.BoundsRect;
y := e.ypos;
if y> clr[1] and (y<clr[1]+clr[3]) then
begin
nwid := e.xpos-ctl.left;
if nwid>10 then
begin
ctl.Width := nwid;
doControlALign();
InvalidateRect(nil,false);
end
end
end
EnabledChild(true);
FWill_Drag := true;
FIs_Draging := false;
_wapi.clipcursor(0);
return ;
end
//end
EnabledChild(true);
FWill_Drag := true;
FIs_Draging := false;
_wapi.clipcursor(0);
return ;
end
inherited;
end
function WMLButtonDown(o,e);override;//ÍÏ×§ÊÍ·Å
begin
if csDesigning in ComponentState then exit;
//if e.button=mbLeft then
//begin
xy := e.pos;
trk := -1;
for i,v in fcoolbands.data do
xy := e.pos;
trk := -1;
for i,v in fcoolbands.data do
begin
if pointinrect(xy,v.fdragrect) then //ÍÏ×§
begin
if pointinrect(xy,v.fdragrect) then //ÍÏ×§
begin
trk := 0;
fdragenode := v;
fsizenode := nil;
break;
end
if pointinrect(xy,v.fsizerect) then //µ÷Õû´óС
begin
trk := 1;
fdragenode := nil;
fsizenode := v;
break;
end
trk := 0;
fdragenode := v;
fsizenode := nil;
break;
end
if pointinrect(xy,v.fsizerect) then //µ÷Õû´óС
begin
trk := 1;
fdragenode := nil;
fsizenode := v;
break;
end
end
if trk<0 then return inherited;
nxy := clienttowindow(e.xpos,e.ypos);
if FWill_Drag then
begin
FWill_Drag := false;
FIs_Draging := true;
_wapi.ImageList_BeginDrag(FDRageimglist.Handle,trk,12,12);
_wapi.ImageList_DragEnter(self.Handle,nxy[0],nxy[1]);
crect := clientrect;
ps := array(clienttoscreen(crect[0],crect[1]),clienttoscreen(crect[2],crect[3]));
_wapi.clipcursor(ps);
EnabledChild(false);
return ;
end
//end
end
if trk<0 then return inherited;
nxy := clienttowindow(e.xpos,e.ypos);
if FWill_Drag then
begin
FWill_Drag := false;
FIs_Draging := true;
_wapi.ImageList_BeginDrag(FDRageimglist.Handle,trk,12,12);
_wapi.ImageList_DragEnter(self.Handle,nxy[0],nxy[1]);
crect := clientrect;
ps := array(clienttoscreen(crect[0],crect[1]),clienttoscreen(crect[2],crect[3]));
_wapi.clipcursor(ps);
EnabledChild(false);
return ;
end
inherited;
end
function WMMouseMove(o,e);override; //ÒÆ¶¯
@ -171,7 +165,8 @@ type tcustomcoolbar=class(tcustomcontrol)
swid := 10;
y := 0;
rhs := fcoolbands.getrowheights();
if autosize then
bal := Align;
if autosize and ( bal =alTop or bal=alBottom) then
begin
rc := ClientRect;
nh := sum(rhs);
@ -182,7 +177,7 @@ type tcustomcoolbar=class(tcustomcontrol)
begin
Align := alNone;
Height := bw+nh;
Align := alTop;
Align := bal;
return ;
end
end
@ -454,13 +449,15 @@ type tcoolbarlines = class() //
line := new tnumindexarray();
flines.unshift(line);
end
function deleteitem(it,f); //ɾ³ýÒ»Ïî
function deleteitem(it,ifctl); //ɾ³ýÒ»Ïî
begin
for i,v in flines.data do
begin
for j ,vj in v.data do
begin
if vj = it then
if ifctl then vjctl := vj.fctl;
else vjctl := vj;
if vjctl = it then
begin
v.splice(j,1);
if v.length()<1 then

View File

@ -387,12 +387,16 @@ type tcustompagecontrol = class(TCustomControl)
end
end
public
function getsheetrect(); //»ñµÃsheet
begin
{**
@explan(说明) 获得sheet可视区域 %%
@return(array) array(左,上,右,下) %%
**}
if not FClientarea then CalcTabs();
return FClientarea;
end
public
function DesigningClick();override;
begin
return true;