Class FontDialogButton

All Implemented Interfaces:
Accessible, Buildable, ConstraintTarget, Proxy

@Generated("org.javagi.JavaGI") public class FontDialogButton extends Widget implements Accessible, Buildable, ConstraintTarget

Opens a font chooser dialog to select a font.

An example GtkFontDialogButton

It is suitable widget for selecting a font in a preference dialog.

CSS nodes

fontbutton
╰── button.font
    ╰── [content]

GtkFontDialogButton has a single CSS node with name fontbutton which contains a button node with the .font style class.

Since:
4.10
  • Constructor Details

    • FontDialogButton

      public FontDialogButton(MemorySegment address)
      Create a FontDialogButton instance for the provided memory address.
      Parameters:
      address - the memory address of the native object
    • FontDialogButton

      public FontDialogButton(@Nullable FontDialog dialog)

      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 - the GtkFontDialog to use
      Since:
      4.10
    • FontDialogButton

      public FontDialogButton()
      Create a new FontDialogButton.
  • Method Details

    • getType

      public static @Nullable Type getType()
      Get the GType of the FontDialogButton class.
      Returns:
      the GType
    • getMemoryLayout

      public static MemoryLayout getMemoryLayout()
      The memory layout of the native struct.
      Returns:
      the memory layout
    • asParent

      protected FontDialogButton asParent()
      Return this instance as if it were its parent type. Comparable to the Java super keyword, but ensures the parent typeclass is also used in native code.
      Overrides:
      asParent in class Widget
      Returns:
      the instance as if it were its parent type
    • getDialog

      public @Nullable FontDialog getDialog()
      Returns the GtkFontDialog of self.
      Returns:
      the GtkFontDialog
      Since:
      4.10
    • getFontDesc

      public @Nullable FontDescription getFontDesc()

      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".

      Returns:
      the font
      Since:
      4.10
    • getFontFeatures

      public @Nullable String getFontFeatures()

      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 Gtk.FontDialogButton:level is set to GTK_FONT_LEVEL_FEATURES.

      Returns:
      the font features
      Since:
      4.10
    • getLanguage

      public @Nullable Language getLanguage()
      Returns the language that is used for font features.
      Returns:
      the language
      Since:
      4.10
    • getLevel

      public FontLevel getLevel()
      Returns the level of detail at which this dialog lets the user select fonts.
      Returns:
      the level of detail
      Since:
      4.10
    • getUseFont

      public boolean getUseFont()
      Returns whether the selected font is used in the label.
      Returns:
      whether the selected font is used in the label
      Since:
      4.10
    • getUseSize

      public boolean getUseSize()
      Returns whether the selected font size is used in the label.
      Returns:
      whether the selected font size is used in the label
      Since:
      4.10
    • setDialog

      public void setDialog(FontDialog 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 new GtkFontDialog
      Since:
      4.10
    • setFontDesc

      public void setFontDesc(FontDescription fontDesc)
      Sets the font of the button.
      Parameters:
      fontDesc - the new font
      Since:
      4.10
    • setFontFeatures

      public void setFontFeatures(@Nullable String fontFeatures)
      Sets the font features of the button.
      Parameters:
      fontFeatures - the font features
      Since:
      4.10
    • setLanguage

      public void setLanguage(@Nullable Language language)
      Sets the language to use for font features.
      Parameters:
      language - the new language
      Since:
      4.10
    • setLevel

      public void setLevel(FontLevel level)
      Sets the level of detail at which this dialog lets the user select fonts.
      Parameters:
      level - the level of detail
      Since:
      4.10
    • setUseFont

      public void setUseFont(boolean useFont)
      If useFont is TRUE, the font name will be written using the selected font.
      Parameters:
      useFont - If TRUE, font name will be written using the chosen font
      Since:
      4.10
    • setUseSize

      public void setUseSize(boolean useSize)
      If useSize is TRUE, the font name will be written using the selected font size.
      Parameters:
      useSize - If TRUE, font name will be written using the chosen font size
      Since:
      4.10
    • onActivate

      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.

      Parameters:
      handler - the signal handler
      Returns:
      a signal handler ID to keep track of the signal connection
      Since:
      4.14
      See Also:
    • emitActivate

      public void emitActivate()
      Emits the "activate" signal. See onActivate(FontDialogButton.ActivateCallback).
    • builder

      public static FontDialogButton.Builder<? extends FontDialogButton.Builder> builder()
      A FontDialogButton.Builder object constructs a FontDialogButton with the specified properties. Use the various set...() methods to set properties, and finish construction with FontDialogButton.Builder.build().
      Returns:
      the builder object