Next: , Previous: GtkFileFilter, Up: Top


86 GtkFontButton

A button to launch a font selection dialog

86.1 Overview

The <gtk-font-button> is a button which displays the currently selected font an allows to open a font selection dialog to change the font. It is suitable widget for selecting a font in a preference dialog.

86.2 Usage

— Class: <gtk-font-button>

Derives from <gtk-button>.

This class defines the following slots:

title
The title of the font selection dialog
font-name
The name of the selected font
use-font
Whether the label is drawn in the selected font
use-size
Whether the label is drawn with the selected font size
show-style
Whether the selected font style is shown in the label
show-size
Whether selected font size is shown in the label
— Signal on <gtk-font-button>: font-set

The ::font-set signal is emitted when the user selects a font. When handling this signal, use gtk-font-button-get-font-name to find out which font was just selected.

Note that this signal is only emitted when the user changes the font. If you need to react to programmatic font changes as well, use the notify::font-name signal.

Since 2.4

— Function: gtk-font-button-new ⇒  (ret <gtk-widget>)

Creates a new font picker widget.

ret
a new font picker widget.

Since 2.4

— Function: gtk-font-button-new-with-font (fontname mchars) ⇒  (ret <gtk-widget>)

Creates a new font picker widget.

fontname
Name of font to display in font selection dialog
ret
a new font picker widget.

Since 2.4

— Function: gtk-font-button-set-font-name (self <gtk-font-button>) (fontname mchars) ⇒  (ret bool)
— Method: set-font-name

Sets or updates the currently-displayed font in font picker dialog.

font-button
a <gtk-font-button>
fontname
Name of font to display in font selection dialog
ret
Return value of gtk-font-selection-dialog-set-font-name if the font selection dialog exists, otherwise ‘#f’.

Since 2.4

— Function: gtk-font-button-get-font-name (self <gtk-font-button>) ⇒  (ret mchars)
— Method: get-font-name

Retrieves the name of the currently selected font.

font-button
a <gtk-font-button>
ret
an internal copy of the font name which must not be freed.

Since 2.4

— Function: gtk-font-button-set-show-style (self <gtk-font-button>) (show_style bool)
— Method: set-show-style

If show-style is ‘#t’, the font style will be displayed along with name of the selected font.

font-button
a <gtk-font-button>
show-style
#t’ if font style should be displayed in label.

Since 2.4

— Function: gtk-font-button-get-show-style (self <gtk-font-button>) ⇒  (ret bool)
— Method: get-show-style

Returns whether the name of the font style will be shown in the label.

font-button
a <gtk-font-button>
ret
whether the font style will be shown in the label.

Since 2.4

— Function: gtk-font-button-set-show-size (self <gtk-font-button>) (show_size bool)
— Method: set-show-size

If show-size is ‘#t’, the font size will be displayed along with the name of the selected font.

font-button
a <gtk-font-button>
show-size
#t’ if font size should be displayed in dialog.

Since 2.4

— Function: gtk-font-button-get-show-size (self <gtk-font-button>) ⇒  (ret bool)
— Method: get-show-size

Returns whether the font size will be shown in the label.

font-button
a <gtk-font-button>
ret
whether the font size will be shown in the label.

Since 2.4

— Function: gtk-font-button-set-use-font (self <gtk-font-button>) (use_font bool)
— Method: set-use-font

If use-font is ‘#t’, the font name will be written using the selected font.

font-button
a <gtk-font-button>
use-font
If ‘#t’, font name will be written using font chosen.

Since 2.4

— Function: gtk-font-button-get-use-font (self <gtk-font-button>) ⇒  (ret bool)
— Method: get-use-font

Returns whether the selected font is used in the label.

font-button
a <gtk-font-button>
ret
whether the selected font is used in the label.

Since 2.4

— Function: gtk-font-button-set-use-size (self <gtk-font-button>) (use_size bool)
— Method: set-use-size

If use-size is ‘#t’, the font name will be written using the selected size.

font-button
a <gtk-font-button>
use-size
If ‘#t’, font name will be written using the selected size.

Since 2.4

— Function: gtk-font-button-get-use-size (self <gtk-font-button>) ⇒  (ret bool)
— Method: get-use-size

Returns whether the selected size is used in the label.

font-button
a <gtk-font-button>
ret
whether the selected size is used in the label.

Since 2.4

— Function: gtk-font-button-set-title (self <gtk-font-button>) (title mchars)
— Method: set-title

Sets the title for the font selection dialog.

font-button
a <gtk-font-button>
title
a string containing the font selection dialog title

Since 2.4

— Function: gtk-font-button-get-title (self <gtk-font-button>) ⇒  (ret mchars)
— Method: get-title

Retrieves the title of the font selection dialog.

font-button
a <gtk-font-button>
ret
an internal copy of the title string which must not be freed.

Since 2.4