界面库

优化细节
This commit is contained in:
JianjunLiu 2022-08-19 17:52:35 +08:00
parent da2fb85883
commit a06ee66a81
6 changed files with 61 additions and 11 deletions

View File

@ -6492,7 +6492,7 @@ type TtextEditor = class(tpanel)
public public
itemData; itemData;
memo; memo;
function DoControlAlign(); function DoControlAlign();override;
begin begin
if btn1 and btn2 and memo then if btn1 and btn2 and memo then
begin begin

View File

@ -1771,7 +1771,7 @@ type tmemo = class(TSynMemoNorm)
return array("name","font","color","parentcolor","parentfont", return array("name","font","color","parentcolor","parentfont",
"popupmenu","visible","anchors","align", "popupmenu","visible","anchors","align",
"height","width","left","top", "height","width","left","top",
"text","readonly", "text","readonly","selectbkcolor","guttercolor","currentlinecolor","guttercharcnt",
"tabspace","onmousewheel","onmousemove","onpopupmenu", "tabspace","onmousewheel","onmousemove","onpopupmenu",
"onmousedown","onmouseup","onsetfocus","onkillfocus", "onmousedown","onmouseup","onsetfocus","onkillfocus",
"onkeyup","onkeydown","onkeypress", "onkeyup","onkeydown","onkeypress",

View File

@ -751,8 +751,6 @@ type TWinControl = class(tcontrol)
return ; return ;
{$endif} {$endif}
_wapi.GetWindowRect(hwnd,rec); _wapi.GetWindowRect(hwnd,rec);
rect := array(0,0,0,0);
_wapi.GetClientRect(self.Handle,rect);
region := new TRGNRECT(); region := new TRGNRECT();
region.Rect := rec; region.Rect := rec;
if e.wparam =1 then if e.wparam =1 then
@ -1233,7 +1231,7 @@ type TWinControl = class(tcontrol)
end end
end else end else
begin begin
{$ifdef gdipaint} {$ifdef gdipaint3}
ctls := Controls; ctls := Controls;
if not ctls then return; // e.skip := false; if not ctls then return; // e.skip := false;
if ctls.Count<1 then return; // e.skip := false ; if ctls.Count<1 then return; // e.skip := false ;

View File

@ -1051,7 +1051,7 @@ type tsgtkapi = class(tgtkapis)
end end
function ReleaseDC(hwd :pointer;hdc:pointer):integer; function ReleaseDC(hwd :pointer;hdc:pointer):integer;
begin begin
DeleteDC(hdc);
end end
function SelectClipRgn(hdc :pointer;gdiobj:pointer); function SelectClipRgn(hdc :pointer;gdiobj:pointer);
begin begin
@ -1379,6 +1379,18 @@ type tsgtkapi = class(tgtkapis)
begin begin
return 0; return 0;
end end
function GetDC(hwd);
begin
if hwd<0 or hwd>0 then
begin
hwcr := g_object_get_data(h,"gtk_clientwideget");
if hwcr>0 or hwcr<0 then return gdk_cairo_create(gtk_widget_get_window(hwcr));
end else
if hwd=0 then
begin
return 1;
end
end
function SaveDC(hdc :pointer):integer; function SaveDC(hdc :pointer):integer;
begin begin
if not(hdc>0 or hdc<0) then return ; if not(hdc>0 or hdc<0) then return ;

View File

@ -634,6 +634,9 @@ type TCustomMemo = class(TCustomScrollControl,TCustomMemoCmd)
@explan(说明) 带滚动条的编辑控件 %% @explan(说明) 带滚动条的编辑控件 %%
**} **}
private private
fselectbkcolor;//rgb(192,192,192);
fcurrentLineColor;//rgb(232,232,255);
fguttercolor;
Fecruningto; //调试运行到 Fecruningto; //调试运行到
FLineInterval; FLineInterval;
FSetPostioned; FSetPostioned;
@ -766,7 +769,7 @@ type TCustomMemo = class(TCustomScrollControl,TCustomMemoCmd)
function PaintGutter(rcDraw,nL1,nL2); function PaintGutter(rcDraw,nL1,nL2);
begin begin
dc := Canvas; dc := Canvas;
dc.brush.Color := rgb(228,228,228); dc.brush.Color :=FGutterColor ;//rgb(228,228,228);
rc := rcDraw; rc := rcDraw;
rc[2]-= 6; rc[2]-= 6;
dc.FillRect(rc); dc.FillRect(rc);
@ -828,14 +831,14 @@ type TCustomMemo = class(TCustomScrollControl,TCustomMemoCmd)
r[3]:= r[1]+fTextHeight; r[3]:= r[1]+fTextHeight;
if i+1=fCaretY then if i+1=fCaretY then
begin begin
cvs.Brush.Color := rgb(232,232,255); cvs.Brush.Color := fcurrentLineColor;//rgb(232,232,255);
cvs.FillRect(r); cvs.FillRect(r);
end end
if bb then if bb then
begin begin
if i >= bb[0]-1 and i <= ee[0]-1 then if i >= bb[0]-1 and i <= ee[0]-1 then
begin begin
cvs.Brush.Color := rgb(192,192,192); cvs.Brush.Color := fselectbkcolor;//rgb(192,192,192);
src := r; src := r;
if FSelectionMode=smLine then if FSelectionMode=smLine then
begin begin
@ -997,9 +1000,12 @@ type TCustomMemo = class(TCustomScrollControl,TCustomMemoCmd)
function Create(AOwner);override; function Create(AOwner);override;
begin begin
inherited; inherited;
FGutterColor := rgb(228,228,228);
fcurrentLineColor := rgb(232,232,255);
fselectbkcolor := rgb(192,192,192);
FReadOnly := false; FReadOnly := false;
FLineInterval := 4; FLineInterval := 4;
FGutterCharCount := 7; FGutterCharCount := 4;
FSelectionMode := smNormal; FSelectionMode := smNormal;
FGutter := new TMemoGutter(self); FGutter := new TMemoGutter(self);
FGutter.Width := 1+Font.Width * FGutterCharCount; FGutter.Width := 1+Font.Width * FGutterCharCount;
@ -1545,6 +1551,9 @@ type TCustomMemo = class(TCustomScrollControl,TCustomMemoCmd)
property GutterWidth read GetGutterWidth; property GutterWidth read GetGutterWidth;
property LineInterval read FLineInterval write SetLineInterval; property LineInterval read FLineInterval write SetLineInterval;
property GutterCharCnt:integer read FGutterCharCount write SetGutterCharCnt; property GutterCharCnt:integer read FGutterCharCount write SetGutterCharCnt;
property currentLineColor:color read fcurrentLineColor write setcurrentLineColor;
property guttercolor:color read fguttercolor write setguttercolor;
property selectbkcolor:color read fselectbkcolor write setselectbkcolor;
{** {**
@param(ReadOnly)(bool) 是否只读%% @param(ReadOnly)(bool) 是否只读%%
@param(Text)(string) 文本%% @param(Text)(string) 文本%%
@ -1658,6 +1667,37 @@ type TCustomMemo = class(TCustomScrollControl,TCustomMemoCmd)
return array(cy,cx+(ci?(0):1)); return array(cy,cx+(ci?(0):1));
end end
private private
function setcurrentLineColor(c);
begin
if ifnumber(c) and c<>fcurrentLineColor then
begin
fcurrentLineColor := c;
r := carety;
InvalidateLines(r,r);
end
end
function setguttercolor(c);
begin
if ifnumber(c) and c<>fguttercolor then
begin
fguttercolor := c;
InvalidateRect(nil,false);
end
end
function setselectbkcolor(c);
begin
if ifnumber(c) and c<>fselectbkcolor then
begin
fselectbkcolor := c;
b1 := BlockBegin;
b2 := BlockEnd;
if b1<>b2 then
begin
InvalidateRect(nil,false);
end
end
end
function setreadolny(n); function setreadolny(n);
begin begin
nv := n?true:false; nv := n?true:false;