mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-09-15 12:59:45 +02:00
Gtk2: implemented SM_CYCAPTION system metrics.
git-svn-id: trunk@35300 -
This commit is contained in:
parent
8faf58e8d5
commit
045a3558a4
@ -79,9 +79,11 @@ type
|
|||||||
FLastFocusOut: PGtkWidget;
|
FLastFocusOut: PGtkWidget;
|
||||||
StayOnTopList: TMap;
|
StayOnTopList: TMap;
|
||||||
FAppActive: Boolean;
|
FAppActive: Boolean;
|
||||||
|
FCachedTitleBarHeight: Integer;
|
||||||
|
FCachedBorderSize: Integer;
|
||||||
function GetAppActive: Boolean;
|
function GetAppActive: Boolean;
|
||||||
|
function GetTitleBarHeight: Integer;
|
||||||
procedure SetAppActive(const AValue: Boolean);
|
procedure SetAppActive(const AValue: Boolean);
|
||||||
|
|
||||||
protected
|
protected
|
||||||
procedure AppendText(Sender: TObject; Str: PChar);
|
procedure AppendText(Sender: TObject; Str: PChar);
|
||||||
function GetText(Sender: TComponent; var Text: String): Boolean;
|
function GetText(Sender: TComponent; var Text: String): Boolean;
|
||||||
|
@ -1088,6 +1088,8 @@ end;
|
|||||||
constructor TGtk2WidgetSet.Create;
|
constructor TGtk2WidgetSet.Create;
|
||||||
begin
|
begin
|
||||||
inherited Create;
|
inherited Create;
|
||||||
|
FCachedTitleBarHeight := -1;
|
||||||
|
FCachedBorderSize := 4;
|
||||||
Gtk2Create;
|
Gtk2Create;
|
||||||
{$IFNDEF USE_GTK_MAIN_OLD_ITERATION}
|
{$IFNDEF USE_GTK_MAIN_OLD_ITERATION}
|
||||||
FMainPoll := nil;
|
FMainPoll := nil;
|
||||||
@ -2622,6 +2624,42 @@ begin
|
|||||||
Result := FAppActive;
|
Result := FAppActive;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
function TGtk2WidgetSet.GetTitleBarHeight: Integer;
|
||||||
|
var
|
||||||
|
I: Integer;
|
||||||
|
AForm: TCustomForm;
|
||||||
|
AWindow: PGdkWindow;
|
||||||
|
ARect: TGdkRectangle;
|
||||||
|
AW, AH: GInt;
|
||||||
|
begin
|
||||||
|
Result := 30;
|
||||||
|
if FCachedTitleBarHeight > 0 then
|
||||||
|
Result := FCachedTitleBarHeight
|
||||||
|
else
|
||||||
|
if Assigned(Application) and not Application.Terminated and
|
||||||
|
Assigned(Application.MainForm) then
|
||||||
|
begin
|
||||||
|
for i := 0 to Screen.CustomFormZOrderCount - 1 do
|
||||||
|
begin
|
||||||
|
AForm := Screen.CustomFormsZOrdered[i];
|
||||||
|
if (AForm.HandleAllocated) and (AForm.Visible) and (AForm.Parent = nil) and
|
||||||
|
(AForm.BorderStyle <> bsNone) then
|
||||||
|
begin
|
||||||
|
AWindow := PGtkWidget(AForm.Handle)^.window;
|
||||||
|
if GDK_IS_WINDOW(AWindow) then
|
||||||
|
begin
|
||||||
|
gdk_window_get_frame_extents(AWindow, @ARect);
|
||||||
|
gdk_window_get_size(AWindow, @AW, @AH);
|
||||||
|
FCachedTitleBarHeight := ARect.Height - AH - 1;
|
||||||
|
FCachedBorderSize := (ARect.Width - AW) div 2;
|
||||||
|
Result := ARect.Height - AH - 1;
|
||||||
|
break;
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
|
||||||
procedure TGtk2WidgetSet.SetAppActive(const AValue: Boolean);
|
procedure TGtk2WidgetSet.SetAppActive(const AValue: Boolean);
|
||||||
begin
|
begin
|
||||||
if AValue <> FAppActive then
|
if AValue <> FAppActive then
|
||||||
|
@ -5542,7 +5542,7 @@ begin
|
|||||||
SM_CXSIZEFRAME,
|
SM_CXSIZEFRAME,
|
||||||
SM_CYSIZEFRAME:
|
SM_CYSIZEFRAME:
|
||||||
begin
|
begin
|
||||||
Result := 4;
|
Result := FCachedBorderSize;
|
||||||
end;
|
end;
|
||||||
SM_CXSMICON,
|
SM_CXSMICON,
|
||||||
SM_CYSMICON:
|
SM_CYSMICON:
|
||||||
@ -5570,6 +5570,7 @@ begin
|
|||||||
SM_CYCAPTION:
|
SM_CYCAPTION:
|
||||||
begin
|
begin
|
||||||
//DebugLn('Trace:TODO: [TGtk2WidgetSet.GetSystemMetrics] --> SM_CYCAPTION ');
|
//DebugLn('Trace:TODO: [TGtk2WidgetSet.GetSystemMetrics] --> SM_CYCAPTION ');
|
||||||
|
Result := GetTitleBarHeight;
|
||||||
end;
|
end;
|
||||||
SM_CYKANJIWINDOW:
|
SM_CYKANJIWINDOW:
|
||||||
begin
|
begin
|
||||||
|
Loading…
Reference in New Issue
Block a user