更新界面库

This commit is contained in:
2025-01-17 15:52:54 +08:00
parent dc518d066b
commit 1e37d94f22
15 changed files with 750 additions and 94 deletions
+48 -4
View File
@@ -84,6 +84,7 @@ type TDComponent = class()
reindex(fdcomponentobjects,array(n:nil));
end
private
Fexcludepropertys;
fisiherted;
finheritedparent;
static fdcomponentobjects;
@@ -99,6 +100,23 @@ type TDComponent = class()
FMenus; //菜单
FBitmap;
FImgs;
function setexclude(r);
begin
//if r = Fexcludepropertys then return ;
Fexcludepropertys := array();
if ifarray(r) then
begin
for i,v in r do
begin
Fexcludepropertys[v] := nil;
end
end
end
function excludepro(r);
begin
if ifarray(r) and Fexcludepropertys then reindex(r,Fexcludepropertys);
return r;
end
function SetImgs(id);
begin
FImgs := id;
@@ -502,6 +520,7 @@ type TDComponent = class()
{**
@explan(说明) 构造控件的构造函数 %%
**}
Fexludepropertys := array();
fiscontainerdcmp := true;
feventnametable := array();
@@ -720,7 +739,7 @@ type TDComponent = class()
{**
@explan(说明)获得所有的属性%%
**}
if FCwnd then return FCwnd.GetPublishProperties();
if FCwnd then return excludepro(FCwnd.GetPublishProperties());
return array();
end
function GetPublishEvents();virtual;
@@ -728,7 +747,7 @@ type TDComponent = class()
{**
@explan(说明)获得改变事件回调属性%%
**}
if FCwnd then return FCwnd.GetPublishEvents();
if FCwnd then return excludepro(FCwnd.GetPublishEvents());
end
function DefaultAlign();virtual;
begin
@@ -920,6 +939,7 @@ format("
published
property isinherited read fisiherted write fisiherted;//为继承做准备
property inheritedparent read finheritedparent write finheritedparent;
property excludepropertys read Fexcludepropertys write setexclude;
end
type TDRootComponent = class(TDComponent)
{**
@@ -1430,7 +1450,7 @@ type TImageListWindow = class(TDVirutalWindow)
inherited;
width := 30;
height := 30;
WindowFileds := array("left","top");
WindowFileds := array("left","top","width","height");
BindComp := new TControlImageList(self);;
end
function bitmapinfo();override;
@@ -1471,7 +1491,8 @@ type TDImageList = class(TDRootComponent)
function GetPublishProperties();override;
begin
r := inherited;
return r[ array("name","top","left","images","imgwidth","imgheight")];
r := r[ array("name","top","left","images","imgwidth","imgheight")];
return r;
end
end
@@ -1483,6 +1504,7 @@ type TGraphicLabelWindow = class(TDVirutalWindow)
function paint();override;
begin
bd := BindComp;
if not bd then return ;
cvs := canvas;
//if not bd.ParentFont then cvs.Font := bd.Font;
bd.canvas.Handle := cvs.Handle;
@@ -2686,6 +2708,7 @@ C6D53F7109130000000049454E44AE42608200";
function Create(AOwner);override;
begin
inherited;
excludepropertys := array("childsizing");
//fiscontainerdcmp := false;
fiscontainerdcmp := true;
DefaultEvent := array(
@@ -2746,6 +2769,7 @@ E488B2001B40B7405A5A1A9E8A406C10A0AA0514E5036C00DD0210387EFC3818C
function Create(AOwner);override;
begin
inherited;
excludepropertys := array("childsizing");
fiscontainerdcmp := false;
end
@@ -2773,6 +2797,7 @@ type TDListView = class(TDComponent)
function Create(AOwner);override;
begin
inherited;
excludepropertys := array("childsizing");
//fiscontainerdcmp := false;
fiscontainerdcmp := true;
DefaultEvent := array(
@@ -2813,6 +2838,7 @@ type TDgridctl = class(TDComponent)
function Create(AOwner);override;
begin
inherited;
excludepropertys := array("childsizing");
//fiscontainerdcmp := false;
fiscontainerdcmp := true;
DefaultEvent := array(
@@ -2908,6 +2934,7 @@ B79C4E2791BEA18DE3CDAFF35DC1ABB811A4313F8234790B1E92B200F80266B31
function Create(AOwner);override;
begin
inherited;
excludepropertys := array("childsizing");
end
function IsContainer();override;
begin
@@ -2960,6 +2987,7 @@ A5183913CA16C9848495A52E9D4E97F11C21C73721A9904C28B506B19AD21D177
function Create(AOwner);override;
begin
inherited;
excludepropertys := array("childsizing");
fiscontainerdcmp := false;
DefaultEvent := array(
"event":"onchange",
@@ -3005,6 +3033,7 @@ BA4550A2FFFB6007C0044475BEF4A7043C50000000049454E44AE42608200";
function Create(AOwner);override;
begin
inherited;
excludepropertys := array("childsizing");
fiscontainerdcmp := false;
end
end
@@ -3033,6 +3062,7 @@ BFC6105000000097048597300000EC300000EC301C76FA8640000008849444154
function Create(AOwner);override;
begin
inherited;
excludepropertys := array("childsizing");
fiscontainerdcmp := false;
end
end
@@ -3099,6 +3129,7 @@ A42634335A12184DD45698410A1F50D8D0DD5E47F855A066327F40486508A2174
function Create(AOwner);override;
begin
inherited;
excludepropertys := array("childsizing");
fiscontainerdcmp := false;
DefaultEvent := array(
"event":"onselchanged",
@@ -3145,6 +3176,7 @@ BCB8280732E6AADD3E00CE841A5BF62EFB2DFFB200463003DE804ADFB76078D5C
function Create(AOwner);override;
begin
inherited;
excludepropertys := array("childsizing");
fiscontainerdcmp := false;
end
end
@@ -3188,6 +3220,7 @@ EDF9EF57072C160BF782E4A2E405B610EB5DAEF3F95CBDD15809027E2148CCD78
function Create(AOwner);override;
begin
inherited;
excludepropertys := array("childsizing");
fiscontainerdcmp := false;
end
end
@@ -3233,6 +3266,7 @@ DA2D4A7078702C0989D708A6187EC0900CBE88895B1CEB82500F4D91D87929C31
function Create(AOwner);override;
begin
inherited;
excludepropertys := array("childsizing");
fiscontainerdcmp := false;
end
@@ -3304,6 +3338,7 @@ type TDListBox=class(TDComponent)
end
function Create(AOwner);override;begin
inherited;
excludepropertys := array("childsizing");
fiscontainerdcmp := false;
DefaultEvent := array(
"event":"onselchanged",
@@ -3363,6 +3398,7 @@ type TDColorBox=class(TDComponent)
function Create(AOwner);override;begin
inherited;
excludepropertys := array("childsizing");
fiscontainerdcmp := false;
end
function bitmapinfo();override;begin
@@ -3392,6 +3428,7 @@ type TDCalendar=class(TDComponent)
end
function Create(AOwner);override;begin
inherited;
excludepropertys := array("childsizing");
fiscontainerdcmp := false;
end
function GetPublishEvents();override;begin
@@ -3428,6 +3465,7 @@ type TDProgressBar=class(TDComponent)
end
function Create(AOwner);override;begin
inherited;
excludepropertys := array("childsizing");
fiscontainerdcmp := false;
end
function bitmapinfo();override;begin
@@ -3464,6 +3502,7 @@ type TDCheckBtn=class(TDComponent)
end
function Create(AOwner);override;begin
inherited;
excludepropertys := array("childsizing");
fiscontainerdcmp := false;
DefaultEvent := array(
"event":"onclick",
@@ -3540,6 +3579,7 @@ type TDTimePicker=class(TDComponent)
end
function Create(AOwner);override;begin
inherited;
excludepropertys := array("childsizing");
fiscontainerdcmp := false;
end
function bitmapinfo();override;begin
@@ -3712,6 +3752,7 @@ type TDPairSplitterSide = class(TDComponent)
function Create(AOwner);override;
begin
inherited;
excludepropertys := array("childsizing");
end
end
type TDPairSplitter = class(TDComponent)
@@ -3762,6 +3803,7 @@ BFC6105000000097048597300000EC300000EC301C76FA864000000C849444154
function Create(AOwner);override;
begin
inherited;
excludepropertys := array("autosize");
end
function ComponentCreater(tnode,owner);override;
begin
@@ -3826,6 +3868,7 @@ type TDTabSheet = class(TDComponent)
function Create(AOwner);override;
begin
inherited;
excludepropertys := array("autosize");
end
end
type TDPage = class(TDComponent)
@@ -3877,6 +3920,7 @@ FCE218FD50E80000000049454E44AE42608200";
function Create(AOwner);override;
begin
inherited;
excludepropertys := array("childsizing");
end
end
type TDtabctl = class(TDComponent)
+166 -3
View File
@@ -3,7 +3,7 @@ interface
{**
@explan(说明) 设计器属性编辑库,继承该库,定义属性编辑类 %%
**}
uses utslvclauxiliary,utslvclbase,utslvclgdi,uvcpropertytypespersistence,tslvcl,utslvcldcomponents,UTslSynMemo;
uses utslvclauxiliary,utslvclbase,utslvclgdi,uvcpropertytypespersistence,tslvcl,utslvcldcomponents,UTslSynMemo,utslvclstdctl;
function registereditpropertytodesigner(cls);
type TGCellRender = class(TSLUIBASE) //属性编辑器单元格对象基类
{**
@@ -1553,7 +1553,9 @@ type TGridCellNaturalEdit = class(TGridPropertyRender,TPropertyNatural)
FEdit.OnChanged := thisfunction(Ched);
end
FEdit.SetBoundsRect(rec);//FEdit.SetBoundsRect(FGrid.clienttoscreen(rec[0],rec[1]) union FGrid.clienttoscreen(rec[2],rec[3]));
FEdit.text := numbertotext(d["value"]);
nv := numbertotext(d["value"]);
FEdit.text := nv;
flastvalue := nv;
FEdit.parent := grid;
FEdit.SetFocus();
FEdit.visible := true;
@@ -1761,6 +1763,52 @@ type TGridCellColorEdit = class(TGridCellEditWithButton,TPropertyColor)
if FColorChoose.visible then FColorChoose.EndModal(0);
end
end
type TGridCellchildsizingEdit = class(TGridCellEditWithButton,TPropertychildsizing)
{**
@explan(说明) childsizing edit
**}
private
Fcpok ;
fszinfo;
public
function create(AOwner);override;
begin
inherited;
FRbuttonWidth := 20;
end
function ButtonClick(grid,e,d);override;
begin
Fcpok := true;
if not(fszinfo) then
begin
fszinfo := new tcszinfo(grid);//TColorChooseADlg(grid);
fszinfo.Parent := grid;
end
fszinfo.setinfo(d["value"]);
rec := GetPopRect(0);
fszinfo.top := rec[1];
fszinfo.left := rec[2]-400;
if fszinfo.showmodal() and Fcpok then
begin
grid.CellChanged(e.iitem,e.isubitem,"value",fszinfo.getinfo());
end
end
function CellDrawLabel(dc,rect,d);override;
begin
{**
@explan(说明) 绘制格子 %%
**}
//dc.brush.color := d["value"];
//dc.fillrect(rect);
dc.DrawText(EditType(),rect,DT_VCENTER);
end
function CellLeave();override;
begin
Fcpok := false;
inherited;
if fszinfo.visible then fszinfo.EndModal(0);
end
end
type TGridCellDirectoryEdit = class(TGridCellEditWithButton,TPropertyDirectory)
{**
@explan(说明) color edit
@@ -4547,7 +4595,121 @@ type TListStatusEdit2 = class(TListStatusEdit)
begin
return txt;
end
end
type tcszinfo = class(tcustomcontrol)
function create(aowner);
begin
inherited;
visible := false;
border := true;
color := clMenuBar;
wscaption := true;
WsPopUp := true;
onclose := thisfunction(cancelclk);
Caption := "子控件布局";
fctls := array();
idx := 0;
lbs := array("layout","controlsperline","horizontalspacing","verticalspacing","leftrightspacing","topbottomspacing","");
for i,v in lbs do
begin
lb := new TcustomLabel(self);
lb.Caption := v;
lb.TextAlign := AL9_TOPRIGHT;
if i = 6 then
begin
btn := new tancelok();
btn.fok.onclick := thisfunction(okclk);
btn.fcancel.onclick := thisfunction(cancelclk);
end else
if i = 0 then
begin
btn := new TcustomComboBox(self);
btn.Items := array("none","LeftToRightThenTopToBottom");
btn.ItemIndex := 0;
end else
begin
btn := new tedit(self);
btn.Width := 150;
end
fctls[idx++] := lb;
fctls[idx++] := btn;
end
for i,v in fctls do v.parent := self;
childsizing := array("layout":1,"controlsperline":2,"horizontalspacing":5,"verticalspacing":5,"leftrightspacing":5,"topbottomspacing":5);
autosize := true;
end
function cancelclk();
begin
EndModal(0);
end
function okclk();
begin
EndModal(1);
end
function getinfo();
begin
r := array();
for i,v in array("layout","controlsperline","horizontalspacing","verticalspacing","leftrightspacing","topbottomspacing") do
begin
if i=0 then
begin
r[v] := fctls[1].ItemIndex;
end else
begin
idx := i*2+1;
r[v] := strtointdef(fctls[idx].text,0);
end
end
return r;
end
function setinfo(r);
begin
if ifobj(r) then return setinfo(r.getsizerinfo());
for i,v in array("layout","controlsperline","horizontalspacing","verticalspacing","leftrightspacing","topbottomspacing") do
begin
vi := r[v];
if i=0 then
begin
if vi in array(0,1) then fctls[1].ItemIndex := vi;
end else
begin
if vi>=0 then
begin
idx := i*2+1;
fctls[idx].text := inttostr(vi);
end
end
end
end
fctls;
end
type tancelok = class(tcustomcontrol)
function create(aowner);
begin
inherited;
Parentcolor := true;
fok := new tbtn(self);
fcancel := new tbtn(self);
fok.caption := "确 定";
fcancel.caption := "取 消";
fok.Left := 0;
fok.border := true;
fcancel.border := true;
fok.top := 0;
fcancel.top := 0;
fok.autosize := true;
fcancel.autosize := true;
fok.parent := self;
fcancel.parent := self;
autosize := true;
end
function doControlALign();
begin
r := ClientRect;
fcancel.Left := r[2]-fcancel.Width;
end
fcancel;
fok;
end
type t_colorbox = class(tcustomcontrol)
function create(AOwner);
@@ -4754,6 +4916,7 @@ begin
class(TGridCellBoolEdit),
class(TGridCelllazyBoolEdit),
class(TGridCellColorEdit),
class(TGridCellchildsizingEdit),
class(TGridCellDirectoryEdit),
class(TGridCellFileNameEdit),
class(TGridCellNaturalEdit),