mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-30 18:10:27 +02:00
sparta: fix fake menu height for WS other than win32
git-svn-id: trunk@51177 -
This commit is contained in:
parent
c871f99df2
commit
7bb3279fb8
@ -104,6 +104,7 @@ type
|
|||||||
function HorizontalSizerLineLength: Integer;
|
function HorizontalSizerLineLength: Integer;
|
||||||
|
|
||||||
function GetBackgroundMargin(const AIndex: Integer): Integer;
|
function GetBackgroundMargin(const AIndex: Integer): Integer;
|
||||||
|
function GetMenuHeight: Integer;
|
||||||
|
|
||||||
procedure TryBoundDesignedForm;
|
procedure TryBoundDesignedForm;
|
||||||
public
|
public
|
||||||
@ -266,7 +267,7 @@ begin
|
|||||||
LCanvas := (Sender as TPanel).Canvas;
|
LCanvas := (Sender as TPanel).Canvas;
|
||||||
LCanvas.Brush.Color := clMenuBar;
|
LCanvas.Brush.Color := clMenuBar;
|
||||||
MenuRect := (Sender as TPanel).ClientRect;
|
MenuRect := (Sender as TPanel).ClientRect;
|
||||||
MenuRect.Bottom := MenuRect.Top + LCLIntf.GetSystemMetrics(SM_CYMENU);
|
MenuRect.Bottom := MenuRect.Top + GetMenuHeight;
|
||||||
LCanvas.FillRect(MenuRect);
|
LCanvas.FillRect(MenuRect);
|
||||||
LCanvas.Font.Color := clMenuText;
|
LCanvas.Font.Color := clMenuText;
|
||||||
|
|
||||||
@ -729,7 +730,22 @@ begin
|
|||||||
Result := FBackground.GetMargin(AIndex);
|
Result := FBackground.GetMargin(AIndex);
|
||||||
|
|
||||||
if (AIndex = 1) and HasMainMenu then
|
if (AIndex = 1) and HasMainMenu then
|
||||||
Result := Result + LCLIntf.GetSystemMetrics(SM_CYMENU);
|
Result := Result + GetMenuHeight;
|
||||||
|
end;
|
||||||
|
|
||||||
|
function TResizerFrame.GetMenuHeight: Integer;
|
||||||
|
begin
|
||||||
|
// some WS (Gtk2) return too big SM_CYMENU, just set it according to font height
|
||||||
|
// no problem, it is used only for the fake main menu
|
||||||
|
|
||||||
|
{$IFDEF LCLWin32}
|
||||||
|
Result := lclintf.GetSystemMetrics(SM_CYMENU);
|
||||||
|
{$ELSE}
|
||||||
|
if pBG.HandleAllocated then
|
||||||
|
Result := pBG.Canvas.TextHeight('Hg') * 4 div 3
|
||||||
|
else
|
||||||
|
Result := 20;
|
||||||
|
{$ENDIF}
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TResizerFrame.TryBoundDesignedForm;
|
procedure TResizerFrame.TryBoundDesignedForm;
|
||||||
|
Loading…
Reference in New Issue
Block a user