mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-11-02 03:19:36 +01:00
LCL-Gtk2: fixed centering of multiline captions for TButton, TToggleBox and TBitBtn, issue #41696
This commit is contained in:
parent
66fcf7cad5
commit
305c953532
@ -169,6 +169,8 @@ begin
|
||||
if ImageWidget <> nil then
|
||||
g_object_unref(ImageWidget);
|
||||
|
||||
if LabelWidget <> nil then
|
||||
gtk_label_set_justify(PGtkLabel(LabelWidget), GTK_JUSTIFY_CENTER);
|
||||
ABitBtnInfo^.LabelWidget := LabelWidget;
|
||||
end;
|
||||
|
||||
|
||||
@ -350,6 +350,7 @@ type
|
||||
TGtk2WSToggleBox = class(TWSToggleBox)
|
||||
published
|
||||
class function CreateHandle(const AWinControl: TWinControl; const AParams: TCreateParams): TLCLHandle; override;
|
||||
class procedure SetFont(const AWinControl: TWinControl; const AFont: TFont); override;
|
||||
end;
|
||||
|
||||
{ TGtk2WSRadioButton }
|
||||
@ -2563,6 +2564,7 @@ begin
|
||||
|
||||
{ Creates the button and inserts it into the EventBox }
|
||||
BtnWidget := gtk_button_new_with_label('button');
|
||||
gtk_label_set_justify(PGtkLabel(PGtkBin(BtnWidget)^.Child), GTK_JUSTIFY_CENTER);
|
||||
gtk_container_add(PGtkContainer(EventBox), BtnWidget);
|
||||
gtk_widget_show_all(EventBox);
|
||||
|
||||
@ -2885,6 +2887,20 @@ begin
|
||||
TGtk2WSCustomCheckBox.SetCallbacks(Widget, WidgetInfo);
|
||||
end;
|
||||
|
||||
class procedure TGtk2WSToggleBox.SetFont(const AWinControl: TWinControl;
|
||||
const AFont: TFont);
|
||||
var
|
||||
LblWidget: PGtkWidget;
|
||||
begin
|
||||
if not AWinControl.HandleAllocated then exit;
|
||||
|
||||
inherited SetFont(AWinControl, AFont);
|
||||
|
||||
LblWidget := PGtkBin({%H-}PGtkWidget(AWinControl.Handle))^.Child;
|
||||
if LblWidget <> nil then
|
||||
gtk_label_set_justify(PGtkLabel(LblWidget), GTK_JUSTIFY_CENTER);
|
||||
end;
|
||||
|
||||
{ TGtk2WSCustomStaticText }
|
||||
|
||||
class function TGtk2WSCustomStaticText.GetLabelWidget(AFrame: PGtkFrame): PGtkLabel;
|
||||
|
||||
Loading…
Reference in New Issue
Block a user