界面库

coolbar
This commit is contained in:
JianjunLiu 2022-08-29 15:28:37 +08:00
parent 26b74435fb
commit fad69fa5e4
2 changed files with 56 additions and 24 deletions

View File

@ -2490,7 +2490,7 @@ type tcoolbar = class(tcustomcoolbar)
end end
function publishs();override; function publishs();override;
begin begin
return array("name","enabled","caption","autosize","font","color","dragbtncolor","sizebtncolor","visible","arrange"); return array("name","enabled","caption","autosize","border","font","color","dragbtncolor","visible","arrange");
end end
end end
@ -2503,7 +2503,6 @@ type TTreeCtlNode = class( TcustomTreeCtlNode)
begin begin
inherited; inherited;
end end
end end
type TTreeCtl = class(TcustomTreeCtl) type TTreeCtl = class(TcustomTreeCtl)
{** {**

View File

@ -17,8 +17,7 @@ type tcustomcoolbar=class(tcustomcontrol)
Align := alTop; Align := alTop;
FWill_Drag := true; FWill_Drag := true;
cimgst(); cimgst();
fsizebtncolor := _wapi.GetSysColor(COLOR_MENUBAR); fdragbtncolor := _wapi.GetSysColor(COLOR_MENUBAR);
fdragbtncolor := fsizebtncolor;
end end
function ControlAppended(AControl);override; function ControlAppended(AControl);override;
begin begin
@ -137,13 +136,35 @@ type tcustomcoolbar=class(tcustomcontrol)
begin begin
nxy := clienttowindow(e.xpos,e.ypos); nxy := clienttowindow(e.xpos,e.ypos);
_wapi.ImageList_DragMove(nxy[0],nxy[1]); _wapi.ImageList_DragMove(nxy[0],nxy[1]);
end end else
begin
xy := e.pos();
for i,v in fcoolbands.data do
begin
if pointinrect(xy,v.fdragrect) then //ÍÏ×§
begin
cursor := OCR_SIZEALL;
flg := true;
break;
end
if pointinrect(xy,v.fsizerect) then //ÍÏ×§
begin
cursor := OCR_SIZEWE;
flg := true;
break;
end
end
if not flg then
begin
cursor := OCR_NORMAL;
end
end
inherited; inherited;
end end
function doControlALign();override;//µ÷ÕûλÖà function doControlALign();override;//µ÷ÕûλÖÃ
begin begin
mwid := 10; mwid := 10;
swid := 12; swid := 10;
y := 0; y := 0;
rhs := fcoolbands.getrowheights(); rhs := fcoolbands.getrowheights();
if autosize then if autosize then
@ -163,13 +184,17 @@ type tcustomcoolbar=class(tcustomcontrol)
lk := new tflag(); lk := new tflag();
for i,v in fcoolbands.data2 do for i,v in fcoolbands.data2 do
begin begin
x := 0; x := 0;
bss := array();
for j,bsi in v do for j,bsi in v do
begin begin
ctl := bsi.fctl; ctl := bsi.fctl;
if ctl.Visible then if ctl.Visible then
begin begin
bsi.fdragrect := array(x,y,x+mwid,y+rhs[i]); bss[length(bss)]:= bsi;
drc := array(x,y,x+mwid,y+rhs[i]);
bsi.fdragrect := drc;
bsi.fbtnrect := drc;
h := ctl.Height; h := ctl.Height;
w := ctl.Width; w := ctl.Width;
x += mwid; x += mwid;
@ -182,17 +207,31 @@ type tcustomcoolbar=class(tcustomcontrol)
ctl.SetBounds(x,y+dy,w,h); ctl.SetBounds(x,y+dy,w,h);
x+=w; x+=w;
bsi.fsizerect := array(x,y,x+swid,y+rhs[i]); bsi.fsizerect := array(x,y,x+swid,y+rhs[i]);
x+=swid; //x+=swid;
end else end else
begin begin
bsi.fdragrect := array(0,0,0,0); bsi.fdragrect := array();//array(0,0,0,0);
bsi.fctlrect := array(0,0,0,0); bsi.fctlrect := array();//array(0,0,0,0);
bsi.fsizerect := array(0,0,0,0); bsi.fsizerect := array();//array(0,0,0,0);
end end
end end
bsi.fsizerect := array(0,0,0,0); bsi.fsizerect := array();//array(0,0,0,0);
y+=rhs[i]; y+=rhs[i];
for i := 0 to length(bss)-2 do //ÖØÐÂÉèÖÃλÖÃ
begin
bs := bss[i];
rc := bs.fsizerect;
if rc then
begin
bs2 := bss[i+1];
rc[1] := rc[1]+integer((rc[3]-rc[1])/2);
bs.fsizerect := rc;
rc := bs2.fdragrect;
rc[3] := rc[3]-integer((rc[3]-rc[1])/2);
bs2.fdragrect := rc;
end
end
end end
end end
function paint();override; //»æÖÆ function paint();override; //»æÖÆ
@ -211,13 +250,8 @@ type tcustomcoolbar=class(tcustomcontrol)
end end
for i,v in fcoolbands.data do for i,v in fcoolbands.data do
begin begin
//dc.brush.color := 0x87CEEB;
dc.brush.color := fdragbtncolor; dc.brush.color := fdragbtncolor;
rc1 := v.fdragrect; paintbtn(v.fbtnrect);
paintbtn(v.fdragrect);
//dc.brush.color := 0xEEE8AA;
dc.brush.color := fsizebtncolor;
paintbtn(v.fsizerect);
end end
dc.brush.color := cl; dc.brush.color := cl;
dc.pen.color := bcl; dc.pen.color := bcl;
@ -230,11 +264,9 @@ type tcustomcoolbar=class(tcustomcontrol)
property autosize:bool read fautosize write setautosize; property autosize:bool read fautosize write setautosize;
property arrange:lazystr read getarrange write setarrange; property arrange:lazystr read getarrange write setarrange;
property dragbtncolor:color read fdragbtncolor write fdragbtncolor; property dragbtncolor:color read fdragbtncolor write fdragbtncolor;
property sizebtncolor:color read fsizebtncolor write fsizebtncolor;
private private
fautosize ; fautosize ;
fdragbtncolor; fdragbtncolor;
fsizebtncolor;
fsizelocker; fsizelocker;
function paintbtn(rc1); function paintbtn(rc1);
begin begin
@ -397,6 +429,7 @@ type tcoolband = class() //
fdragrect; fdragrect;
fsizerect; fsizerect;
fctlrect; fctlrect;
fbtnrect;
private private
fenable; fenable;
end end
@ -526,7 +559,7 @@ type tcoolbarlines = class() //
if vj["visible"] then if vj["visible"] then
h := max(h,vj["height"]); h := max(h,vj["height"]);
end end
r[i] := max(20,h); r[i] := h;// max(20,h);
end end
return r; return r;
end end