parent
f266623015
commit
af29344e72
|
|
@ -62,8 +62,6 @@ function TslToHexFormatStr(tsl);
|
||||||
function HexFormatStrToTsl(D);
|
function HexFormatStrToTsl(D);
|
||||||
function GetTextWidthAndHeightWidthFont(s,f,mul);
|
function GetTextWidthAndHeightWidthFont(s,f,mul);
|
||||||
////////////////////////////////////
|
////////////////////////////////////
|
||||||
{type TByteData = class(TByteDataOP)
|
|
||||||
end }
|
|
||||||
//应用
|
//应用
|
||||||
type tapplication=class(tcomponent)
|
type tapplication=class(tcomponent)
|
||||||
{**
|
{**
|
||||||
|
|
@ -71,14 +69,11 @@ type tapplication=class(tcomponent)
|
||||||
**}
|
**}
|
||||||
private
|
private
|
||||||
static FApplicationWindow;
|
static FApplicationWindow;
|
||||||
static FMessageObj;
|
FMessageObj;
|
||||||
//static Ftooltips;
|
|
||||||
FVisible;
|
FVisible;
|
||||||
FHandle; //句柄
|
FHandle; //句柄
|
||||||
Fmainform; //主窗口
|
Fmainform; //主窗口
|
||||||
FDebug;
|
FDebug;
|
||||||
//FTiptimer;
|
|
||||||
//FTiptimertag1;
|
|
||||||
Foldforminfo;
|
Foldforminfo;
|
||||||
function SetVisible(v);
|
function SetVisible(v);
|
||||||
begin
|
begin
|
||||||
|
|
@ -124,7 +119,6 @@ type tapplication=class(tcomponent)
|
||||||
FApplicationWindow := new tapplicationwindow(self);
|
FApplicationWindow := new tapplicationwindow(self);
|
||||||
FApplicationWindow.Visible := FVisible;
|
FApplicationWindow.Visible := FVisible;
|
||||||
end
|
end
|
||||||
//echo "???",tostn(FApplicationWindow.classinfo());
|
|
||||||
FHandle := FApplicationWindow.Handle;
|
FHandle := FApplicationWindow.Handle;
|
||||||
end
|
end
|
||||||
public
|
public
|
||||||
|
|
@ -132,9 +126,6 @@ type tapplication=class(tcomponent)
|
||||||
begin
|
begin
|
||||||
inherited;
|
inherited;
|
||||||
FVisible := false;
|
FVisible := false;
|
||||||
//FTiptimer := new ttimer();
|
|
||||||
//FTiptimer.Interval := 2000;
|
|
||||||
//FTiptimer.Ontimer := thisfunction(ontiptimer);
|
|
||||||
end
|
end
|
||||||
function WMACTIVATEAPP(o,e);virtual;
|
function WMACTIVATEAPP(o,e);virtual;
|
||||||
begin
|
begin
|
||||||
|
|
@ -146,7 +137,6 @@ type tapplication=class(tcomponent)
|
||||||
if e.wparam then
|
if e.wparam then
|
||||||
begin
|
begin
|
||||||
//_wapi.SetWindowPos(Fmainform.Handle, HWND_TOPMOST, 0, 0, 0, 0, SWP_NOMOVE .|SWP_NOSIZE);
|
//_wapi.SetWindowPos(Fmainform.Handle, HWND_TOPMOST, 0, 0, 0, 0, SWP_NOMOVE .|SWP_NOSIZE);
|
||||||
//Fmainform.Visible := true;//
|
|
||||||
Fmainform.show();
|
Fmainform.show();
|
||||||
if Fmainform.HandleAllocated() then
|
if Fmainform.HandleAllocated() then
|
||||||
begin
|
begin
|
||||||
|
|
@ -217,9 +207,6 @@ type tapplication=class(tcomponent)
|
||||||
@ignore(忽略) %%
|
@ignore(忽略) %%
|
||||||
**}
|
**}
|
||||||
CallMessgeFunction(Foldforminfo["minimize"],o,e);
|
CallMessgeFunction(Foldforminfo["minimize"],o,e);
|
||||||
//e.skip := true;
|
|
||||||
//if Fmainform then Fmainform.Visible := false;
|
|
||||||
//FApplicationWindow._send_(,0,0);
|
|
||||||
end
|
end
|
||||||
function run();
|
function run();
|
||||||
begin
|
begin
|
||||||
|
|
@ -311,27 +298,7 @@ type TLabel = class(TcustomLabel)
|
||||||
@param(TextAlign)(member of TAlignStyle9) 文字对齐 %%
|
@param(TextAlign)(member of TAlignStyle9) 文字对齐 %%
|
||||||
**}
|
**}
|
||||||
end
|
end
|
||||||
//窗口
|
|
||||||
|
|
||||||
type TSysControl=class(TWincontrol)
|
|
||||||
{**
|
|
||||||
@explan(说明) 系统绘制窗口,屏蔽绘制和背景处理,加快速度 %%
|
|
||||||
**}
|
|
||||||
function Create(AOwner);override;
|
|
||||||
begin
|
|
||||||
inherited;
|
|
||||||
end
|
|
||||||
function WMPAINT(o,e):WM_PAINT;override;
|
|
||||||
begin
|
|
||||||
if not Font.HandleAllocated()then
|
|
||||||
begin
|
|
||||||
FontChanged();
|
|
||||||
end
|
|
||||||
end
|
|
||||||
function WMERASEBKGND(o,e):WM_ERASEBKGND;override;
|
|
||||||
begin
|
|
||||||
end
|
|
||||||
end
|
|
||||||
type TWinControlWraper=class(TWinControl)
|
type TWinControlWraper=class(TWinControl)
|
||||||
{**
|
{**
|
||||||
@explan(说明) 包裹window句柄类,继承该类,根据CreateWnd 注释的提示重写该函数
|
@explan(说明) 包裹window句柄类,继承该类,根据CreateWnd 注释的提示重写该函数
|
||||||
|
|
@ -1415,7 +1382,7 @@ type tmemo = class(TSynMemoNorm) //
|
||||||
FonSetFocus;
|
FonSetFocus;
|
||||||
fonKillFocus;
|
fonKillFocus;
|
||||||
end
|
end
|
||||||
type thighlighter= class(tcustomsynhighlighter)
|
type thighlighter= class(tcustomsynhighlighter) //语法高亮
|
||||||
uses UTslMemo;
|
uses UTslMemo;
|
||||||
function create(AOwner);
|
function create(AOwner);
|
||||||
begin
|
begin
|
||||||
|
|
@ -2123,7 +2090,7 @@ type TStatusBar = class(TcustomStatusBar)
|
||||||
function publishs();override;
|
function publishs();override;
|
||||||
begin
|
begin
|
||||||
return array("name","caption","enabled","border",
|
return array("name","caption","enabled","border",
|
||||||
"font","visible","items","ondblclick","onmousedown","onmouseup","onnotification");
|
"font","visible","items","itemorder","onmousemove","onmousedown","onmouseup","onnotification");
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
type tcoolbar = class(tcustomcoolbar)
|
type tcoolbar = class(tcustomcoolbar)
|
||||||
|
|
@ -7092,22 +7059,41 @@ Initialization
|
||||||
initlib();
|
initlib();
|
||||||
Finalization
|
Finalization
|
||||||
end.
|
end.
|
||||||
{
|
|
||||||
if message in array(1,0x81)then
|
//if message in array(1,0x81)then
|
||||||
begin
|
//begin
|
||||||
obj := new tslcstructureobj(MemoryAlignmentCalculate(array(
|
// obj := new tslcstructureobj(MemoryAlignmentCalculate(array(
|
||||||
("lpcreateparams","intptr",0),
|
// ("lpcreateparams","intptr",0),
|
||||||
("hinstance","intptr",0),
|
// ("hinstance","intptr",0),
|
||||||
("hmenu","intptr",0),
|
// ("hmenu","intptr",0),
|
||||||
("hwndparent","intptr",0),
|
// ("hwndparent","intptr",0),
|
||||||
("cy","int",0),
|
// ("cy","int",0),
|
||||||
("cx","int",0),
|
// ("cx","int",0),
|
||||||
("y","int",0),
|
// ("y","int",0),
|
||||||
("x","int",0),
|
// ("x","int",0),
|
||||||
("style","int",0),
|
// ("style","int",0),
|
||||||
("lpszname","intptr",0),
|
// ("lpszname","intptr",0),
|
||||||
("lpszclass","intptr",0),
|
// ("lpszclass","intptr",0),
|
||||||
("dwexstyle","int",0))),lparam);
|
// ("dwexstyle","int",0))),lparam);
|
||||||
echo tostn(obj._getdata_);
|
// echo tostn(obj._getdata_);
|
||||||
end
|
//end
|
||||||
}
|
//窗口
|
||||||
|
//type TSysControl=class(TWincontrol)
|
||||||
|
// {**
|
||||||
|
// @explan(说明) 系统绘制窗口,屏蔽绘制和背景处理,加快速度 %%
|
||||||
|
// **}
|
||||||
|
// function Create(AOwner);override;
|
||||||
|
// begin
|
||||||
|
// inherited;
|
||||||
|
// end
|
||||||
|
// function WMPAINT(o,e):WM_PAINT;override;
|
||||||
|
// begin
|
||||||
|
// if not Font.HandleAllocated()then
|
||||||
|
// begin
|
||||||
|
// FontChanged();
|
||||||
|
// end
|
||||||
|
// end
|
||||||
|
// function WMERASEBKGND(o,e):WM_ERASEBKGND;override;
|
||||||
|
// begin
|
||||||
|
// end
|
||||||
|
//end
|
||||||
|
|
@ -13,9 +13,9 @@ type TWinControl = class(tcontrol)
|
||||||
private //成员变量
|
private //成员变量
|
||||||
__wstyle; //窗口样式
|
__wstyle; //窗口样式
|
||||||
__wexstyle; //窗口扩展样式
|
__wexstyle; //窗口扩展样式
|
||||||
__wstylestruct; //样式消息结构体
|
//__wstylestruct; //样式消息结构体
|
||||||
__clientsize; //客户区大小
|
__clientsize; //客户区大小
|
||||||
__oldclientsize; //旧客户区大小
|
//__oldclientsize; //旧客户区大小
|
||||||
FClientleft;
|
FClientleft;
|
||||||
FClientTop;
|
FClientTop;
|
||||||
FClientWdith;
|
FClientWdith;
|
||||||
|
|
|
||||||
|
|
@ -5414,10 +5414,93 @@ type TcustomStatusBar=class(TCustomControl)
|
||||||
{**
|
{**
|
||||||
@explan(˵Ã÷) ״̬À¸ %%
|
@explan(˵Ã÷) ״̬À¸ %%
|
||||||
**}
|
**}
|
||||||
|
protected
|
||||||
|
procedure SetAlign(Value:TAlign);override;
|
||||||
|
begin
|
||||||
|
if Align=Value then exit;
|
||||||
|
if Value in array(alBottom,alNone,alTop)then
|
||||||
|
begin
|
||||||
|
inherited;
|
||||||
|
end
|
||||||
|
end
|
||||||
|
public
|
||||||
|
function create(AOwner);override;
|
||||||
|
begin
|
||||||
|
FItemOder := 0;
|
||||||
|
inherited;
|
||||||
|
height := 25;
|
||||||
|
Align := alBottom;
|
||||||
|
Fitems := array();
|
||||||
|
end
|
||||||
|
function Paint();override;
|
||||||
|
begin
|
||||||
|
c := clientRect;
|
||||||
|
FCwid := c[2];
|
||||||
|
FCHei := c[3];
|
||||||
|
if FItemOder then return paintb();
|
||||||
|
painta();
|
||||||
|
end
|
||||||
|
function additem(str,wd);
|
||||||
|
begin
|
||||||
|
{**
|
||||||
|
@explan(说明)添加项目 %%
|
||||||
|
@param(str)(string) 文本 %%
|
||||||
|
@param(wd)(number) 宽度 ,大于1 表示绝对宽阔 ,小于1 表示相对宽度 %%
|
||||||
|
**}
|
||||||
|
if not ifstring(str)then return -1;
|
||||||
|
if not(wd>0)then wd := 100;
|
||||||
|
Fitems[Length(Fitems)]:= array("text":str,"width":wd);
|
||||||
|
if faddlock then return 0;
|
||||||
|
if HandleAllocated()then
|
||||||
|
begin
|
||||||
|
InvalidateRect(nil,false);
|
||||||
|
end
|
||||||
|
end
|
||||||
|
function deleteitem(idx);
|
||||||
|
begin
|
||||||
|
{**
|
||||||
|
@explan(说明) 删除项目 %%
|
||||||
|
@param(idx)(integer) 序号 %%
|
||||||
|
**}
|
||||||
|
if not(itemidok(idx))then return -1;
|
||||||
|
deleteindex(Fitems,idx,true);
|
||||||
|
if HandleAllocated()then
|
||||||
|
begin
|
||||||
|
InValidateRect(nil,false);
|
||||||
|
end
|
||||||
|
end
|
||||||
|
function setitemtext(str,idx);
|
||||||
|
begin
|
||||||
|
{**
|
||||||
|
@explan(说明) 修改字段 %%
|
||||||
|
@param(str)(string) 文本%%
|
||||||
|
@param(id)(integer) 序号 %%
|
||||||
|
**}
|
||||||
|
if not ifstring(str)then return -1;
|
||||||
|
if not(itemidok(idx))then return -1;
|
||||||
|
Fitems[idx,"text"]:= str;
|
||||||
|
if HandleAllocated()then
|
||||||
|
begin
|
||||||
|
InvalidateRect(nil,false);
|
||||||
|
end
|
||||||
|
end
|
||||||
|
property Items:statusitems read Fitems Write SetItems;
|
||||||
|
property itemtext:string read gettexti write settexti;
|
||||||
|
property itemwidth:integer read getwidthi write setwidthi;
|
||||||
|
property itemorder:bool read FItemOder write setitemorder;
|
||||||
|
{**
|
||||||
|
@param(Items)(array)设置项 ,二维数组包括 text ,width 两个字段 array(("text":"abc","width":200),("text":"part2","width":0.4))%%
|
||||||
|
@param(itemtext)(string) 通过索引获取设置文本%%
|
||||||
|
@param(itemwidth)(integer) 通过索引设置获取宽度%%
|
||||||
|
@param(itemorder)(bool) item展示排序,默认false从左到右,true为从右到左%%
|
||||||
|
**}
|
||||||
|
private
|
||||||
|
faddlock;//添加锁定刷新
|
||||||
|
Fitems;//项目
|
||||||
|
FCwid;//宽度
|
||||||
|
FCHei;//高度
|
||||||
|
FItemOder;//排序
|
||||||
private
|
private
|
||||||
Fitems;
|
|
||||||
FCwid;
|
|
||||||
FCHei;
|
|
||||||
function itemidok(id);
|
function itemidok(id);
|
||||||
begin
|
begin
|
||||||
ct := length(Fitems);
|
ct := length(Fitems);
|
||||||
|
|
@ -5431,7 +5514,9 @@ type TcustomStatusBar=class(TCustomControl)
|
||||||
Fitems := array();
|
Fitems := array();
|
||||||
for i,v in its do
|
for i,v in its do
|
||||||
begin
|
begin
|
||||||
|
faddlock := true;
|
||||||
if ifarray(v)then additem(v["text"],v["width"]);
|
if ifarray(v)then additem(v["text"],v["width"]);
|
||||||
|
faddlock := false;
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
function DrawStatItem(cvs,v,rec);
|
function DrawStatItem(cvs,v,rec);
|
||||||
|
|
@ -5444,99 +5529,86 @@ type TcustomStatusBar=class(TCustomControl)
|
||||||
cvs.drawtext(hstr,rec,DT_VCENTER .| DT_SINGLELINE .| DT_NOPREFIX);
|
cvs.drawtext(hstr,rec,DT_VCENTER .| DT_SINGLELINE .| DT_NOPREFIX);
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
protected
|
function getwidthi(idx); //获得宽度
|
||||||
procedure SetAlign(Value:TAlign);override;
|
|
||||||
begin
|
begin
|
||||||
if Align=Value then exit;
|
if itemidok(idx) then
|
||||||
if Value in array(alBottom)then
|
|
||||||
begin
|
begin
|
||||||
inherited;
|
return Fitems[idx,"width"];
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
public
|
function setwidthi(idx,w); //设置宽度
|
||||||
function create(AOwner);override;
|
|
||||||
begin
|
begin
|
||||||
inherited;
|
if not(w>=0) then return ;
|
||||||
height := 25;
|
if itemidok(idx) then
|
||||||
Align := alBottom;
|
begin
|
||||||
Fitems := array();
|
w1 := Fitems[idx,"width"];
|
||||||
|
if w<>w1 then
|
||||||
|
begin
|
||||||
|
Fitems[idx,"width"] := integer(w);
|
||||||
|
InvalidateRect(nil,false);
|
||||||
|
end
|
||||||
|
end
|
||||||
end
|
end
|
||||||
function DoWMsIZE();override;
|
function gettexti(idx); //获得文本
|
||||||
begin
|
begin
|
||||||
c := clientRect;
|
if itemidok(idx) then
|
||||||
FCwid := c[2];
|
begin
|
||||||
FCHei := c[3];
|
return Fitems[id,"text"];
|
||||||
|
end
|
||||||
end
|
end
|
||||||
function Paint();override;
|
function settexti(idx,s);//设置文本
|
||||||
|
begin
|
||||||
|
setitemtext(s,idx);
|
||||||
|
end
|
||||||
|
function setitemorder(v);
|
||||||
|
begin
|
||||||
|
nv := v?true:false;
|
||||||
|
if nv<>FItemOder then
|
||||||
|
begin
|
||||||
|
FItemOder := nv;
|
||||||
|
InvalidateRect(nil,false);
|
||||||
|
end
|
||||||
|
end
|
||||||
|
function paintb();//从左到右
|
||||||
|
begin
|
||||||
|
p := FCwid;
|
||||||
|
cvs := canvas;
|
||||||
|
for i,v in FItems do
|
||||||
|
begin
|
||||||
|
wd := v["width"];
|
||||||
|
if wd>0 and wd<1.0001 then
|
||||||
|
begin
|
||||||
|
wd *= FCwid;
|
||||||
|
end
|
||||||
|
DrawStatItem(cvs,v,array(max(0,p-wd),0,p,FCHei));
|
||||||
|
p -= wd;
|
||||||
|
if p<=0 then return;
|
||||||
|
end
|
||||||
|
if p>0 then
|
||||||
|
begin
|
||||||
|
DrawStatItem(cvs,array(),array(0,0,p,FCHei));
|
||||||
|
end
|
||||||
|
end
|
||||||
|
function painta();//从又到左
|
||||||
begin
|
begin
|
||||||
p := 0;
|
p := 0;
|
||||||
cvs := canvas;
|
cvs := canvas;
|
||||||
if FItems then
|
for i,v in FItems do
|
||||||
begin
|
begin
|
||||||
for i,v in FItems do
|
wd := v["width"];
|
||||||
|
if wd>0 and wd<1.0001 then
|
||||||
begin
|
begin
|
||||||
wd := v["width"];
|
wd *= FCwid;
|
||||||
if wd>0 and wd<1.0001 then
|
|
||||||
begin
|
|
||||||
wd *= FCwid;
|
|
||||||
end
|
|
||||||
DrawStatItem(cvs,v,array(p,0,p+wd,FCHei));
|
|
||||||
p += wd;
|
|
||||||
if p>FCwid then return;
|
|
||||||
end
|
end
|
||||||
|
DrawStatItem(cvs,v,array(p,0,p+wd,FCHei));
|
||||||
|
p += wd;
|
||||||
|
if p>FCwid then return;
|
||||||
end
|
end
|
||||||
if p<FCwid then
|
if p<FCwid then
|
||||||
begin
|
begin
|
||||||
DrawStatItem(cvs,array(),array(p,0,FCwid,FCHei));
|
DrawStatItem(cvs,array(),array(p,0,FCwid,FCHei));
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
function additem(str,wd);
|
|
||||||
begin
|
|
||||||
{**
|
|
||||||
@explan(说明)添加项目 %%
|
|
||||||
@param(str)(string) 文本 %%
|
|
||||||
@param(wd)(number) 宽度 ,大于1 表示绝对宽阔 ,小于1 表示相对宽度 %%
|
|
||||||
**}
|
|
||||||
if not ifstring(str)then return -1;
|
|
||||||
if not(wd>0)then wd := 100;
|
|
||||||
Fitems[Length(Fitems)]:= array("text":str,"width":wd);
|
|
||||||
if HandleAllocated()then
|
|
||||||
begin
|
|
||||||
InvalidateRect(nil,false);
|
|
||||||
end
|
|
||||||
end
|
|
||||||
function deleteitem(id);
|
|
||||||
begin
|
|
||||||
{**
|
|
||||||
@explan(说明) 删除项目 %%
|
|
||||||
@param(id)(integer) 序号 %%
|
|
||||||
**}
|
|
||||||
if not(itemidok(id))then return -1;
|
|
||||||
deleteindex(Fitems,id,true);
|
|
||||||
if HandleAllocated()then
|
|
||||||
begin
|
|
||||||
InValidateRect(nil,false);
|
|
||||||
end
|
|
||||||
end
|
|
||||||
function setitemtext(str,id);
|
|
||||||
begin
|
|
||||||
{**
|
|
||||||
@explan(说明) 修改字段 %%
|
|
||||||
@param(str)(string) 文本%%
|
|
||||||
@param(id)(integer) 序号 %%
|
|
||||||
**}
|
|
||||||
if not ifstring(str)then return-1;
|
|
||||||
if not(itemidok(id))then return -1;
|
|
||||||
Fitems[id,"text"]:= str;
|
|
||||||
if HandleAllocated()then
|
|
||||||
begin
|
|
||||||
InvalidateRect(nil,false);
|
|
||||||
end
|
|
||||||
end
|
|
||||||
property Items:statusitems read Fitems Write SetItems;
|
|
||||||
{**
|
|
||||||
@param(Items)(array)设置项 ,二维数组包括 text ,width 两个字段 array(("text":"abc","width":200),("text":"part2","width":0.4))%%
|
|
||||||
**}
|
|
||||||
end
|
end
|
||||||
type TCustomSpinEdit = class(TCustomControl)
|
type TCustomSpinEdit = class(TCustomControl)
|
||||||
{**
|
{**
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue