界面库

加入onnotify消息
This commit is contained in:
JianjunLiu
2022-10-28 15:38:51 +08:00
parent e9d9e0d2e9
commit 0262217ded
11 changed files with 325 additions and 49 deletions
+12
View File
@@ -218,6 +218,7 @@ public //֪ͨ
@param(AComponent)(tcomponent) 改变的对象 %%
@param(Operation)(member of TOperation) 通知码 %%
**}
if dosendrenote(AComponent,Operation) then return ;
If(Operation=opRemove)then
begin
RemoveFreeNotification(AComponent);
@@ -231,6 +232,17 @@ public //֪ͨ
end;
end;
private
function dosendrenote(a,op);
begin
if op=opRemove or op=opInsert then return 0;
if fonnotification then
begin
e := new tuieventbase(op,0,0,0);
e.sender := a;
CallMessgeFunction(fonnotification,self(true),e);
return e.skip;
end
end
Procedure SetDesignInstance(Value); //设置设计状态
begin
If Value then
+1 -2
View File
@@ -1355,12 +1355,11 @@ type tcontrol = class(tcomponent)
end
if rchange then
begin
//mtic;
//relnotification(self(true),array("type":"possize","flag":rchange,"data":array(fleft,ftop,FWidth,FHeight)));
obj := class(tUIglobalData).uigetdata("tuiapplication");
if obj then
begin
obj.Notification(self(true),array("type":"possize","flag":rchange,"data":array(fleft,ftop,FWidth,FHeight)));
//obj.Notification(self(true),new tpossizenote(rchange,fleft,ftop,FWidth,FHeight));
end
//echo "\r\n note change mtoc:",caption,"===",mtoc;
end
+4 -4
View File
@@ -516,8 +516,7 @@ type tapplication=class(tcomponent)
FApplicationWindow.bindmessage(WM_ACTIVATEAPP,thisfunction(WMACTIVATEAPP));
end
function Notification(a,op);override;
begin
inherited;
begin
if op=opRecycling then
begin
if a=Fmainform then
@@ -529,6 +528,7 @@ type tapplication=class(tcomponent)
FApplicationWindow := nil;
end
end
inherited;
end
function createform(classname,varable);
begin
@@ -3278,12 +3278,12 @@ type TPairSplitter=class(tcustomcontrol) //
end
end
function Notification(AComponent,Operation);override;
begin
inherited;
begin
if Operation=opRemove then
begin
RemoveSide(AComponent);
end
inherited;
end
function DoControlAlign();override;
begin
+4 -4
View File
@@ -104,8 +104,7 @@ type TBasicAction=class(TComponent)
end
end
function Notification(AComponent,Operation);override;
begin
inherited;
begin
if Operation=opRecycling and AComponent=FActionComponent then //opRemove
begin
FActionComponent := nil;
@@ -114,6 +113,7 @@ type TBasicAction=class(TComponent)
FParent.DeleteAction(self);
end
end
inherited;
end
function SetActionComponent(Value);
begin
@@ -330,12 +330,12 @@ type TCustomactionlist=class(TComponent)
end
end
function Notification(AComponent,Operation);override;
begin
inherited;
begin
if Operation=opRecycling and AComponent=FActionComponent then //opRemove
begin
DeleteAllActions();
end
inherited;
end
function Recycling();override;
begin
+17 -3
View File
@@ -40,8 +40,22 @@ function DeleteAllFiles(path);
function CreateDirWithFileName(fname);
function TS_GetUserProfileHome();
function gettslexefullpath();
type tuiglobaldata=class
type tpossizenote = class()
function create(c,l,t,w,h);
begin
ch := c;
left := l;
top := t;
width := w;
height := h;
end
ch;
left;
top;
width;
height;
end
type tuiglobaldata=class()
static UIData;
class Function uisetdata(n,d);
begin
@@ -60,7 +74,7 @@ type tuiglobaldata=class
if not ifarray(UIData)then UIData := array();
end
end
type TCharDiscrimi=class
type TCharDiscrimi=class()
static CD_SMA;
static CD_BGA;
static CD_SMZ;
+5 -1
View File
@@ -486,10 +486,13 @@ end
type tmacroconst=class(_commctrldef_,_tvclmsageid_,_shellapi_)
class function sinit();virtual;
begin
if tmacroconstinit then return ;
class(_commctrldef_).sinit();
class(_tvclmsageid_).sinit();
class(_shellapi_).sinit();
tmacroconstinit := true;
end
static tmacroconstinit;
end
type tconstant = class(talign,TAnchorKind,TFormStyle,TComponentState,
TComponentStyle,TOperation,TWinControlFlag,
@@ -511,6 +514,7 @@ type TSLUICONST=class(tmacroconst,tconstant)
static WM_TRAY;
class function sinit();override;
begin
if WM_TRAY>0 then return ;
class(tmacroconst).sinit();
opRemove := "opRemove-";//ÒÆ³ý²Ù×÷
opInsert := "opInsert+";//²åÈë
@@ -5946,6 +5950,6 @@ end
}
initialization
class(TSLUICONST).sinit();
class(tenumeration).initenumeration(new tconstant());
class(TSLUICONST).sinit();
end.
+4 -5
View File
@@ -35,9 +35,8 @@ type tcustomcoolbar=class(tcustomcontrol)
end
function Notification(o,op);override;
begin
r := inherited;
if class(tcoolbarlocker).haslocker then return r;
if (o is class(TWinControl)) and o.WsPopUp then return r;
if class(tcoolbarlocker).haslocker then return ;
if (o is class(TWinControl)) and o.WsPopUp then return ;
if HandleAllocated() and ifarray(op) and (op["type"]="possize") then //位置大小发送变化
begin
ctls := controls;
@@ -45,10 +44,10 @@ type tcustomcoolbar=class(tcustomcontrol)
begin
doControlALign();
InvalidateRect(nil,false);
return r;
return ;
end
end
return r;
inherited;
end
function WMLBUTTONUP(o,e);override;//拖拽实现
begin
+2 -2
View File
@@ -470,12 +470,12 @@ private
end
end
function Notification(AComponent:TComponent;Operation:TOperation);override;
begin
inherited;
begin
if Operation=opRecycling then //opRemove
begin
if AComponent=Action then Action := nil;
end
inherited;
end
class function sinit();override;
begin
+28 -18
View File
@@ -3842,8 +3842,7 @@ type TCustomComboBoxbase=class(TCustomControl)
**}
function Create(AOwner);override;
begin
inherited;
inherited;
end
function AfterConstruction();override;
begin
@@ -3903,7 +3902,7 @@ type TCustomComboBoxbase=class(TCustomControl)
FListBox.show(5);
CallMessgeFunction(ondropdown,self(true),e);
end else
if not(flg)and FListBox.Visible then
if not(flg) and FListBox.Visible then
begin
FListBox.Visible := false;
CallMessgeFunction(oncloseup,self(true),e);
@@ -3918,7 +3917,7 @@ type TCustomComboBoxbase=class(TCustomControl)
inherited;
end
published
property ItemIndex:lazyinteger read GetItemIndex write SetItemIndex;
property ItemIndex:lazytsl read GetItemIndex write SetItemIndex;
property OnSelchanged:eventhandler read FOnSelchanged write FOnSelchanged;
property ondropdown:eventhandler read Fondropdown write Fondropdown;
property oncloseup:eventhandler read Foncloseup write Foncloseup;
@@ -3947,7 +3946,7 @@ type TCustomComboBoxbase=class(TCustomControl)
**}
if not(FListBox is class(TWinControl))then return;
rc := ClientRect;
FListbox.height := FListBox.ItemHeight * (min(max(0,FListBox.ItemCount),FmaxListItemShow))+10;
FListbox.height := getlistitemheight()* (min(max(0,getlistitemcount()),FmaxListItemShow))+10;
nrc := ClientToScreen(rc[0],rc[3]);
if FScreenRect[3]-nrc[1]<250 then
begin
@@ -3970,7 +3969,7 @@ type TCustomComboBoxbase=class(TCustomControl)
Fondropdown; //下拉
Foncloseup; //收起
FBtnWidth;
function SetmaxListItemShow(v);
function SetmaxListItemShow(v);//显示项目数量
begin
if v>0 then
begin
@@ -3981,7 +3980,7 @@ type TCustomComboBoxbase=class(TCustomControl)
end
end
end
function SetBtnWidth(n);
function SetBtnWidth(n);//按钮宽度
begin
if not(n>10 and n<100)then return;
nn := int(n);
@@ -3992,10 +3991,18 @@ type TCustomComboBoxbase=class(TCustomControl)
DoControlAlign();
end
end
function GetItemIndex();virtual;
function getlistitemcount();virtual; //获得项目
begin
return FListBox.ItemCount;
end
function getlistitemheight();virtual; //获得项目高
begin
return FListBox.ItemHeight;
end
function GetItemIndex();virtual;//获得选中的序号
begin
end
function SetItemIndex();virtual;
function SetItemIndex();virtual;//设置选中的序号
begin
end
end
@@ -4240,12 +4247,12 @@ type TcustomComboBox=class(TCustomComboBoxbase)
end
function GetItemIndex();override;
begin
if FMultisel and (csDesigning in ComponentState) then return -1;
//if FMultisel and (csDesigning in ComponentState) then return -1;
return FListBox.GetCurrentSelection();
end
function SetItemIndex(idx);override;
begin
if FMultisel and (csDesigning in ComponentState) then return -1;
//if FMultisel and (csDesigning in ComponentState) then return -1;
return FListBox.SetCurrentSelection(idx);
end
feditischanging;//改变正在回调
@@ -5467,7 +5474,6 @@ type TCustomSpinEdit = class(TCustomControl)
begin
FValue := r;
end
return FValue;
end
procedure SetValue(const AValue:Double);virtual;
@@ -5590,7 +5596,6 @@ type TCustomSpinEdit = class(TCustomControl)
fedit := nil;
inherited;
end
function DoControlAlign(rect);override;
begin
rect := ClientRect;
@@ -5812,7 +5817,8 @@ type tcustomprogressbar=class(TCustomControl)
dc.brush.color := FbarColor;
dc.FillRect(br);
end
function increaseByStep();begin
function increaseByStep();
begin
{**
@explan(说明)按照步增量移动进度条当前的位置,当其超过限度则设置位置至下限以便于从头重新开始%%
@return(integer)先前的位置,出错返回-1%%
@@ -5826,7 +5832,8 @@ type tcustomprogressbar=class(TCustomControl)
InvalidateRect(nil,false);
return r;
end
function increaseBySpecifiedIncrement(n);begin
function increaseBySpecifiedIncrement(n);
begin
{**
@explan(说明)进度条移动指定长度,当其超过限度则设置位置至该限度%%
@param(n)(integer)增长的数量%%
@@ -5887,7 +5894,8 @@ type tcustomprogressbar=class(TCustomControl)
return not (n.&0xFFFFFFFFFF000000);
else return 0;
end
function setRange(l,h);begin
function setRange(l,h);
begin
{**
@explan(说明)设置进度栏的上下限,要求上限高于下限且皆非负%%
@param(l)(integer)下限%%
@@ -5905,7 +5913,8 @@ type tcustomprogressbar=class(TCustomControl)
end
end
function setRangeA(arr);begin
function setRangeA(arr);
begin
return setRange(arr[0],arr[1]);
end
function setPosition(n);
@@ -5923,7 +5932,8 @@ type tcustomprogressbar=class(TCustomControl)
end
return r;
end
function setStep(n);begin
function setStep(n);
begin
{**
@explan(说明)设置进度栏步增量%%
@param(n)(integer)要设置的值%%
+59 -1
View File
@@ -1035,7 +1035,7 @@ type TPropertyType=class
@explan(说明) 是否为延迟设置属性%%
@return(bool)
**}
return false;
return Fislazy;
end
function IfComponent();virtual;
begin
@@ -1045,6 +1045,9 @@ type TPropertyType=class
return false;
end
property TmfParser:TTmfParser read Gettfmparser;
property islazy read Fislazy write Fislazy; //是否后天就数据
private
Fislazy;
end
type TPropertyNatural=class(TPropertyType) //自然数
function EditType();override;
@@ -1907,6 +1910,59 @@ type TPropertyText=class(TPropertyString)
return tostn(d);
end
end
type tpropertytsl=class(TPropertyType)
Function EditType();override;
begin
return "tsl";
end
function TmfToNode(d);override;
begin
if ifstring(d)then
begin
r := HexFormatStrToTsl(d);
return r;
end
end
function FormatTMF(d);override;
begin
if datanotok(d) then return "";
reti := TSlToHexFormatStr(d);
ret := "{ ";
ret += reti;
ret += " }";
return ret;
end
function ReadTMF(d,o);override;
begin
if d and ifstring(d) then
begin
return HexFormatStrToTsl(d);
end
end
private
function datanotok(d);//
begin
if ifobj(d) then return true;
if ifarray(d) then
begin
for i ,v in d do
begin
if (datanotok(v)) then return true;
end
end
return false;
end
end
type tpropertylazytsl = class(tpropertytsl)
Function EditType();override;
begin
return "lazytsl";
end
function LazyProperty();override;
begin
return true;
end
end
type TPropertyStrings=class(TPropertyType)
function EditType();override;
begin
@@ -2345,6 +2401,8 @@ begin
"tpropertytabalign",
"tpropertytext",
"tpropertystrings",
"tpropertytsl",
"tpropertylazytsl",
"tpropertyesalign",
"tpropertymbbtnstyle",
"tpropertymbicostyle",