LCL: Docked-Designer, FakeMenu-Toolbar, layout

This commit is contained in:
Martin 2024-12-28 17:21:32 +01:00
parent ce20675a1b
commit afe87b6e8c
2 changed files with 20 additions and 13 deletions

View File

@ -40,7 +40,7 @@ uses
// RTL, FCL
Classes, SysUtils, math,
// LCL
Controls, ComCtrls, ExtCtrls, Graphics, Menus;
Controls, ComCtrls, ExtCtrls, Graphics, Menus, Toolwin;
type
@ -606,9 +606,15 @@ begin
FResizeBars.Parent := Parent;
FFakeMenu := TToolBar.Create(Parent);
FFakeMenu.ParentFont := False;
FFakeMenu.Orientation := tboHorizontal;
FFakeMenu.EdgeBorders := [];
FFakeMenu.EdgeInner := esNone;
FFakeMenu.EdgeOuter := esNone;
FFakeMenu.Height := 0;
FFakeMenu.Parent := Parent;
FFakeMenu.Align := alNone;
FFakeMenu.AutoSize := True;
FFakeMenu.Indent := 0;
FFormClient := TWinControl.Create(Parent);
@ -647,11 +653,18 @@ begin
end;
procedure TResizeContainer.SetBounds(ALeft, ATop, AWidth, AHeight: Integer);
var
w: Integer;
begin
FBoundsRect := Rect(ALeft, ATop, ALeft + AWidth, ATop + AHeight);
FResizeGrips.SetBounds(FBoundsRect);
FResizeBars.SetBounds(FBoundsRect);
FFakeMenu.SetBounds(ALeft + FResizeBars.BarSize, ATop + FResizeBars.BarSize, AWidth - FResizeBars.BarSize * 2, FFakeMenu.Height);
w := Max(0, AWidth - FResizeBars.BarSize * 2);
FFakeMenu.Visible := w > 0;
FFakeMenu.Constraints.MinWidth := w;
FFakeMenu.Constraints.MaxWidth := w;
FFakeMenu.Top := ATop + FResizeBars.BarSize;
FFakeMenu.Left := ALeft + FResizeBars.BarSize;
FFormClient.SetBounds(ALeft + FResizeBars.BarSize, ATop + FResizeBars.BarSize + FFakeMenu.Height, AWidth - FResizeBars.BarSize * 2, AHeight - FResizeBars.BarSize * 2 - FFakeMenu.Height);
FAnchorContainer.SetBounds(ALeft + FResizeBars.BarSize, ATop + FResizeBars.BarSize + FFakeMenu.Height, AWidth - FResizeBars.BarSize * 2, AHeight - FResizeBars.BarSize * 2 - FFakeMenu.Height);
end;

View File

@ -344,19 +344,13 @@ end;
procedure TResizeControl.TryBoundDesignForm;
var
i, t: Integer;
f: Boolean;
begin
if DesignForm = nil then Exit;
if FakeMenuNeeded then
begin
FakeMenu.ButtonHeight := DesignForm.MainMenuHeight;
t := 0;
for i := 0 to FakeMenu.ComponentCount - 1 do //For multi-line MainMenu
if FakeMenu.Components[i] is TSpeedButton then
if t < TSpeedButton(FakeMenu.Components[i]).Top then t := TSpeedButton(FakeMenu.Components[i]).Top;
FakeMenu.Height := t + FakeMenu.ButtonHeight;
FakeMenu.Update;
end else FakeMenu.Height := 0;
f := FakeMenuNeeded;
FakeMenu.AutoSize := f;
if not f then
FakeMenu.Height := 0;
end;
constructor TResizeControl.Create(TheOwner: TComponent);