mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-04-19 10:09:29 +02:00
Revert "LCL: Fix Toolbar size when inside a Controlbar". Causes ChangeBounds loop in a bottom anchored Toolbar with GTK2.
This commit is contained in:
parent
4b19396ac4
commit
b02bb3563b
@ -133,13 +133,8 @@ begin
|
|||||||
end;
|
end;
|
||||||
|
|
||||||
function TCustomControlBar.CalcBandHeightSnapped(AControl: TControl): Integer;
|
function TCustomControlBar.CalcBandHeightSnapped(AControl: TControl): Integer;
|
||||||
var
|
|
||||||
rowsz : integer;
|
|
||||||
rows : integer;
|
|
||||||
begin
|
begin
|
||||||
rowsz := RowSize;
|
Result := (1 + trunc((AControl.Height + 2 * cBandBorderV) div RowSize)) * RowSize;
|
||||||
rows := (AControl.Height - (2 * cBandBorderV) + (rowsz-1)) div rowsz;
|
|
||||||
Result := rows * rowsz;
|
|
||||||
end;
|
end;
|
||||||
|
|
||||||
function TCustomControlBar.CalcInnerBevelWidth: Integer;
|
function TCustomControlBar.CalcInnerBevelWidth: Integer;
|
||||||
@ -490,7 +485,7 @@ begin
|
|||||||
for i := 0 to ControlCount - 1 do begin
|
for i := 0 to ControlCount - 1 do begin
|
||||||
aBand := TCtrlBand.Create;
|
aBand := TCtrlBand.Create;
|
||||||
aBand.Control := Controls[i];
|
aBand.Control := Controls[i];
|
||||||
aBand.Height := CalcBandHeight(aBand.Control);
|
aBand.Height := CalcBandHeight(Controls[i]);
|
||||||
aBand.Width := cFullGrabber + Controls[i].Width + cBandBorderH;
|
aBand.Width := cFullGrabber + Controls[i].Width + cBandBorderH;
|
||||||
aBand.Top := Controls[i].Top - (aBand.Height - Controls[i].Height) div 2;
|
aBand.Top := Controls[i].Top - (aBand.Height - Controls[i].Height) div 2;
|
||||||
aBand.Left := Controls[i].Left - aIndent;
|
aBand.Left := Controls[i].Left - aIndent;
|
||||||
|
@ -599,7 +599,6 @@ end;
|
|||||||
procedure TToolBar.DoAutoSize;
|
procedure TToolBar.DoAutoSize;
|
||||||
begin
|
begin
|
||||||
// children are moved in ControlsAligned independent of AutoSize=true
|
// children are moved in ControlsAligned independent of AutoSize=true
|
||||||
inherited DoAutoSize; // needed for autosizing toolbar in controlbar bands
|
|
||||||
end;
|
end;
|
||||||
|
|
||||||
function TToolBar.DropDownWidthIsStored: Boolean;
|
function TToolBar.DropDownWidthIsStored: Boolean;
|
||||||
|
@ -874,25 +874,14 @@ begin
|
|||||||
inherited GetPreferredSize(PreferredWidth, PreferredHeight, Raw, WithThemeSpace);
|
inherited GetPreferredSize(PreferredWidth, PreferredHeight, Raw, WithThemeSpace);
|
||||||
|
|
||||||
if FToolbar = nil then Exit;
|
if FToolbar = nil then Exit;
|
||||||
|
|
||||||
RealButtonWidth := FToolbar.ButtonWidth;
|
RealButtonWidth := FToolbar.ButtonWidth;
|
||||||
RealButtonHeight := FToolbar.ButtonHeight;
|
RealButtonHeight := FToolbar.ButtonHeight;
|
||||||
if RealButtonHeight <= 0 then Exit;
|
if RealButtonHeight <= 0 then Exit;
|
||||||
|
// buttonheight overrules in hor toolbar
|
||||||
if (AutoSize) then begin
|
if FToolBar.IsVertical then
|
||||||
// why FToolbar overrides prefered size?
|
PreferredWidth := RealButtonWidth
|
||||||
if FToolBar.IsVertical then
|
else
|
||||||
PreferredWidth := max( PreferredWidth, RealButtonWidth )
|
PreferredHeight := RealButtonHeight;
|
||||||
else
|
|
||||||
PreferredHeight := max( PreferredHeight, RealButtonHeight );
|
|
||||||
end
|
|
||||||
else begin
|
|
||||||
if FToolBar.IsVertical then
|
|
||||||
PreferredWidth := RealButtonWidth
|
|
||||||
else
|
|
||||||
PreferredHeight:= RealButtonHeight;
|
|
||||||
end;
|
|
||||||
|
|
||||||
end;
|
end;
|
||||||
|
|
||||||
function TToolButton.IsWidthStored: Boolean;
|
function TToolButton.IsWidthStored: Boolean;
|
||||||
|
Loading…
Reference in New Issue
Block a user