parent
f266623015
commit
af29344e72
|
|
@ -62,8 +62,6 @@ function TslToHexFormatStr(tsl);
|
|||
function HexFormatStrToTsl(D);
|
||||
function GetTextWidthAndHeightWidthFont(s,f,mul);
|
||||
////////////////////////////////////
|
||||
{type TByteData = class(TByteDataOP)
|
||||
end }
|
||||
//应用
|
||||
type tapplication=class(tcomponent)
|
||||
{**
|
||||
|
|
@ -71,14 +69,11 @@ type tapplication=class(tcomponent)
|
|||
**}
|
||||
private
|
||||
static FApplicationWindow;
|
||||
static FMessageObj;
|
||||
//static Ftooltips;
|
||||
FMessageObj;
|
||||
FVisible;
|
||||
FHandle; //句柄
|
||||
Fmainform; //主窗口
|
||||
FDebug;
|
||||
//FTiptimer;
|
||||
//FTiptimertag1;
|
||||
Foldforminfo;
|
||||
function SetVisible(v);
|
||||
begin
|
||||
|
|
@ -124,7 +119,6 @@ type tapplication=class(tcomponent)
|
|||
FApplicationWindow := new tapplicationwindow(self);
|
||||
FApplicationWindow.Visible := FVisible;
|
||||
end
|
||||
//echo "???",tostn(FApplicationWindow.classinfo());
|
||||
FHandle := FApplicationWindow.Handle;
|
||||
end
|
||||
public
|
||||
|
|
@ -132,9 +126,6 @@ type tapplication=class(tcomponent)
|
|||
begin
|
||||
inherited;
|
||||
FVisible := false;
|
||||
//FTiptimer := new ttimer();
|
||||
//FTiptimer.Interval := 2000;
|
||||
//FTiptimer.Ontimer := thisfunction(ontiptimer);
|
||||
end
|
||||
function WMACTIVATEAPP(o,e);virtual;
|
||||
begin
|
||||
|
|
@ -146,7 +137,6 @@ type tapplication=class(tcomponent)
|
|||
if e.wparam then
|
||||
begin
|
||||
//_wapi.SetWindowPos(Fmainform.Handle, HWND_TOPMOST, 0, 0, 0, 0, SWP_NOMOVE .|SWP_NOSIZE);
|
||||
//Fmainform.Visible := true;//
|
||||
Fmainform.show();
|
||||
if Fmainform.HandleAllocated() then
|
||||
begin
|
||||
|
|
@ -217,9 +207,6 @@ type tapplication=class(tcomponent)
|
|||
@ignore(忽略) %%
|
||||
**}
|
||||
CallMessgeFunction(Foldforminfo["minimize"],o,e);
|
||||
//e.skip := true;
|
||||
//if Fmainform then Fmainform.Visible := false;
|
||||
//FApplicationWindow._send_(,0,0);
|
||||
end
|
||||
function run();
|
||||
begin
|
||||
|
|
@ -311,27 +298,7 @@ type TLabel = class(TcustomLabel)
|
|||
@param(TextAlign)(member of TAlignStyle9) 文字对齐 %%
|
||||
**}
|
||||
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)
|
||||
{**
|
||||
@explan(说明) 包裹window句柄类,继承该类,根据CreateWnd 注释的提示重写该函数
|
||||
|
|
@ -1415,7 +1382,7 @@ type tmemo = class(TSynMemoNorm) //
|
|||
FonSetFocus;
|
||||
fonKillFocus;
|
||||
end
|
||||
type thighlighter= class(tcustomsynhighlighter)
|
||||
type thighlighter= class(tcustomsynhighlighter) //语法高亮
|
||||
uses UTslMemo;
|
||||
function create(AOwner);
|
||||
begin
|
||||
|
|
@ -2123,7 +2090,7 @@ type TStatusBar = class(TcustomStatusBar)
|
|||
function publishs();override;
|
||||
begin
|
||||
return array("name","caption","enabled","border",
|
||||
"font","visible","items","ondblclick","onmousedown","onmouseup","onnotification");
|
||||
"font","visible","items","itemorder","onmousemove","onmousedown","onmouseup","onnotification");
|
||||
end
|
||||
end
|
||||
type tcoolbar = class(tcustomcoolbar)
|
||||
|
|
@ -7092,22 +7059,41 @@ Initialization
|
|||
initlib();
|
||||
Finalization
|
||||
end.
|
||||
{
|
||||
if message in array(1,0x81)then
|
||||
begin
|
||||
obj := new tslcstructureobj(MemoryAlignmentCalculate(array(
|
||||
("lpcreateparams","intptr",0),
|
||||
("hinstance","intptr",0),
|
||||
("hmenu","intptr",0),
|
||||
("hwndparent","intptr",0),
|
||||
("cy","int",0),
|
||||
("cx","int",0),
|
||||
("y","int",0),
|
||||
("x","int",0),
|
||||
("style","int",0),
|
||||
("lpszname","intptr",0),
|
||||
("lpszclass","intptr",0),
|
||||
("dwexstyle","int",0))),lparam);
|
||||
echo tostn(obj._getdata_);
|
||||
end
|
||||
}
|
||||
|
||||
//if message in array(1,0x81)then
|
||||
//begin
|
||||
// obj := new tslcstructureobj(MemoryAlignmentCalculate(array(
|
||||
// ("lpcreateparams","intptr",0),
|
||||
// ("hinstance","intptr",0),
|
||||
// ("hmenu","intptr",0),
|
||||
// ("hwndparent","intptr",0),
|
||||
// ("cy","int",0),
|
||||
// ("cx","int",0),
|
||||
// ("y","int",0),
|
||||
// ("x","int",0),
|
||||
// ("style","int",0),
|
||||
// ("lpszname","intptr",0),
|
||||
// ("lpszclass","intptr",0),
|
||||
// ("dwexstyle","int",0))),lparam);
|
||||
// echo tostn(obj._getdata_);
|
||||
//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 //成员变量
|
||||
__wstyle; //窗口样式
|
||||
__wexstyle; //窗口扩展样式
|
||||
__wstylestruct; //样式消息结构体
|
||||
//__wstylestruct; //样式消息结构体
|
||||
__clientsize; //客户区大小
|
||||
__oldclientsize; //旧客户区大小
|
||||
//__oldclientsize; //旧客户区大小
|
||||
FClientleft;
|
||||
FClientTop;
|
||||
FClientWdith;
|
||||
|
|
|
|||
|
|
@ -5413,11 +5413,94 @@ end
|
|||
type TcustomStatusBar=class(TCustomControl)
|
||||
{**
|
||||
@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
|
||||
Fitems;
|
||||
FCwid;
|
||||
FCHei;
|
||||
faddlock;//添加锁定刷新
|
||||
Fitems;//项目
|
||||
FCwid;//宽度
|
||||
FCHei;//高度
|
||||
FItemOder;//排序
|
||||
private
|
||||
function itemidok(id);
|
||||
begin
|
||||
ct := length(Fitems);
|
||||
|
|
@ -5431,7 +5514,9 @@ type TcustomStatusBar=class(TCustomControl)
|
|||
Fitems := array();
|
||||
for i,v in its do
|
||||
begin
|
||||
faddlock := true;
|
||||
if ifarray(v)then additem(v["text"],v["width"]);
|
||||
faddlock := false;
|
||||
end
|
||||
end
|
||||
function DrawStatItem(cvs,v,rec);
|
||||
|
|
@ -5443,100 +5528,87 @@ type TcustomStatusBar=class(TCustomControl)
|
|||
cvs.Font := font;
|
||||
cvs.drawtext(hstr,rec,DT_VCENTER .| DT_SINGLELINE .| DT_NOPREFIX);
|
||||
end
|
||||
end
|
||||
protected
|
||||
procedure SetAlign(Value:TAlign);override;
|
||||
end
|
||||
function getwidthi(idx); //获得宽度
|
||||
begin
|
||||
if Align=Value then exit;
|
||||
if Value in array(alBottom)then
|
||||
if itemidok(idx) then
|
||||
begin
|
||||
inherited;
|
||||
return Fitems[idx,"width"];
|
||||
end
|
||||
end
|
||||
function setwidthi(idx,w); //设置宽度
|
||||
begin
|
||||
if not(w>=0) then return ;
|
||||
if itemidok(idx) then
|
||||
begin
|
||||
w1 := Fitems[idx,"width"];
|
||||
if w<>w1 then
|
||||
begin
|
||||
Fitems[idx,"width"] := integer(w);
|
||||
InvalidateRect(nil,false);
|
||||
end
|
||||
end
|
||||
end
|
||||
function gettexti(idx); //获得文本
|
||||
begin
|
||||
if itemidok(idx) then
|
||||
begin
|
||||
return Fitems[id,"text"];
|
||||
end
|
||||
end
|
||||
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
|
||||
end
|
||||
public
|
||||
function create(AOwner);override;
|
||||
begin
|
||||
inherited;
|
||||
height := 25;
|
||||
Align := alBottom;
|
||||
Fitems := array();
|
||||
end
|
||||
function DoWMsIZE();override;
|
||||
begin
|
||||
c := clientRect;
|
||||
FCwid := c[2];
|
||||
FCHei := c[3];
|
||||
end
|
||||
function Paint();override;
|
||||
if p>0 then
|
||||
begin
|
||||
DrawStatItem(cvs,array(),array(0,0,p,FCHei));
|
||||
end
|
||||
end
|
||||
function painta();//从又到左
|
||||
begin
|
||||
p := 0;
|
||||
cvs := canvas;
|
||||
if FItems then
|
||||
for i,v in FItems do
|
||||
begin
|
||||
for i,v in FItems do
|
||||
wd := v["width"];
|
||||
if wd>0 and wd<1.0001 then
|
||||
begin
|
||||
wd := v["width"];
|
||||
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;
|
||||
wd *= FCwid;
|
||||
end
|
||||
DrawStatItem(cvs,v,array(p,0,p+wd,FCHei));
|
||||
p += wd;
|
||||
if p>FCwid then return;
|
||||
end
|
||||
if p<FCwid then
|
||||
begin
|
||||
DrawStatItem(cvs,array(),array(p,0,FCwid,FCHei));
|
||||
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)
|
||||
{**
|
||||
|
|
|
|||
Loading…
Reference in New Issue