mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-16 20:09:10 +02:00
Gtk2: fixed font changing on readonly combobox, issue #18206
git-svn-id: trunk@28704 -
This commit is contained in:
parent
f2083e28d4
commit
2d8d01da6c
@ -137,6 +137,8 @@ type
|
|||||||
class procedure SetColor(const AWinControl: TWinControl); override;
|
class procedure SetColor(const AWinControl: TWinControl); override;
|
||||||
class procedure SetFont(const AWinControl: TWinControl; const AFont: TFont); override;
|
class procedure SetFont(const AWinControl: TWinControl; const AFont: TFont); override;
|
||||||
class procedure SetText(const AWinControl: TWinControl; const AText: String); override;
|
class procedure SetText(const AWinControl: TWinControl; const AText: String); override;
|
||||||
|
|
||||||
|
class procedure ShowHide(const AWinControl: TWinControl); override;
|
||||||
|
|
||||||
class function CanFocus(const AWinControl: TWinControl): boolean; override;
|
class function CanFocus(const AWinControl: TWinControl): boolean; override;
|
||||||
|
|
||||||
@ -1826,6 +1828,7 @@ class procedure TGtk2WSCustomComboBox.SetFont(const AWinControl: TWinControl;
|
|||||||
var
|
var
|
||||||
Entry: PGtkEntry;
|
Entry: PGtkEntry;
|
||||||
WidgetInfo: PWidgetInfo;
|
WidgetInfo: PWidgetInfo;
|
||||||
|
W: PGtkWidget;
|
||||||
begin
|
begin
|
||||||
if not AWinControl.HandleAllocated then exit;
|
if not AWinControl.HandleAllocated then exit;
|
||||||
|
|
||||||
@ -1837,6 +1840,15 @@ begin
|
|||||||
Gtk2WidgetSet.SetWidgetColor(PGtkWidget(Entry), AFont.Color, clNone,
|
Gtk2WidgetSet.SetWidgetColor(PGtkWidget(Entry), AFont.Color, clNone,
|
||||||
[GTK_STATE_NORMAL,GTK_STATE_ACTIVE,GTK_STATE_PRELIGHT,GTK_STATE_SELECTED,GTK_STYLE_TEXT]);
|
[GTK_STATE_NORMAL,GTK_STATE_ACTIVE,GTK_STATE_PRELIGHT,GTK_STATE_SELECTED,GTK_STYLE_TEXT]);
|
||||||
Gtk2WidgetSet.SetWidgetFont(PGtkWidget(Entry), AFont);
|
Gtk2WidgetSet.SetWidgetFont(PGtkWidget(Entry), AFont);
|
||||||
|
end else
|
||||||
|
begin
|
||||||
|
W := GTK_BIN(WidgetInfo^.CoreWidget)^.child;
|
||||||
|
if W <> nil then
|
||||||
|
begin
|
||||||
|
Gtk2WidgetSet.SetWidgetColor(W, AFont.Color, clNone,
|
||||||
|
[GTK_STATE_NORMAL,GTK_STATE_ACTIVE,GTK_STATE_PRELIGHT,GTK_STATE_SELECTED,GTK_STYLE_TEXT]);
|
||||||
|
Gtk2WidgetSet.SetWidgetFont(W, AFont);
|
||||||
|
end;
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
@ -1865,6 +1877,16 @@ begin
|
|||||||
Dec(WidgetInfo^.ChangeLock);
|
Dec(WidgetInfo^.ChangeLock);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
class procedure TGtk2WSCustomComboBox.ShowHide(const AWinControl: TWinControl);
|
||||||
|
begin
|
||||||
|
// gtk2 doesn't set font on readonly combobox properly
|
||||||
|
// so we are doing it one more time before showing.
|
||||||
|
if AWinControl.HandleObjectShouldBeVisible and
|
||||||
|
TCustomComboBox(AWinControl).ReadOnly then
|
||||||
|
SetFont(AWinControl, AWinControl.Font);
|
||||||
|
inherited ShowHide(AWinControl);
|
||||||
|
end;
|
||||||
|
|
||||||
class function TGtk2WSCustomComboBox.CanFocus(const AWinControl: TWinControl
|
class function TGtk2WSCustomComboBox.CanFocus(const AWinControl: TWinControl
|
||||||
): boolean;
|
): boolean;
|
||||||
var
|
var
|
||||||
|
Loading…
Reference in New Issue
Block a user