From 476be4b95c3ba155e9262df93cf1fc11c691c37f Mon Sep 17 00:00:00 2001 From: JianjunLiu Date: Fri, 16 Sep 2022 17:21:36 +0800 Subject: [PATCH] =?UTF-8?q?=E7=95=8C=E9=9D=A2=E5=BA=93?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 浼樺寲coolbar --- designer/tslvcldesigner.tsf | 25 +----- funcext/tvclib/tslvcl.tsf | 2 +- funcext/tvclib/utslvclcoolbar.tsf | 139 +++++++++++++++--------------- funcext/tvclib/utslvclpage.tsf | 6 +- 4 files changed, 75 insertions(+), 97 deletions(-) diff --git a/designer/tslvcldesigner.tsf b/designer/tslvcldesigner.tsf index c2a8430..975b6f1 100644 --- a/designer/tslvcldesigner.tsf +++ b/designer/tslvcldesigner.tsf @@ -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; diff --git a/funcext/tvclib/tslvcl.tsf b/funcext/tvclib/tslvcl.tsf index 6eb567f..0162b69 100644 --- a/funcext/tvclib/tslvcl.tsf +++ b/funcext/tvclib/tslvcl.tsf @@ -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) diff --git a/funcext/tvclib/utslvclcoolbar.tsf b/funcext/tvclib/utslvclcoolbar.tsf index 6e9b03e..90777cb 100644 --- a/funcext/tvclib/utslvclcoolbar.tsf +++ b/funcext/tvclib/utslvclcoolbar.tsf @@ -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 (y10 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 (y10 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 + 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 trk<0 then return inherited; - nxy := clienttowindow(e.xpos,e.ypos); - if FWill_Drag then + if pointinrect(xy,v.fsizerect) 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 + 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 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 diff --git a/funcext/tvclib/utslvclpage.tsf b/funcext/tvclib/utslvclpage.tsf index 3655951..68ddf3a 100644 --- a/funcext/tvclib/utslvclpage.tsf +++ b/funcext/tvclib/utslvclpage.tsf @@ -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;