界面库

优化
This commit is contained in:
JianjunLiu 2022-08-16 17:23:28 +08:00
parent 273cefc5c7
commit 61a705ec45
7 changed files with 64 additions and 35 deletions

View File

@ -1795,6 +1795,9 @@ type TVclDesigner = class(tvcform)
FProjectsManager.parent := self; FProjectsManager.parent := self;
FProjectManager := new TProjectView(self); FProjectManager := new TProjectView(self);
FProjectManager.height := rect[3]-top-height-20;
FProjectManager.left := left;
FProjectManager.top := top+height;
ico := new tbitmap(); ico := new tbitmap();
ico.Readvcon(HexFormatStrToTsl(GetWindowMgrBmp())); ico.Readvcon(HexFormatStrToTsl(GetWindowMgrBmp()));
FProjectManager.FormICon := ico.ToIcon(); FProjectManager.FormICon := ico.ToIcon();
@ -1958,7 +1961,7 @@ type TVclDesigner = class(tvcform)
if FObjInspector.Visible then if FObjInspector.Visible then
begin begin
FObjInspector.left := width+ Left-FObjInspector.width; FObjInspector.left := width+ Left-FObjInspector.width;
FObjInspector.top := top+height+20; FObjInspector.top := top+height;
end end
if o then if o then
begin begin

View File

@ -169,7 +169,7 @@ type tcontrol = class(tcomponent)
bds := UnAlignBounds; bds := UnAlignBounds;
FAlign := Value; FAlign := Value;
//调其兄弟节点的位置 %% //调其兄弟节点的位置 %%
if FParent is getparenttype() and FParent.HandleAllocated()then if (FParent is getparenttype()) and FParent.HandleAllocated()then
begin begin
if FAlign=alNone then if FAlign=alNone then
begin begin

View File

@ -915,6 +915,7 @@ type TPanel=class(TScrollingWinControl) //
"onmousewheel","onsize","onmove","onmousemove","onpopupmenu", "onmousewheel","onsize","onmove","onmousemove","onpopupmenu",
"onmousedown","onmouseup", "onmousedown","onmouseup",
"onactivate","onclose", "onactivate","onclose",
"onsetfocus","onkillfocus",
"onkeyup","onkeydown","onkeypress" "onkeyup","onkeydown","onkeypress"
); );
end end
@ -1464,6 +1465,7 @@ type TVCForm = class(TScrollingWinControl)
"onsize","onmove","onmousemove", "onsize","onmove","onmousemove",
"onmousedown","onmouseup", "onmousedown","onmouseup",
"onactivate","onclose", "onactivate","onclose",
"onsetfocus","onkillfocus",
"onkeyup","onkeydown","onkeypress" "onkeyup","onkeydown","onkeypress"
); );
end end
@ -1554,7 +1556,8 @@ type tbtn = class(tcustombtn)
function publishs();override; function publishs();override;
begin begin
return array("name","action","left","top","width","height", return array("name","action","left","top","width","height",
"align","anchors","caption","font","enabled","visible","bkbitmap","color","tabstop","onclick","onmousemove","onsetfocus","onkillfocus"); "align","anchors","caption","font","enabled","visible","bkbitmap","color","tabstop",
"onclick","onmousemove","onsetfocus","onkillfocus","onkeyup","onkeydown","onkeypress");
end end
end end
@ -2895,7 +2898,7 @@ type TTreeView=class(TTreeCtl)
return array("name", return array("name",
"left","top","width","height","caption","align","anchors", "left","top","width","height","caption","align","anchors",
"checkbox","visible","itemheght","imagelist","hasline","singleexpand", "checkbox","visible","itemheght","imagelist","hasline","singleexpand",
"lazyitems","onselchanged"); "lazyitems","onselchanged","onmousedown","onsetfocus","onkillfocus","onkeyup","onkeydown");
end end
//property OnDeleteItem read FOnDeleteItem write FOnDeleteItem; //property OnDeleteItem read FOnDeleteItem write FOnDeleteItem;
//property OnItemExpand:eventhandler read FOnItemExpand write FOnItemExpand; //property OnItemExpand:eventhandler read FOnItemExpand write FOnItemExpand;
@ -3216,10 +3219,12 @@ type TPairSplitter=class(tcustomcontrol) //
rc := GetClientRect(); rc := GetClientRect();
pz := GetPosition(); pz := GetPosition();
pbdr := 0; pbdr := 0;
{if (csDesigning in ComponentState) then {$ifdef linux}
if (csDesigning in ComponentState) then
begin begin
pbdr := 2; pbdr := 2;
end } end
{$endif}
if sd1 and sd1.HandleAllocated()then if sd1 and sd1.HandleAllocated()then
begin begin
if FSplitterType=pstHorizontal then sd1.setboundsrect(array(rc[0]+pbdr,rc[1]+pbdr,rc[0]+pz,rc[3]-pbdr)); if FSplitterType=pstHorizontal then sd1.setboundsrect(array(rc[0]+pbdr,rc[1]+pbdr,rc[0]+pz,rc[3]-pbdr));
@ -5230,8 +5235,8 @@ type TSavefileADlg = class(tcustomfsdlg)
end end
function publishs();override; function publishs();override;
begin begin
return array("name","caption","filter","filterindex","filename","defaultfileextension","initialdlg", return array("name","caption","filter","filterindex","filename","defaultfileextension",
"showhidden","multiselected","overwriteprompt","linkfilepath","filemustexist","createprompt"); "showhidden","multiselected","overwriteprompt","filemustexist"); //"linkfilepath" "createprompt"
end end
end end

