LCL-GTK2: Revert r59192 #fe117548f3 and prevent the Gtk-WARNING in a better way. Issue #34352, patch from accorp.

git-svn-id: trunk@59194 -
This commit is contained in:
juha 2018-09-30 15:57:05 +00:00
parent 9bf572e8e2
commit e07ac1935a
2 changed files with 32 additions and 4 deletions

View File

@ -788,10 +788,7 @@ begin
if (SizeConstraints.Control=nil) then exit;
if (SizeConstraints.Control is TGroupBox) then begin
MinWidth:=10;
end
else if SizeConstraints.Control is TScrollBar then begin
if SizeConstraints.Control is TScrollBar then begin
// TScrollBar
if TScrollBar(SizeConstraints.Control).Kind=sbHorizontal then begin
Widget:=GetStyleWidget(lgsHorizontalScrollbar);

View File

@ -91,6 +91,7 @@ type
WithThemeSpace: Boolean); override;
class procedure SetFont(const AWinControl: TWinControl; const AFont: TFont); override;
class procedure SetText(const AWinControl: TWinControl; const AText: string); override;
class procedure SetBounds(const AWinControl: TWinControl; const ALeft, ATop, AWidth, AHeight: Integer); override;
end;
{ TGtk2WSGroupBox }
@ -2444,6 +2445,36 @@ begin
SetLabel(GetFrameWidget({%H-}PGtkEventBox(AWinControl.Handle)), AText);
end;
class procedure TGtk2WSCustomGroupBox.SetBounds(const AWinControl: TWinControl;
const ALeft, ATop, AWidth, AHeight: Integer);
var
GroubBox: TCustomGroupBox absolute AWinControl;
Frame: PGtkFrame;
Lbl: PGtkWidget;
MinWidth: NativeInt;
begin
Frame := GetFrameWidget({%H-}PGTKEventBox(AWinControl.Handle));
Lbl := gtk_frame_get_label_widget(Frame);
if Lbl <> nil then
begin
MinWidth := Lbl^.allocation.x * 2;
if AWidth < MinWidth then
begin
SetText(AWinControl, '');
g_object_set_data(PGObject(Frame), 'lcl-groupbox-min-width', {%H-}gPointer(MinWidth));
end;
end
else if GroubBox.Caption <> '' then
begin
{%H-}gPointer(MinWidth) := g_object_get_data(PGObject(Frame), 'lcl-groupbox-min-width');
if (MinWidth > 0) and (AWidth >= MinWidth) then begin
SetText(AWinControl, GroubBox.Caption);
g_object_set_data(PGObject(Frame), 'lcl-groupbox-min-width', nil);
end;
end;
TGtk2WSWinControl.SetBounds(AWinControl, ALeft, ATop, AWidth, AHeight);
end;
function Gtk2WSButton_Clicked(AWidget: PGtkWidget; AInfo: PWidgetInfo): GBoolean; cdecl;
var
Msg: TLMessage;