From 0e03a05db960c0b822a86283de8d3142dec680fa Mon Sep 17 00:00:00 2001 From: JianjunLiu Date: Wed, 17 Aug 2022 12:00:57 +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 parentfont,parentcolor --- funcext/tvclib/tcontrol.tsf | 57 +++++++-------- funcext/tvclib/tslvcl.tsf | 107 ++++++++++------------------ funcext/tvclib/twincontrol.tsf | 26 +------ funcext/tvclib/utslvclaction.tsf | 2 +- funcext/tvclib/utslvclmemstruct.tsf | 35 +++++++++ funcext/tvclib/utslvclstdctl.tsf | 10 ++- 6 files changed, 112 insertions(+), 125 deletions(-) diff --git a/funcext/tvclib/tcontrol.tsf b/funcext/tvclib/tcontrol.tsf index 8b5189a..ad72df8 100644 --- a/funcext/tvclib/tcontrol.tsf +++ b/funcext/tvclib/tcontrol.tsf @@ -80,8 +80,8 @@ type tcontrol = class(tcomponent) FPopupMenu;//: TPopupMenu; //FIsControl;//: Boolean; FShowHint;//: Boolean; - //FParentColor;//: Boolean; - FParentFont;//: Boolean; + FParentColor;//: Boolean; + FParentFont;//: Boolean; //FParentShowHint;//: Boolean; //FAutoSizingAll;//: boolean; //FAutoSizingSelf;//: Boolean; @@ -192,7 +192,24 @@ type tcontrol = class(tcomponent) end FAnchors := val; end - + function SetParentFont(v:bool);virtual; + begin + nv := v?true:false; + if FParentFont <> nv then + begin + FParentFont := nv; + return 1; + end + end + function SetParentcolor(v:bool);virtual; + begin + nv := v?true:false; + if FParentColor <> nv then + begin + FParentColor := nv; + return 1; + end + end private function SetUnAlignBounds(Value); begin @@ -244,19 +261,6 @@ type tcontrol = class(tcomponent) begin return RealSetText(Value); end - function SetParentFont(v:bool); - begin - nv := v?true:false; - if FParentFont <> nv then - begin - FParentFont := nv; - if nv then - begin - hd := GetParentFontHandle(); - if Parent then Parent.Perform(New tuieventbase(CMFONTCHANGED,hd,1)); - end - end - end public function PaintStruct(); begin @@ -366,6 +370,7 @@ type tcontrol = class(tcomponent) protected function GetControlFont();virtual; begin + if ParentFont and Parent then return Parent.FFont; return FFont; end function SetControlFont(v);virtual; @@ -379,16 +384,6 @@ type tcontrol = class(tcomponent) FFont.copyfont(v); end end - function CurrentFont(); - begin - if ParentFont and Parent then return Parent.CurrentFont(); - return Font; - end - function GetParentFontHandle();virtual; - begin - if ParentFont and Parent then return Parent.GetParentFontHandle(); - return Font.Handle; - end function SetBorder(v);virtual; begin FBorder := v?true:false; @@ -1100,6 +1095,11 @@ type tcontrol = class(tcomponent) FColor := v; end end + function getcolor();virtual; + begin + if FParentColor and Parent then return Parent.Color; + return FColor; + end function SetBitmap(v);virtual; begin if v <> FBKBitmap then @@ -1184,7 +1184,7 @@ type tcontrol = class(tcomponent) FControls := new TFpList(); FVisible := True; FParentBidiMode := True; - FParentColor := True; + FParentColor := false; FParentFont := false; FDesktopFont := True; FParentShowHint := True; @@ -1465,6 +1465,7 @@ type tcontrol = class(tcomponent) **} public property ParentFont:bool read FParentFont write SetParentFont; + property Parentcolor:bool read FParentcolor write SetParentcolor; property Caption:string read GetText write SetText ; property Enabled:bool read GetEnabled write SetEnabled; property Cursor:syscursor read GetCursor write SetCursor; @@ -1523,7 +1524,7 @@ type tcontrol = class(tcomponent) property BoundsRect read GetBoundsRect write SetBoundsRect; property Zorder read GetZorder write SetZorder; property ControlState: TControlState read FControlState write FControlState; - property Color:color read FColor write SetColor;//FColor; + property Color:color read getcolor write SetColor;//FColor; property BKBitmap:tbitmap read FBKBitmap write SetBitmap; property OnMeasureItem read FOnMeasureItem write FOnMeasureItem; property OnDrawItem read FOnDrawItem write FOnDrawItem; diff --git a/funcext/tvclib/tslvcl.tsf b/funcext/tvclib/tslvcl.tsf index bb69d2c..8c3d27d 100644 --- a/funcext/tvclib/tslvcl.tsf +++ b/funcext/tvclib/tslvcl.tsf @@ -707,7 +707,7 @@ type TLabel = class(TGraphicControl) begin return array("name","action","align","anchors","caption","enabled","font", "popupmenu","visible", - "height","width","left","top","color","bkbitmap", + "height","width","left","top","color","bkbitmap","parentcolor","parentfont", "onpopupmenu","onmousedown","onmouseup"); end {** @@ -908,7 +908,7 @@ type TPanel=class(TScrollingWinControl) // return array("name","align","anchors","caption","enabled","cursor","font", "popupmenu","visible", "height","width","left","top","border", - "zorder","color","bkbitmap", + "zorder","color","bkbitmap","parentcolor","parentfont", "minwidth","minheight", "wspopup","wsdlgmodalframe","wscaption","wssizebox","wssysmenu", "autoscroll", @@ -1459,7 +1459,7 @@ type TVCForm = class(TScrollingWinControl) "name","action","caption","cursor","font", "popupmenu","visible", "height","width","left","top", - "color","bkbitmap", + "color","bkbitmap","parentcolor","parentfont", "minwidth","minheight","wssizebox","wsdlgmodalframe", "mainmenu","minmaxbox","formicon","tray", "onsize","onmove","onmousemove", @@ -1556,7 +1556,7 @@ type tbtn = class(tcustombtn) function publishs();override; begin return array("name","action","left","top","width","height", - "align","anchors","caption","font","enabled","visible","bkbitmap","color","tabstop", + "align","anchors","caption","font","enabled","visible","bkbitmap","color","parentcolor","parentfont","tabstop", "onclick","onmousemove","onsetfocus","onkillfocus","onkeyup","onkeydown","onkeypress"); end @@ -1572,7 +1572,7 @@ type tcheckbtn = class(tcustomcheckbtn) function publishs();override; begin return array("name","left","top","width","height", - "caption","anchors","enabled","color","visible","font", + "caption","anchors","enabled","color","visible","font","parentcolor","parentfont", "textpos","checked","lefttext","tabstop","onclick","onmousemove","onmousedown","onmouseup"); end @@ -1588,7 +1588,7 @@ type tradiobtn = class(tcustomradiobtn) function publishs();override; begin return array("name","left","top","width","height", - "caption","anchors","enabled","color","visible","font", + "caption","anchors","enabled","color","visible","font","parentcolor","parentfont", "textpos","checked","lefttext","tabstop","onclick","onmousemove","onmousedown","onmouseup"); end @@ -1680,7 +1680,7 @@ type tedit = class(tcustomedit) end function publishs();override; begin - return array("name","align","anchors","border","font","enabled","popupmenu","visible","height","width","left","top","text","placeholder" + return array("name","align","anchors","border","font","color","enabled","parentcolor","parentfont","popupmenu","visible","height","width","left","top","text","placeholder" ,"readonly","limitlength","linewrap","tabstop","onmousemove","onpopupmenu","onmousedown","onmouseup","onkeyup" ,"onkeydown","onkeypress","onmaxtext","onkillfocus","onsetfocus","onchange"); end @@ -1696,7 +1696,7 @@ type tpassword = class(tcustompassword) function publishs();override; begin return array("name", - "align","anchors","font", + "align","anchors","font","color","parentcolor","parentfont", "popupmenu","visible", "height","width","left","top", "text","placeholder","readonly","limitlength","tabstop", @@ -1768,7 +1768,7 @@ type tmemo = class(TSynMemoNorm) **} function publishs();override; begin - return array("name","font", + return array("name","font","color","parentcolor","parentfont", "popupmenu","visible","anchors","align", "height","width","left","top", "text","readonly", @@ -1797,7 +1797,7 @@ type tgroupbox = class(tcustomgroupbox) function publishs();override; begin return array("name","left","top","width","height", - "align","anchors","border","caption","color","enabled","font","visible","textpos","wsdlgmodalframe", + "align","anchors","border","caption","color","enabled","font","visible","textpos","parentcolor","parentfont","wsdlgmodalframe", "onsize"); end end @@ -1874,7 +1874,7 @@ type TCheckGroupBox=class(TRadioGroupBox) begin return array("name","left","top","width","height", "align","border","ItemIndexs","caption","color","enabled","font", - "minheight","minwidth","parentfont","visible","textpos","wsdlgmodalframe"); + "minheight","minwidth","parentfont","parentfont","visible","textpos","wsdlgmodalframe"); end end @@ -2152,7 +2152,7 @@ type TRadioGroupBox=class(TGroupbox) begin r := array("name","left","top","width","height", "align","border","ItemIndexs","caption","color","enabled","font", - "minheight","minwidth","parentfont","visible","textpos","wsdlgmodalframe","onselectionchanged"); + "minheight","minwidth","parentfont","parentcolor","visible","textpos","wsdlgmodalframe","onselectionchanged"); return r; end {** @@ -2275,10 +2275,10 @@ type TColorbox=class(TcustomListBox) end function publishs();override; begin - return array("name","align","anchors","font", + return array("name","align","anchors","font","color", "visible","border","enabled", "height","width","left","top", - "wsdlgmodalframe","popupmenu", + "wsdlgmodalframe","popupmenu","parentcolor","parentfont", "onmousedown","onmouseup", "onselectionchange" ); @@ -2393,8 +2393,8 @@ type TColorCombobox=class(TCustomComboBoxbase) end function publishs();override; begin - return array("name","anchors","font", - "visible", + return array("name","anchors","font","color", + "visible","parentcolor","parentfont", "height","width","left","top", "readonly","itemindex", "onselchanged","ondropdown","oncloseup"); @@ -2420,48 +2420,15 @@ type TComboBox = class(TcustomComboBox) end function publishs();override; begin - return array("name","font","border", - "visible","anchors","align","enabled", + return array("name","font","border","font","color", + "visible","anchors","align","enabled","parentcolor","parentfont", "height","width","left","top", "readonly","itemindex", - "items","oncloseup","ondropdown","onselchanged","oneditchanged","oneditupdate"); + "items","oncloseup","ondropdown","onselchanged","oneditchanged"); end end -//工具栏,状态栏 -type ttagNMCUSTOMDRAWINFO=class(tslcstructureobj) - private - static SSTRUCT; - class function getstruct() - begin - if not SSTRUCT then SSTRUCT := MemoryAlignmentCalculate(array( - ("hdr","user", - ( - ("hwndfrom","intptr",0), - ("idfrom","intptr",0), - ("code","int",0))), - ("dwdrawstage","int",0), - ("hdc","intptr",0), - ("rc","int[4]", - (0,0,0,0)), - ("dwitemspec","intptr",0), - ("uitemstate","int",0), - ("litemlparam","intptr",0))); - return SSTRUCT; - end - public - function create(ptr) - begin - inherited create(getstruct(),ptr); - end - property hdr index "hdr" read _getvalue_ write _setvalue_; - property dwdrawstage index "dwdrawstage" read _getvalue_ write _setvalue_; - property hdc index "hdc" read _getvalue_ write _setvalue_; - property rc index "rc" read _getvalue_ write _setvalue_; - property dwitemspec index "dwitemspec" read _getvalue_ write _setvalue_; - property uitemstate index "uitemstate" read _getvalue_ write _setvalue_; - property litemlparam index "litemlparam" read _getvalue_ write _setvalue_; -end + type TToolButton = class(TcustomToolButton) @@ -2474,7 +2441,7 @@ type TToolButton = class(TcustomToolButton) end function publishs();override; begin - return array("name","caption","enabled","stylesep","imageid","visible","onclick","popupmenu"); + return array("name","action","caption","enabled","stylesep","imageid","visible","onclick","popupmenu"); end end type TToolBar = class( TcustomToolBar) @@ -2897,7 +2864,7 @@ type TTreeView=class(TTreeCtl) begin return array("name", "left","top","width","height","caption","align","anchors", - "checkbox","visible","itemheght","imagelist","hasline","singleexpand", + "checkbox","visible","itemheght","imagelist","hasline","singleexpand","color","font","parentcolor","parentfont", "lazyitems","onselchanged","onmousedown","onsetfocus","onkillfocus","onkeyup","onkeydown"); end //property OnDeleteItem read FOnDeleteItem write FOnDeleteItem; @@ -2919,7 +2886,7 @@ type TTabSheet = class(tcustomtabsheet) end function publishs();override; begin - return array("name","caption","color","border","wsdlgmodalframe","onsize"); + return array("name","caption","font","color","border","parentcolor","parentfont","wsdlgmodalframe","onsize"); end end type tpagecontrol = class(tcustompagecontrol) @@ -2933,7 +2900,7 @@ type tpagecontrol = class(tcustompagecontrol) function publishs();override; begin return array("name","left","top","width","height", - "align","anchors","border","caption","popupmenu","enabled","visible","cursel","cursor", + "align","anchors","color","font","parentcolor","parentfont","border","caption","popupmenu","enabled","visible","cursel","cursor", "wsdlgmodalframe","wssizebox","OnSelChange"); end end @@ -2994,7 +2961,7 @@ type TPairSplitterSide=class(TCustomControl) end function publishs();override; begin - return array("name","border","caption","color","popupmenu","bkbitmap","wsdlgmodalframe","onsize"); + return array("name","border","caption","color","font","parentcolor","parentfont","popupmenu","bkbitmap","wsdlgmodalframe","onsize"); end end type TPairSplitter=class(tcustomcontrol) // @@ -3294,7 +3261,7 @@ type TPairSplitter=class(tcustomcontrol) // function publishs();override; begin return array("name","left","top","width","height", - "align","anchors","border","caption","enabled","visible","splittertype","position", + "align","anchors","border","color","font","caption","enabled","visible","parentcolor","parentfont","splittertype","position", "wsdlgmodalframe","wscaption","wspopup","wssizebox","wssysmenu"); end {** @@ -4353,7 +4320,7 @@ type TListView = class(TDrawGrid) property NumberAlign read FIntAlign write SetIntAlign; function publishs();override; begin - return array("name","height","width","left","top","border","anchors","align", + return array("name","height","width","left","top","border","anchors","align","font","color","parentcolor","parentfont", "autoscroll","itemcount","itemheight","mousesizecell", "fixedrows","fixedcolumns","columncount", "gridline","columnheader","columns", @@ -4395,7 +4362,7 @@ type tprogressbar = class(tcustomprogressbar) begin return array("name", "align","anchors", - "popupmenu","visible","enabled", + "popupmenu","color","visible","enabled","parnetcolor", "height","width","left","top", "vertical","range","position","barcolor","onmousemove","onpopupmenu", "onmousedown","onmouseup"); @@ -4504,8 +4471,8 @@ type tmonthcalendar = class(TCustomControl) property onSelectChange:eventhandler read FonSelectChange write FonSelectChange; function publishs();override; begin - return array("name","caption","anchors","enabled","font", - "popupmenu","visible", + return array("name","caption","anchors","enabled","color", + "popupmenu","visible","parentcolor", "height","width","left","top","border","onmousemove","onpopupmenu", "onmousedown","onmouseup","onselect","onselectchange"); end @@ -4692,8 +4659,8 @@ type tdatetimepicker = class(tthreeEntry) end function publishs();override; begin - return array("name","caption","anchors","enabled","font", - "popupmenu","visible", + return array("name","caption","anchors","enabled","font","color", + "popupmenu","visible","parentcolor","parentfont", "height","width","left","top","border","onmousemove","onpopupmenu", "onmousedown","onmouseup","onselectchange"); end @@ -4862,8 +4829,8 @@ type ttimepicker = class(tthreeEntry) end function publishs();override; begin - return array("name","align","anchors","caption","enabled","font", - "popupmenu","visible", + return array("name","align","anchors","caption","enabled","font","color", + "popupmenu","visible","parentcolor","parentfont", "height","width","left","top","border","onmousemove","onpopupmenu", "onmousedown","onmouseup","onkeyup","onkeydown","onselectchange"); end @@ -4902,7 +4869,7 @@ type tipaddr = class(tcustomipaddr) end function publishs();override; begin - return array("name","align","anchors","caption","visible","height","width","left","top", + return array("name","align","anchors","font","color","caption","visible","parentcolor","parentfont","height","width","left","top", "ipaddr","HasPort","onAddrChange","border","wsdlgmodalframe"); end end @@ -5165,7 +5132,7 @@ type TAction=class(TCustomAction) function publishs();override; begin - r := array("name","caption","enabled","onexecute"); + r := array("name","caption","enabled","shortcut","onexecute"); return r; end end @@ -5263,7 +5230,7 @@ type TOpenFileADlg=class(tcustomfsdlg) function publishs();override; begin return array("name","caption","filter","filterindex","filename", - "defaultfileextension","initialdlg","showhidden","multiselected","linkfilepath"); + "defaultfileextension","showhidden","multiselected"); //,"linkfilepath" end end type TFolderChooseADlg = class(tcustomfolderdlg) diff --git a/funcext/tvclib/twincontrol.tsf b/funcext/tvclib/twincontrol.tsf index 23e098d..1e3790b 100644 --- a/funcext/tvclib/twincontrol.tsf +++ b/funcext/tvclib/twincontrol.tsf @@ -363,15 +363,6 @@ type TWinControl = class(tcontrol) //if Align<>alNone then Parent.DoControlAlign(); end - if ParentFont then - begin - hd := GetParentFontHandle(); - end else - hd := Font.Handle; - if hd then - begin - _send_(WM_SETFONT,hd,1,1); //send 修改为 post - end ImageChanged(); // "id:",self.caption,_wapi.GetWindowLongPtrA(FHandle,GWLP_ID); end @@ -609,19 +600,6 @@ type TWinControl = class(tcontrol) else self.Perform(messagecreater(nil,WM_MOUSELEAVE,0,0)); if initem then initem.Perform(messagecreater(nil,WM_MOUSEHOVER,0,0)); end - function GetParentFontHandle();override; - begin - {** - @explan(说明) 获取字体的句柄 %% - @return(pointer) - **} - if ParentFont and Parent then return Parent.GetParentFontHandle(); - if HandleAllocated()then - begin - return _send_(WM_GETFONT,0,0); - end else - return inherited; - end public //消息绑定函数 function WMMouseMove(o,e):LM_MOUSEMOVE;override; begin @@ -2503,8 +2481,7 @@ type TWinControl = class(tcontrol) if w and (o is w ) then begin if dispatchmenushortcut(o.MainMenu,st) then return "havedoshortcut"; - end - + end end function dispatchmenushortcut(mu,st); //菜单分发热键 begin @@ -2527,5 +2504,4 @@ type TWinControl = class(tcontrol) if mu.ExecuteCommand("doshortcut",st)="havedoshortcut" then return "havedoshortcut"; end end - end \ No newline at end of file diff --git a/funcext/tvclib/utslvclaction.tsf b/funcext/tvclib/utslvclaction.tsf index 6cfd729..0026482 100644 --- a/funcext/tvclib/utslvclaction.tsf +++ b/funcext/tvclib/utslvclaction.tsf @@ -273,7 +273,7 @@ type TCustomAction=class(TContainedAction) property Checked:bool read FChecked write SetChecked; property Enabled:bool read FEnabled write SetEnabled; property Visible:bool read FVisible write SetVisible; - property ShortCut read getshortcut write SetShortCut; + property ShortCut:string read getshortcut write SetShortCut; function publishs();override; begin r := array("name","caption","enabled","onexecute"); diff --git a/funcext/tvclib/utslvclmemstruct.tsf b/funcext/tvclib/utslvclmemstruct.tsf index 58e344c..fca6b42 100644 --- a/funcext/tvclib/utslvclmemstruct.tsf +++ b/funcext/tvclib/utslvclmemstruct.tsf @@ -1441,6 +1441,41 @@ type TMONITORINFO=class(tslcstructureobj) property dwflags index "dwflags" read _getvalue_ write _setvalue_; end +//工具栏,状态栏 +type ttagNMCUSTOMDRAWINFO=class(tslcstructureobj) + private + static SSTRUCT; + class function getstruct() + begin + if not SSTRUCT then SSTRUCT := MemoryAlignmentCalculate(array( + ("hdr","user", + ( + ("hwndfrom","intptr",0), + ("idfrom","intptr",0), + ("code","int",0))), + ("dwdrawstage","int",0), + ("hdc","intptr",0), + ("rc","int[4]", + (0,0,0,0)), + ("dwitemspec","intptr",0), + ("uitemstate","int",0), + ("litemlparam","intptr",0))); + return SSTRUCT; + end + public + function create(ptr) + begin + inherited create(getstruct(),ptr); + end + property hdr index "hdr" read _getvalue_ write _setvalue_; + property dwdrawstage index "dwdrawstage" read _getvalue_ write _setvalue_; + property hdc index "hdc" read _getvalue_ write _setvalue_; + property rc index "rc" read _getvalue_ write _setvalue_; + property dwitemspec index "dwitemspec" read _getvalue_ write _setvalue_; + property uitemstate index "uitemstate" read _getvalue_ write _setvalue_; + property litemlparam index "litemlparam" read _getvalue_ write _setvalue_; +end + *) diff --git a/funcext/tvclib/utslvclstdctl.tsf b/funcext/tvclib/utslvclstdctl.tsf index 038582d..67d4c70 100644 --- a/funcext/tvclib/utslvclstdctl.tsf +++ b/funcext/tvclib/utslvclstdctl.tsf @@ -5120,7 +5120,15 @@ type TCustomSpinEdit = class(TCustomControl) function DoControlAlign(rect);override; begin rect := ClientRect; - FEdit.SetBounds(0,0,rect[2]-FUDwidth,rect[3]); + {$ifdef linux} + if csDesigning in ComponentState then + begin + rect[0]+=2; + rect[1]+=2; + rect[3]-=2; + end + {$endif} + FEdit.SetBounds(rect[0],rect[1],rect[2]-FUDwidth,rect[3]); cl := rect; //ClientRect(); cl[0]:= cl[2]-FUDwidth; cl2 := cl;