View File

@ -95,9 +95,9 @@ type tsgtkapi = class(tgtkapis)
h := g_object_get_data(hwd,"gtk_layout_height"); h := g_object_get_data(hwd,"gtk_layout_height");
global g_w_c_width; global g_w_c_width;
pcd := gtk_object_get_data(hwd,"gtk_wnd_hs_caption")?g_w_c_width:0; pcd := gtk_object_get_data(hwd,"gtk_wnd_hs_caption")?g_w_c_width:0;
gtk_window_move(hwd,x,y-pcd); gtk_window_move(hwd,x,max(0,y-pcd));
if w>=0 and h>=0 then if w>=0 and h>=0 then
gtk_widget_set_size_request(hwd,w,h-pcd); gtk_widget_set_size_request(hwd,w,max(0,h-pcd));
end end
if f=0x4 then if f=0x4 then
begin begin
@ -232,7 +232,7 @@ type tsgtkapi = class(tgtkapis)
pcd := gtk_object_get_data(h,"gtk_wnd_hs_caption")?g_w_c_width:0; pcd := gtk_object_get_data(h,"gtk_wnd_hs_caption")?g_w_c_width:0;
y0 := g_object_get_data(h,"gtk_layout_height")-pcd; y0 := g_object_get_data(h,"gtk_layout_height")-pcd;
end end
rec := array(0,0,x0, y0); rec := array(0,0,x0, max(0,y0));
return true; return true;
end end
function GetWindowRect(hwnd :pointer;var rec:array of integer):integer; function GetWindowRect(hwnd :pointer;var rec:array of integer):integer;
@ -243,7 +243,7 @@ type tsgtkapi = class(tgtkapis)
w := g_object_get_data(hwnd,"gtk_layout_width"); w := g_object_get_data(hwnd,"gtk_layout_width");
global g_w_c_width; global g_w_c_width;
pcd := gtk_object_get_data(hwnd,"gtk_wnd_hs_caption")?g_w_c_width:0; pcd := gtk_object_get_data(hwnd,"gtk_wnd_hs_caption")?g_w_c_width:0;
rec := array(xy[0],xy[1],xy[0]+w,xy[1]+h-pcd); rec := array(xy[0],xy[1],xy[0]+w,max(0,xy[1]+h-pcd));
end end
function GetWindowInfo(hwnd :pointer;f:pointer):integer; function GetWindowInfo(hwnd :pointer;f:pointer):integer;
begin begin
@ -270,7 +270,7 @@ type tsgtkapi = class(tgtkapis)
y0 := g_object_get_data(h,"gtk_layout_y"); y0 := g_object_get_data(h,"gtk_layout_y");
if (x>=0 and y>=0) and (x<>x0 or y<>y0) then //窗口位置 if (x>=0 and y>=0) and (x<>x0 or y<>y0) then //窗口位置
begin begin
gtk_window_move(h,x,y-pcd); gtk_window_move(h,x,max(0,y-pcd));
g_object_set_data(h,"gtk_layout_x",x); g_object_set_data(h,"gtk_layout_x",x);
g_object_set_data(h,"gtk_layout_y",y); g_object_set_data(h,"gtk_layout_y",y);
flg .|=2; flg .|=2;
@ -284,16 +284,16 @@ type tsgtkapi = class(tgtkapis)
gtk_widget_get_size_request(h,cx0,cy0); //改小一点 gtk_widget_get_size_request(h,cx0,cy0); //改小一点
if cx0>cx or cy0>cy then if cx0>cx or cy0>cy then
begin begin
gtk_widget_set_size_request(h,cx,cy-pcd); gtk_widget_set_size_request(h,cx,max(0,cy-pcd));
end end
gtk_window_resize(h,cx,cy-pcd); gtk_window_resize(h,cx,max(0,cy-pcd));
end end
else else
begin begin
//gtk_widget_get_size_request(h,cx0,cy0); //gtk_widget_get_size_request(h,cx0,cy0);
//echo "\r\noldsize:",cx0,"====",cy0; //echo "\r\noldsize:",cx0,"====",cy0;
//gtk_window_resize(wh,cx,cy); //gtk_window_resize(wh,cx,cy);
gtk_widget_set_size_request(h,cx,cy-pcd); gtk_widget_set_size_request(h,cx,max(0,cy-pcd));
//gtk_window_set_decorated(h,true); //gtk_window_set_decorated(h,true);
//gtk_window_set_resizable(h,true); //gtk_window_set_resizable(h,true);
@ -330,7 +330,7 @@ type tsgtkapi = class(tgtkapis)
h0 := g_object_get_data(h,"gtk_layout_height"); h0 := g_object_get_data(h,"gtk_layout_height");
if (cx>=0 and cy>=0) and ( cx<>w0 or cy<>h0) then if (cx>=0 and cy>=0) and ( cx<>w0 or cy<>h0) then
begin begin
gtk_widget_set_size_request(h,cx,cy-pcd); gtk_widget_set_size_request(h,cx,max(0,cy-pcd));
g_object_set_data(h,"gtk_layout_width",cx); g_object_set_data(h,"gtk_layout_width",cx);
g_object_set_data(h,"gtk_layout_height",cy); g_object_set_data(h,"gtk_layout_height",cy);
//lbl := g_object_get_data(h,"gtk_layout_lable"); //lbl := g_object_get_data(h,"gtk_layout_lable");
@ -503,7 +503,7 @@ type tsgtkapi = class(tgtkapis)
begin begin
global g_w_c_width; global g_w_c_width;
pcd := gtk_object_get_data(h,"gtk_wnd_hs_caption")?g_w_c_width:0; pcd := gtk_object_get_data(h,"gtk_wnd_hs_caption")?g_w_c_width:0;
gtk_widgetsizechanged(h,AHeight-pcd,AWidth); gtk_widgetsizechanged(h,max(0,AHeight-pcd),AWidth);
end end
{if SizeChanged then {if SizeChanged then
begin begin
@ -1248,7 +1248,7 @@ type tsgtkapi = class(tgtkapis)
w :=g_object_get_data(hwd,"gtk_layout_width"); w :=g_object_get_data(hwd,"gtk_layout_width");
global g_w_c_width; global g_w_c_width;
pcd := gtk_object_get_data(hwnd,"gtk_wnd_hs_caption")?g_w_c_width:0; pcd := gtk_object_get_data(hwnd,"gtk_wnd_hs_caption")?g_w_c_width:0;
gtk_widgetsizechanged(hwd,h-pcd,w); gtk_widgetsizechanged(hwd,max(0,h-pcd),w);
end end
Function SetMenu(hwd:pointer;hmenu:pointer):integer; //设置菜单栏 Function SetMenu(hwd:pointer;hmenu:pointer):integer; //设置菜单栏
begin begin
@ -1287,7 +1287,7 @@ type tsgtkapi = class(tgtkapis)
w :=g_object_get_data(hwd,"gtk_layout_width"); w :=g_object_get_data(hwd,"gtk_layout_width");
global g_w_c_width; global g_w_c_width;
pcd := gtk_object_get_data(hwnd,"gtk_wnd_hs_caption")?g_w_c_width:0; pcd := gtk_object_get_data(hwnd,"gtk_wnd_hs_caption")?g_w_c_width:0;
gtk_widgetsizechanged(hwd,h-pcd,w); gtk_widgetsizechanged(hwd,max(0,h-pcd),w);
//移除原有窗口 //移除原有窗口
//menubar 添加到窗口 //menubar 添加到窗口
end end
@ -1790,7 +1790,7 @@ type tsgtkapi = class(tgtkapis)
h := g_object_get_data(hwnd,"gtk_layout_height"); h := g_object_get_data(hwnd,"gtk_layout_height");
global g_w_c_width; global g_w_c_width;
pcd := gtk_object_get_data(hwnd,"gtk_wnd_hs_caption")?g_w_c_width:0; pcd := gtk_object_get_data(hwnd,"gtk_wnd_hs_caption")?g_w_c_width:0;
gtk_widgetsizechanged(hwnd,h-pcd,w); gtk_widgetsizechanged(hwnd,max(0,h-pcd),w);
return true; return true;
end end
function ClipCursor(rec:array of integer):integer; function ClipCursor(rec:array of integer):integer;
@ -4770,22 +4770,22 @@ type tgtk_ctl_object = class(_gtkeventtype)
_wapi.GetCursorPos(cxy); _wapi.GetCursorPos(cxy);
dx := cxy[0]-ogps[0]; dx := cxy[0]-ogps[0];
dy := cxy[1]-ogps[1]; dy := cxy[1]-ogps[1];
case FHitwidgetposition of case FHitwidgetposition of //0 ÐÞ¸ÄΪ -1
110: 110:
begin begin
if dx<>0 then _wapi.SetWindowPos(a.handle,0,xy[0]+dx,xy[1],xy[2]-dx,xy[3],0); if dx<>0 then _wapi.SetWindowPos(a.handle,-1,xy[0]+dx,xy[1],xy[2]-dx,xy[3],0);
end end
111: 111:
begin begin
if dx<>0 then _wapi.SetWindowPos(a.handle,0,xy[0],xy[1],xy[2]+dx,xy[3],0); if dx<>0 then _wapi.SetWindowPos(a.handle,-1,xy[0],xy[1],xy[2]+dx,xy[3],0);
end end
112: 112:
begin begin
if dy<>0 then _wapi.SetWindowPos(a.handle,0,xy[0],xy[1]+dy,xy[2],xy[3]-dy,0); if dy<>0 then _wapi.SetWindowPos(a.handle,-1,xy[0],xy[1]+dy,xy[2],xy[3]-dy,0);
end end
115: 115:
begin begin
if dy<>0 then _wapi.SetWindowPos(a.handle,0,xy[0],xy[1],xy[2],xy[3]+dy,0); if dy<>0 then _wapi.SetWindowPos(a.handle,-1,xy[0],xy[1],xy[2],xy[3]+dy,0);
end end
@ -6500,10 +6500,10 @@ type tgtk_ctl_window_PoPup = class(tgtk_ctl_scroll_window)
InitWidgetSize(h,x,y,nwidth,nheight); InitWidgetSize(h,x,y,nwidth,nheight);
_wapi.gtk_window_move(h,x,y-pcd); _wapi.gtk_window_move(h,x,max(0,y-pcd));
if nwidth>0 and nheight>0 then if nwidth>0 and nheight>0 then
begin begin
_wapi.gtk_window_resize(h,nwidth,nheight-pcd); _wapi.gtk_window_resize(h,nwidth,max(0,nheight-pcd));
end end
_wapi.gtk_widget_show_all(vbox); _wapi.gtk_widget_show_all(vbox);
InitContainerList(h); //容器list InitContainerList(h); //容器list

View File

@ -3160,10 +3160,11 @@ type TcustomListBox=class(TCustomListBoxbase)
end end
return; return;
end end
if not isValidIndex(n)or n=FSelBegin then return; if not(isValidIndex2(n)) or n=FSelBegin then return;
SelRange(false); SelRange(false);
FSelBegin := FSelEnd := n; FSelBegin := FSelEnd := n;
SelRange(true); SelRange(true);
SetYpos(n);
CallMessgeFunction(FselectionChange,self(true),new tuieventbase(0,0,0,0)); CallMessgeFunction(FselectionChange,self(true),new tuieventbase(0,0,0,0));
end end
function getItemSelectedState(n); function getItemSelectedState(n);
@ -3451,6 +3452,10 @@ type TcustomListBox=class(TCustomListBoxbase)
begin begin
return(n >= 0)and n<FitemData.length(); return(n >= 0)and n<FitemData.length();
end end
function isValidIndex2(n);
begin
return(n >= -1)and n<FitemData.length();
end
FitemData; FitemData;
{** {**
@explan(说明)(TMyarrayB) list数据数据,不要试图修改该变量 @explan(说明)(TMyarrayB) list数据数据,不要试图修改该变量
@ -3801,6 +3806,17 @@ type TcustomComboBox=class(TCustomComboBoxbase)
if not o.Readonly then if not o.Readonly then
begin begin
CallMessgeFunction(Foneditchanged,o,e); CallMessgeFunction(Foneditchanged,o,e);
t := o.Text;
if t = getCurrentItemText() then return ;
for i,v in items do
begin
if t = v then
begin
ItemIndex := i;
return ;
end
end
ItemIndex := -1;
end end
end end
FEdit.onupdate := function(o,e); FEdit.onupdate := function(o,e);
@ -3816,9 +3832,13 @@ type TcustomComboBox=class(TCustomComboBoxbase)
FListBox.WsPopUp := true; FListBox.WsPopUp := true;
FListBox.onselectionchange := function(o,e); FListBox.onselectionchange := function(o,e);
begin begin
FEdit.Text := getCurrentItemText(); r := getCurrentItemText();
if r then
begin
FEdit.Text := r;
ShowDropDown(false); ShowDropDown(false);
CallMessgeFunction(OnSelchanged,self,true); CallMessgeFunction(OnSelchanged,self,e);
end
end end
FEdit.Readonly := Freadonly; FEdit.Readonly := Freadonly;
FListBox.parent := self; FListBox.parent := self;
@ -5026,7 +5046,7 @@ type TCustomSpinEdit = class(TCustomControl)
nv := GetValue()+FIncrement; nv := GetValue()+FIncrement;
if nv <= FMaxValue and nv >= FMinValue then if nv <= FMaxValue and nv >= FMinValue then
begin begin
CallMessgeFunction(FOnDecrease,o,e); CallMessgeFunction(FOnIncrease,o,e);
if not e.skip then if not e.skip then
begin begin
FValue := nv; FValue := nv;
@ -5143,7 +5163,7 @@ type TCustomSpinEdit = class(TCustomControl)
DrawItem(CI_UP,CIS_NONE); DrawItem(CI_UP,CIS_NONE);
DrawItem(CI_DOWN,CIS_NONE); DrawItem(CI_DOWN,CIS_NONE);
end end
property OnIncrease:eventhandler read FOnIncrease write FOnDecrease; property OnIncrease:eventhandler read FOnIncrease write FOnIncrease;
property OnDecrease:eventhandler read FOnDecrease write FOnDecrease; property OnDecrease:eventhandler read FOnDecrease write FOnDecrease;
property Increment:integer read FIncrement write SetIncrement; property Increment:integer read FIncrement write SetIncrement;
property MinValue:integer read FMinValue write SetMinValue; property MinValue:integer read FMinValue write SetMinValue;

View File

@ -1655,6 +1655,7 @@ type TcustomTreeCtl = class(TVirtualList)
function WMKEYUP(o,e):WM_KEYUP;virtual; function WMKEYUP(o,e):WM_KEYUP;virtual;
begin begin
if not FCurrentNode then return; if not FCurrentNode then return;
if e.skip then return ;
case e.charcode of case e.charcode of
VK_UP,VK_DOWN: VK_UP,VK_DOWN:
begin begin