界面库

优化
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;
FProjectManager := new TProjectView(self);
FProjectManager.height := rect[3]-top-height-20;
FProjectManager.left := left;
FProjectManager.top := top+height;
ico := new tbitmap();
ico.Readvcon(HexFormatStrToTsl(GetWindowMgrBmp()));
FProjectManager.FormICon := ico.ToIcon();
@ -1958,7 +1961,7 @@ type TVclDesigner = class(tvcform)
if FObjInspector.Visible then
begin
FObjInspector.left := width+ Left-FObjInspector.width;
FObjInspector.top := top+height+20;
FObjInspector.top := top+height;
end
if o then
begin

View File

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

View File

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

View File

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

View File

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

View File

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