Gtk.FontDialogButton¶
class — extends Widget, Accessible, Buildable, ConstraintTarget
Opens a font chooser dialog to select a font.
<picture> <source srcset="font-button-dark.png" media="(prefers-color-scheme: dark)"> <img alt="An example GtkFontDialogButton" src="font-button.png"> </picture>
It is suitable widget for selecting a font in a preference dialog.
CSS nodes¶
GtkFontDialogButton has a single CSS node with name fontbutton which
contains a button node with the .font style class.
Constructors¶
new¶
Creates a new GtkFontDialogButton with the
given GtkFontDialog.
You can pass NULL to this function and set a GtkFontDialog
later. The button will be insensitive until that happens.
Parameters:
dialog— theGtkFontDialogto use
Methods¶
get_dialog¶
Returns the GtkFontDialog of self.
get_font_desc¶
Returns the font of the button.
This function is what should be used to obtain the font that was chosen by the user. To get informed about changes, listen to "notify::font-desc".
get_font_features¶
Returns the font features of the button.
This function is what should be used to obtain the font features that were chosen by the user. To get informed about changes, listen to "notify::font-features".
Note that the button will only let users choose font features
if FontDialogButton.level is set to
GTK_FONT_LEVEL_FEATURES.
get_language¶
Returns the language that is used for font features.
get_level¶
Returns the level of detail at which this dialog lets the user select fonts.
get_use_font¶
Returns whether the selected font is used in the label.
get_use_size¶
Returns whether the selected font size is used in the label.
set_dialog¶
Sets a GtkFontDialog object to use for
creating the font chooser dialog that is
presented when the user clicks the button.
Parameters:
dialog— the newGtkFontDialog
set_font_desc¶
Sets the font of the button.
Parameters:
font_desc— the new font
set_font_features¶
Sets the font features of the button.
Parameters:
font_features— the font features
set_language¶
Sets the language to use for font features.
Parameters:
language— the new language
set_level¶
Sets the level of detail at which this dialog lets the user select fonts.
Parameters:
level— the level of detail
set_use_font¶
If use_font is TRUE, the font name will be written
using the selected font.
Parameters:
use_font— IfTRUE, font name will be written using the chosen font
set_use_size¶
If use_size is TRUE, the font name will be written
using the selected font size.
Parameters:
use_size— IfTRUE, font name will be written using the chosen font size
Properties¶
dialog¶
The GtkFontDialog that contains parameters for
the font chooser dialog.
font_desc¶
The selected font.
This property can be set to give the button its initial font, and it will be updated to reflect the users choice in the font chooser dialog.
Listen to notify::font-desc to get informed about changes
to the buttons font.
font_features¶
The selected font features.
This property will be updated to reflect the users choice in the font chooser dialog.
Listen to notify::font-features to get informed about changes
to the buttons font features.
language¶
The selected language for font features.
This property will be updated to reflect the users choice in the font chooser dialog.
Listen to notify::language to get informed about changes
to the buttons language.
level¶
The level of detail for the font chooser dialog.
use_font¶
Whether the buttons label will be drawn in the selected font.
use_size¶
Whether the buttons label will use the selected font size.
Signals¶
activate¶
Emitted when the font dialog button is activated.
The ::activate signal on GtkFontDialogButton is an action signal
and emitting it causes the button to pop up its dialog.