界面库

整理
This commit is contained in:
JianjunLiu 2022-12-13 15:04:43 +08:00
parent 328da041da
commit 532b2959b5
2 changed files with 35 additions and 48 deletions

View File

@ -428,8 +428,9 @@ type TVclDesigner = class(tvcform)
if e.wparam = 123 and e.lparam=123 then if e.wparam = 123 and e.lparam=123 then
begin begin
if o.height>Foh then if o.height>Foh then
o.height := Foh; begin
o.height := Foh; //gtk 逻辑正确但是设置无效
end
end end
end end
function openclassfile(); //打开编辑器 function openclassfile(); //打开编辑器

View File

@ -941,7 +941,7 @@ type tsgtkapi = class(tgtkapis)
if fto then fto := fto[0]; if fto then fto := fto[0];
wd := fto._getvalue_("width"); wd := fto._getvalue_("width");
ht := fto._getvalue_("height"); ht := fto._getvalue_("height");
end end
//DT_LEFT := 0; //DT_LEFT := 0;
DT_RIGHT := 0x2; DT_RIGHT := 0x2;
//DT_TOP := 0; //DT_TOP := 0;
@ -1108,11 +1108,11 @@ type tsgtkapi = class(tgtkapis)
rs1 := new TCRect(hrgnSrc1); rs1 := new TCRect(hrgnSrc1);
if fnCombineMode=0x1 then if fnCombineMode=0x1 then
begin begin
rs2 := new TCRect(hrgnSrc2); rs2 := new TCRect(hrgnSrc2);
rd.left := max(rs1.left,rs2.left); rd.left := max(rs1.left,rs2.left);
rd.top := max(rs1.top,rs2.top); rd.top := max(rs1.top,rs2.top);
rd.right := min(rs1.right,rs2.right); rd.right := min(rs1.right,rs2.right);
rd.bottom := min(rs1.bottom,rs2.bottom); rd.bottom := min(rs1.bottom,rs2.bottom);
end else end else
if fnCombineMode=0x5 then if fnCombineMode=0x5 then
begin begin
@ -1161,9 +1161,9 @@ type tsgtkapi = class(tgtkapis)
p.width := w; p.width := w;
p.color := FC; p.color := FC;
p.style := fs; p.style := fs;
ptr := p._getptr_(); ptr := p._getptr_();
gtk_gdi_object_globals[inttostr(ptr)] := array(p,"pen"); gtk_gdi_object_globals[inttostr(ptr)] := array(p,"pen");
return ptr; return ptr;
//¹¹Ôì»­±Ê //¹¹Ôì»­±Ê
end end
function CreateSolidBrush(crColor:integer); function CreateSolidBrush(crColor:integer);
@ -1243,11 +1243,11 @@ type tsgtkapi = class(tgtkapis)
end end
Function CreatePopupMenu():pointer; Function CreatePopupMenu():pointer;
begin begin
//µ¯³ö²Ëµ¥ //µ¯³ö²Ëµ¥
r := gtk_menu_new(); r := gtk_menu_new();
gtk_widget_show(r); gtk_widget_show(r);
g_object_set_data(r,"popmenubar",true); g_object_set_data(r,"popmenubar",true);
return r; return r;
end end
Function DestroyMenu(hMenu:pointer):integer; Function DestroyMenu(hMenu:pointer):integer;
begin begin
@ -1378,14 +1378,14 @@ type tsgtkapi = class(tgtkapis)
end end
function BeginPaint(hwd :pointer;strc:pointer):pointer; function BeginPaint(hwd :pointer;strc:pointer):pointer;
begin begin
psc := new TPAINTSTRUCT(strc); psc := new TPAINTSTRUCT(strc);
dc := g_object_get_data(hwd,"paint_dc"); dc := g_object_get_data(hwd,"paint_dc");
//h := g_object_get_data(hwd,"paint_height"); //h := g_object_get_data(hwd,"paint_height");
//w := g_object_get_data(hwd,"paint_width"); //w := g_object_get_data(hwd,"paint_width");
rec := g_object_get_data(hwd,"paint_rect"); rec := g_object_get_data(hwd,"paint_rect");
psc._setvalue_("hdc",dc); psc._setvalue_("hdc",dc);
psc._setvalue_("rcpaint",array(rec[0],rec[1],rec[0]+rec[2],rec[1]+rec[3])); //{array(0,0,w,h)} psc._setvalue_("rcpaint",array(rec[0],rec[1],rec[0]+rec[2],rec[1]+rec[3])); //{array(0,0,w,h)}
return dc; return dc;
end end
function EndPaint(hwd :pointer;strc:pointer):integer; function EndPaint(hwd :pointer;strc:pointer):integer;
begin begin
@ -1492,8 +1492,7 @@ type tsgtkapi = class(tgtkapis)
pw := gtk_object_get_data(dc,"pen.width"); pw := gtk_object_get_data(dc,"pen.width");
brc := gtk_object_get_data(dc,"brush.color"); brc := gtk_object_get_data(dc,"brush.color");
if pw>0 then cairo_set_line_width(dc,pw); if pw>0 then cairo_set_line_width(dc,pw);
else cairo_set_line_width(dc,1); else cairo_set_line_width(dc,1);
mx := (l+r)/2+x; mx := (l+r)/2+x;
my := (b+t)/2+y; my := (b+t)/2+y;
cairo_translate(dc,mx,my); cairo_translate(dc,mx,my);
@ -1941,8 +1940,7 @@ type tsgtkapi = class(tgtkapis)
begin begin
//cairo_paint_with_alpha(hdc,0); //cairo_paint_with_alpha(hdc,0);
//cairo_paint_with_alpha(hdc,1); //cairo_paint_with_alpha(hdc,1);
//cairo_set_source_rgba(hdc, 1.0, 1.0, 1.0, 0); //cairo_set_source_rgba(hdc, 1.0, 1.0, 1.0, 0);
end end
cairo_fill(hdc); cairo_fill(hdc);
cairo_scale(hdc,1/p1,1/p2); cairo_scale(hdc,1/p1,1/p2);
@ -2086,7 +2084,6 @@ type tsgtkapi = class(tgtkapis)
cbmp := class(tUIglobalData).uigetdata("G_T_BITMAP_"); cbmp := class(tUIglobalData).uigetdata("G_T_BITMAP_");
if not cbmp then return 0; if not cbmp then return 0;
class(TGdiplusflat).GdipCreateBitmapFromHBITMAP(hbmImage,0,r1); class(TGdiplusflat).GdipCreateBitmapFromHBITMAP(hbmImage,0,r1);
bmp := createobject(cbmp); bmp := createobject(cbmp);
bmp.Handle := r1; bmp.Handle := r1;
if id=-1 then obj.Push(bmp); if id=-1 then obj.Push(bmp);
@ -2109,12 +2106,10 @@ type tsgtkapi = class(tgtkapis)
end end
function ImageList_LoadImageA2(hi:pointer;lpbmp:pointer;cx:integer;cGrow:integer; crMask:integer;uType:integer;uFlags:integer):pointer; function ImageList_LoadImageA2(hi:pointer;lpbmp:pointer;cx:integer;cGrow:integer; crMask:integer;uType:integer;uFlags:integer):pointer;
begin begin
end end
function ImageList_GetBkColor(himl:pointer):integer; function ImageList_GetBkColor(himl:pointer):integer;
begin begin
end end
function ImageList_GetDragImage(ppt:pointer;pptHotspot:pointer):pointer; function ImageList_GetDragImage(ppt:pointer;pptHotspot:pointer):pointer;
function ImageList_GetImageCount(himl:pointer):integer; function ImageList_GetImageCount(himl:pointer):integer;
@ -2374,8 +2369,7 @@ type tsgtkapi = class(tgtkapis)
return r; return r;
end end
function ChooseFontA(LOGFONTA:pointer):integer; function ChooseFontA(LOGFONTA:pointer):integer;
begin begin
obj := new ttagCHOOSEFONTA(LOGFONTA); obj := new ttagCHOOSEFONTA(LOGFONTA);
lgobj := obj._getvalue_("lplogfont"); lgobj := obj._getvalue_("lplogfont");
ht := lgobj._getvalue_("height"); ht := lgobj._getvalue_("height");
@ -2468,7 +2462,7 @@ type tsgtkapi = class(tgtkapis)
r := 0; r := 0;
cdlg := gtk_file_chooser_dialog_new("folder selector",wd,3,"open",100,"cancel",50,nil); cdlg := gtk_file_chooser_dialog_new("folder selector",wd,3,"open",100,"cancel",50,nil);
dir := obj._getvalue_("pidlroot"); dir := obj._getvalue_("pidlroot");
if dir then //ĬÈÏλÖà if dir then //ĬÈÏλÖÃ
begin begin
df := ReadStringFromPtr(dir); df := ReadStringFromPtr(dir);
if df then if df then
@ -2480,9 +2474,8 @@ type tsgtkapi = class(tgtkapis)
begin begin
r := GtkStringToTsl( gtk_file_chooser_get_filename(cdlg)); r := GtkStringToTsl( gtk_file_chooser_get_filename(cdlg));
end end
gtk_widget_destroy(cdlg); gtk_widget_destroy(cdlg);
return r; return r;
end end
function SHGetPathFromIDListA(LPBROWSEINFOA:pointer;var buf:string ):integer; function SHGetPathFromIDListA(LPBROWSEINFOA:pointer;var buf:string ):integer;
begin begin
@ -5900,24 +5893,20 @@ type tgtk_im_object = class(tgtk_ctl_object)
"commit": "commit":
begin begin
FCommit := ReadStringFromPtr(c); FCommit := ReadStringFromPtr(c);
//echo FCommit,FCtl,"**\r\n";
if FCtl then if FCtl then
begin begin
s := utf8toansi(FCommit); s := utf8toansi(FCommit);
for i:= 1 to length(s) do for i:= 1 to length(s) do
begin begin
//echo "***\r\n",ord(s[i]),">>",FCtl._const.WM_CHAR,"<<<";
FCtl.CallTslVclProc(_const.WM_CHAR,ord(s[i]),0); FCtl.CallTslVclProc(_const.WM_CHAR,ord(s[i]),0);
end end
end end
//echo "cmt=====",tostn(FCommit);
end end
end; end;
end end
function GtkBaseEventName();override; //°ó¶¨µÄÏûÏ¢ function GtkBaseEventName();override; //°ó¶¨µÄÏûÏ¢
begin begin
//"commit","delete-surrounding", return array("commit");//,"preedit-changed","preedit-end","preedit-start","retrieve-surrounding");//"commit","delete-surrounding",
return array("commit");//,"preedit-changed","preedit-end","preedit-start","retrieve-surrounding");
end end
function focusin();//focus in function focusin();//focus in
begin begin
@ -5983,7 +5972,6 @@ type tgtk_ctl_object_scroll = class(tgtk_ctl_object)
function Create(h);override; function Create(h);override;
begin begin
inherited; inherited;
//Connect("event",thisfunction(scrollevent));
end end
function GtkBaseEventName();override; function GtkBaseEventName();override;
begin begin
@ -5993,14 +5981,12 @@ type tgtk_ctl_object_scroll = class(tgtk_ctl_object)
begin begin
return false; return false;
end end
end end
type tgtk_ctl_object_scroll_Bar = class(tgtk_ctl_object) type tgtk_ctl_object_scroll_Bar = class(tgtk_ctl_object)
function Create(h);override; function Create(h);override;
begin begin
inherited; inherited;
Connect("event",thisfunction(scrollevent)); Connect("event",thisfunction(scrollevent));
end end
function scrollevent(a,b,c,d); function scrollevent(a,b,c,d);
begin begin