mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-17 19:39:18 +02:00
LCL: gtk2: started fixing TGtk2WSCustomGroupBox.GetPreferredSize
git-svn-id: trunk@48432 -
This commit is contained in:
parent
023bd23bb0
commit
23f22ed784
@ -7988,7 +7988,7 @@ procedure TWinControl.CalculatePreferredSize(var PreferredWidth,
|
||||
if not aControl.IsVisible then exit;
|
||||
if aControl<>Self then begin
|
||||
aControl.GetPreferredSize(w,h,true,true);
|
||||
debugln([Prefix,'W ',DbgSName(aControl),' ',dbgs(aControl.BoundsRect),' Pref=',w,'x',h]);
|
||||
debugln([Prefix,'Child ',DbgSName(aControl),' ',dbgs(aControl.BoundsRect),' Pref=',w,'x',h]);
|
||||
end;
|
||||
if aControl is TWinControl then
|
||||
for i:=0 to TWinControl(aControl).ControlCount-1 do
|
||||
@ -7997,7 +7997,7 @@ procedure TWinControl.CalculatePreferredSize(var PreferredWidth,
|
||||
|
||||
function IsVerbose: boolean;
|
||||
begin
|
||||
Result:=(Name='Edit1');
|
||||
Result:=(Name='GroupBox1');
|
||||
end;
|
||||
{$ENDIF}
|
||||
|
||||
|
@ -6408,8 +6408,10 @@ var
|
||||
FixedWidget: PGtkWidget;
|
||||
begin
|
||||
Widget := {%H-}PGtkWidget(AWinControl.Handle);
|
||||
//if AWinControl.Name='OtherInfoGroupBox' then
|
||||
// DebugLn(['GetGTKDefaultWidgetSize ',GetWidgetDebugReport(Widget)]);
|
||||
{$IFDEF VerboseCalculatePreferredSize}
|
||||
if AWinControl.Name='GroupBox1' then
|
||||
DebugLn(['GetGTKDefaultWidgetSize ',GetWidgetDebugReport(Widget)]);
|
||||
{$ENDIF}
|
||||
|
||||
// set size to default
|
||||
gtk_widget_set_size_request(Widget, -1, -1);
|
||||
@ -6418,21 +6420,25 @@ begin
|
||||
PreferredWidth:=Requisition.width;
|
||||
PreferredHeight:=Requisition.height;
|
||||
|
||||
{if AWinControl.Name='OtherInfoGroupBox' then
|
||||
{$IFDEF VerboseCalculatePreferredSize}
|
||||
if AWinControl.Name='GroupBox1' then
|
||||
DebugLn(['GetGTKDefaultWidgetSize Allocation=',Widget^.allocation.x,',',Widget^.allocation.y,',',Widget^.allocation.width,',',Widget^.allocation.height,
|
||||
' requisition=',Widget^.requisition.width,',',Widget^.requisition.height,
|
||||
' PreferredWidth=',PreferredWidth,' PreferredHeight=',PreferredHeight,
|
||||
' WithThemeSpace=',WithThemeSpace]); }
|
||||
' WithThemeSpace=',WithThemeSpace]);
|
||||
{$ENDIF}
|
||||
|
||||
if GtkWidgetIsA(Widget,GTK_TYPE_EVENT_BOX)
|
||||
and (AWinControl.ControlCount>0) then begin
|
||||
// ignore client area (child controls)
|
||||
FixedWidget:=PGtkWidget(GetFixedWidget(Widget));
|
||||
if FixedWidget<>nil then begin
|
||||
{if AWinControl.Name='OtherInfoGroupBox' then
|
||||
{$IFDEF VerboseCalculatePreferredSize}
|
||||
if AWinControl.Name='GroupBox1' then
|
||||
debugln(['GetGTKDefaultWidgetSize Fixed ',
|
||||
' allocation=',FixedWidget^.allocation.x,',',FixedWidget^.allocation.y,',',FixedWidget^.allocation.width,',',FixedWidget^.allocation.height,
|
||||
' requisition=',FixedWidget^.requisition.width,',',FixedWidget^.requisition.height]);}
|
||||
' requisition=',FixedWidget^.requisition.width,',',FixedWidget^.requisition.height]);
|
||||
{$ENDIF}
|
||||
dec(PreferredWidth,Max(0,FixedWidget^.requisition.width));
|
||||
dec(PreferredHeight,Max(0,FixedWidget^.requisition.height));
|
||||
end;
|
||||
@ -6440,8 +6446,10 @@ begin
|
||||
|
||||
// restore size
|
||||
gtk_widget_set_size_request(Widget, AWinControl.Width, AWinControl.Height);
|
||||
//if AWinControl.Name='OtherInfoGroupBox' then
|
||||
// debugln('GetGTKDefaultSize PreferredWidth=',dbgs(PreferredWidth),' PreferredHeight=',dbgs(PreferredHeight));
|
||||
{$IFDEF VerboseCalculatePreferredSize}
|
||||
if AWinControl.Name='GroupBox1' then
|
||||
debugln('GetGTKDefaultSize PreferredWidth=',dbgs(PreferredWidth),' PreferredHeight=',dbgs(PreferredHeight));
|
||||
{$ENDIF}
|
||||
end;
|
||||
|
||||
procedure SendSizeNotificationToLCL(aWidget: PGtkWidget);
|
||||
|
@ -2377,6 +2377,7 @@ class procedure TGtk2WSCustomGroupBox.GetPreferredSize(
|
||||
const AWinControl: TWinControl; var PreferredWidth, PreferredHeight: integer;
|
||||
WithThemeSpace: Boolean);
|
||||
begin
|
||||
// ToDo: compute the minimum size ignoring LCL child controls
|
||||
GetGTKDefaultWidgetSize(AWinControl, PreferredWidth, PreferredHeight,
|
||||
WithThemeSpace);
|
||||
end;
|
||||
|
Loading…
Reference in New Issue
Block a user