界面库

整理代码
This commit is contained in:
JianjunLiu
2022-10-11 17:03:09 +08:00
parent 3546020970
commit 444603eb38
7 changed files with 439 additions and 361 deletions
+56 -56
View File
@@ -4,7 +4,7 @@ uses utslvclauxiliary,UVCPropertyTypesPersistence,utslvclbase;
@explan(说明) 可视化组件基类 %%
@date(20220505) 分离tcomponent基类
**}
private
private //基础属性
{**
@param(FOwner)(tcomponent) 所有者 %%
@param(FComponents)( TFpList ) 子项 %%
@@ -12,14 +12,14 @@ uses utslvclauxiliary,UVCPropertyTypesPersistence,utslvclbase;
@param(FComponentStyle)( array of integer) 节点样式 %%
@param(FFreeNotifies)( TFpList) 销毁通知节点 %%
**}
fasdomain;
FOwner;
FName;
FComponents;
FFreeNotifies: TFpList;
FComponentState;
FComponentStyle;
FComponentCreated;
fasdomain; //名字域节点
FOwner; //所有者,在所有者销毁的时候其自动销毁
FName; //节点名,在域内不能重复
FComponents; //子节点
FFreeNotifies: TFpList; //销毁通知
FComponentState; //当前状态
FComponentStyle; //类型
FComponentCreated; //构造完成
FLoader;
function ComponentGetParent();virtual;
begin
@@ -30,14 +30,14 @@ uses utslvclauxiliary,UVCPropertyTypesPersistence,utslvclbase;
end
#!begin //private methods
function GetLoader();
function GetLoader(); //获得加载器
begin
m2 := class(tUIglobalData).uigetdata("G_T_TTFM2COMPONET_");
if not m2 then return 0;
if not FLoader then FLoader := createobject(m2);
return FLoader;
end
function GetPropInfo();
function GetPropInfo(); //获得有属性
begin
o := self(true);
r := getPropInfo2(o);
@@ -49,14 +49,14 @@ uses utslvclauxiliary,UVCPropertyTypesPersistence,utslvclbase;
end
return select * from ret order by["name"] end;
end
static FClassDigestB;
class function GetClassDigestB(idx,d);
static FClassDigestB; //类信息
class function GetClassDigestB(idx,d); //类信息获取
begin
if not ifarray(FClassDigestB)then FClassDigestB := array();
if ifnil(d)then return FClassDigestB[idx];
else FClassDigestB[idx]:= d;
end
function getPropInfo2(o);
function getPropInfo2(o); //获得类信息,带缓存
begin
if not(o is class(tcomponent))then return array();
t := o.classinfo;
@@ -97,7 +97,7 @@ uses utslvclauxiliary,UVCPropertyTypesPersistence,utslvclbase;
GetClassDigestB(idx,r);
return r;
end
function GetComponent(AIndex);
function GetComponent(AIndex);//获得子项
begin
{**
@explan(说明) 获取子节点 %%
@@ -105,11 +105,11 @@ uses utslvclauxiliary,UVCPropertyTypesPersistence,utslvclbase;
**}
return FComponents.geti(AIndex);
end
function SetComponentState(v);
function SetComponentState(v); //设置状态
begin
if ifarray(v)then FComponentState := v;
end
function GetComponentCount();
function GetComponentCount(); //子项数目
begin
{**
@explan(说明) 获取子节数量%%
@@ -117,7 +117,7 @@ uses utslvclauxiliary,UVCPropertyTypesPersistence,utslvclbase;
**}
return FComponents.count();
end
function GetComponentIndex();
function GetComponentIndex();//序号
begin
{**
@explan(说明) 获取子节序号%%
@@ -137,7 +137,7 @@ uses utslvclauxiliary,UVCPropertyTypesPersistence,utslvclbase;
FComponents.Add(AComponent);
AComponent.FOwner := Self(true);
end
procedure Remove(AComponent:TComponent);
procedure Remove(AComponent:TComponent); //移除
begin
{**
@explan(说明)移除子节点 %%
@@ -149,16 +149,16 @@ uses utslvclauxiliary,UVCPropertyTypesPersistence,utslvclbase;
end
return false;
end;
procedure RemoveNotification(AComponent:TComponent);
procedure RemoveNotification(AComponent:TComponent); //是否通知
begin
r := FFreeNotifies.Remove(AComponent);
if FFreeNotifies.count()<1 then includestate(FComponentState,csFreeNotification);
return r;
end
#!end
protected
protected //名字相关
#!begin //protected methods
function SetName(v);virtual;
function SetName(v);virtual; //设置名字
begin
if ifstring(v)and length(v)>1 and v <> FName then
begin
@@ -174,7 +174,7 @@ uses utslvclauxiliary,UVCPropertyTypesPersistence,utslvclbase;
end
end
end
Procedure SetAncestor(Value:Boolean);
Procedure SetAncestor(Value:Boolean); //设置祖先
begin
If Value then includestate(FComponentState,csAncestor)else excludestate(FCOmponentState,csAncestor);
For Runner := 0 To FComponents.Count-1 do
@@ -182,7 +182,7 @@ uses utslvclauxiliary,UVCPropertyTypesPersistence,utslvclbase;
FComponents.geti(Runner).SetAncestor(Value);
end
end;
function ValidateContainer(AComponent:TComponent);virtual;
function ValidateContainer(AComponent:TComponent);virtual; //刷新容器
begin
if AComponent is class(tcomponent)then return AComponent.ValidateInsert(Self);
end
@@ -190,8 +190,8 @@ uses utslvclauxiliary,UVCPropertyTypesPersistence,utslvclbase;
begin
return true;
end
public
function ExecuteCommand(cmd,p);virtual;
public //通知相关
function ExecuteCommand(cmd,p);virtual; //执行命令行
begin
end
@@ -211,7 +211,7 @@ public
if ow<>ac then
ow.Notification(ac,Operation);
end
function Notification(AComponent,Operation);virtual;
function Notification(AComponent,Operation);virtual; //通知
begin
{**
@explan(说明) 通知处理 %%
@@ -231,20 +231,20 @@ public
end;
end;
private
Procedure SetDesignInstance(Value);
Procedure SetDesignInstance(Value); //设置设计状态
begin
If Value then
includestate(FComponentState,csDesignInstance)
else
excludestate(FComponentState,csDesignInstance);
end;
public
procedure RemoveFreeNotification(AComponent:TComponent);
public //通知相关,设计器设置相关
procedure RemoveFreeNotification(AComponent:TComponent); //释放通知
begin
RemoveNotification(AComponent);
AComponent.RemoveNotification(self);
end;
Procedure SetDesigning(Value,SetChildren);virtual;
Procedure SetDesigning(Value,SetChildren);virtual; //设置设计状态
begin
{**
@explan(说明) 设计器使用方法,设置为设计状态,或者解除设置状态 %%
@@ -282,7 +282,7 @@ protected
end
#!end
public
public //构造析构相关
#!begin //public methods
function create(AOwner);virtual;
begin
@@ -302,13 +302,13 @@ public
AOwner.InsertComponent(Self);
end
end
function RootOwner();
function RootOwner(); //获得域根节点
begin
if fasdomain then return self(true);
if not(FOwner is class(TComponent))then return self(true);
return FOwner.RootOwner();
end
function FindComponentByName(n);
function FindComponentByName(n);//查找子节点中含名字的节点
begin
if n and n=FName then return self(true);
cps := Components;
@@ -319,7 +319,7 @@ public
end
return false;
end
function isDescendant(cd);
function isDescendant(cd);//是否为子节点
begin
{**
@explan(说明) 判断节点是否为其子节点 %%
@@ -346,7 +346,7 @@ public
AOwner.InsertComponent(self(true));
end
end
function Recycling();override;
function Recycling();override; //回收
begin
if not FComponentCreated then exit;
Destroying();
@@ -361,7 +361,7 @@ public
begin
inherited;
end;
function Destroying();
function Destroying();//销毁
begin
If csDestroying in FComponentstate Then Exit;
includestate(FComponentState,csDestroying);
@@ -369,7 +369,7 @@ public
data := FCOmponents.data();
for i,v in data do v.Destroying();
end;
function ExecuteAction(act:TBasicAction):Boolean;virtual;
function ExecuteAction(act:TBasicAction):Boolean;virtual;//执行action
begin
{**
@explan(说明)执行action %%
@@ -381,7 +381,7 @@ public
end else
return False;
end
function UpdateAction(act:TBasicAction):Boolean;virtual;
function UpdateAction(act:TBasicAction):Boolean;virtual;//更新action
begin
{**
@explan(说明) 更新action %%
@@ -393,7 +393,7 @@ public
end else
return False;
end
function DestroyComponents();
function DestroyComponents();//销毁子节点
begin
{**
@explan(说明)删除子项 %%
@@ -423,7 +423,7 @@ public
end;
//function GetParentComponent(); virtual;begin end
//function HasParent(); virtual;begin end
function InsertComponent(AComponent);virtual;
function InsertComponent(AComponent);virtual;//插入
begin
{**
@explan(说明)插入节点 %%
@@ -448,11 +448,11 @@ public
return ifobj(o);
end
#!end
private
private //设计器中属性事件相关
FEventsProperties;
FChangedProperties;
FVariableProperties;
function GetPublishInfo();
function GetPublishInfo();//属性获取
begin
r := publishs();
rr := array();
@@ -476,12 +476,12 @@ public
r := r1;
end
end
public
function publishs();virtual;
public //设计器属性设置相关
function publishs();virtual;//释放属性
begin
//return array("currentcolor","lazyitems","range","firstdayofweek","align","mbbtnstyle","textalign","text","imagelist","canvs","images","items","bkbitmap","icon","popupmenu","mainmenu","cursor","height","width","left","top","enabled","visible","caption","color","font","onclick","rootfolder","initialdir");
end
function GetPublishproperties();virtual;
function GetPublishproperties();virtual; //获得属性信息
begin
{**
@explan(说明) 获得properties,设计器使用%%
@@ -511,7 +511,7 @@ public
////////////////////
return r;
end
function GetPublishEvents();virtual;
function GetPublishEvents();virtual; //获得事件信息
begin
{**
@explan(说明) 获得event值,设计器使用 %%
@@ -536,11 +536,11 @@ public
OrderPublish(r,pps);
return r;
end
function GetChangedPropertiesn(n);virtual;
function GetChangedPropertiesn(n);virtual;//获得改变的属性
begin
return FChangedProperties[n];
end
function GetChangedPublish(f);virtual;
function GetChangedPublish(f);virtual; //获得改变的属性
begin
{**
@explan(说明)获取修改过的publish,设计器使用 %%
@@ -568,7 +568,7 @@ public
end
return r;
end
function SetChangedPublish(n,v);virtual;
function SetChangedPublish(n,v);virtual;//设置属性
begin
{**
@explan(说明) 设计器相关函数 %%
@@ -577,7 +577,7 @@ public
//reindex(FChangedProperties,array(n:nil));
FChangedProperties[n]:= v;
end
function DeleteChangedPublish(n);virtual;
function DeleteChangedPublish(n);virtual;//删除属性
begin
if n and ifstring(n)then
begin
@@ -585,7 +585,7 @@ public
reindex(FChangedProperties,array(n:nil));
end
end
function SetPublish(n,v);virtual;
function SetPublish(n,v);virtual;//设置属性
begin
{**
@explan(说明) 修改单个值,设计器使用 %%
@@ -636,7 +636,7 @@ public
end
end
end
property Owner:tcomponent read FOwner;
property Owner:tcomponent read FOwner; //所有者
{**
@param(Owner)(tcomponent) 所有者 %%
@param(ComponentState)() 状态集合 %%
@@ -648,8 +648,8 @@ public
property Components read FComponents;
property ComponentState read FComponentState write SetComponentState;
property ComponentStyle read FComponentStyle;
property Name:string read FName write SetName;
property Name:string read FName write SetName; //名字
property Parent read ComponentGetParent write ComponentSetParent;
property asdomain read fasdomain write fasdomain;
property Loader read GetLoader;
property asdomain read fasdomain write fasdomain; //域节点
property Loader read GetLoader; //加载器
end