界面库

整理
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
begin
if o.height>Foh then
o.height := Foh;
begin
o.height := Foh; //gtk 逻辑正确但是设置无效
end
end
end
function openclassfile(); //打开编辑器

View File

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