Gtk-- Reference: Gtk::FontSelection

Class Index | Cross Index | Namespace Index

# Class Gtk::FontSelection

A widget for selecting fonts.
Contained in: Gtk
Derived from: Gtk::Notebook
Derived by: none

#include <gtk--/fontselection.h>

### public function member index:
`` | `FontSelection` | `()`;
``Entry`*` | `get_actual_font_name` | `() `const``;
``Box`*` | `get_filter_box` | `() `const``;
``Button`*` | `get_filter_button` | `() `const``;
``CList`*` | `get_filter_list` | `(`PropertyType` `p`)`;
``Gdk_Font`` | `get_font` | `() `const``;
``Box`*` | `get_font_box` | `() `const``;
``Entry`*` | `get_font_entry` | `() `const``;
``Label`*` | `get_font_label` | `() `const``;
``CList`*` | `get_font_list` | `() `const``;
``string`` | `get_font_name` | `() `const``;
``Entry`*` | `get_font_style_entry` | `() `const``;
``CList`*` | `get_font_style_list` | `() `const``;
``Box`*` | `get_info_box` | `() `const``;
``CList`*` | `get_info_list` | `() `const``;
``Label`*` | `get_message_label` | `() `const``;
``RadioButton`*` | `get_pixels_button` | `() `const``;
``RadioButton`*` | `get_points_button` | `() `const``;
``Entry`*` | `get_preview_entry` | `() `const``;
``string`` | `get_preview_text` | `() `const``;
``Entry`*` | `get_requested_font_name` | `() `const``;
``Entry`*` | `get_size_entry` | `() `const``;
``CList`*` | `get_size_list` | `() `const``;
``CheckButton`*` | `get_type_bitmaps_button` | `() `const``;
``CheckButton`*` | `get_type_scalable_button` | `() `const``;
``CheckButton`*` | `get_type_scaled_bitmaps_button` | `() `const``;
``GtkFontSelection`*` | `gtkobj` | `()`;
``const` `GtkFontSelection`*` | `gtkobj` | `() `const``;
``static` `bool`` | `isA` | `(`Object`* `object`)`;
``void`` | `set_filter` | `(`GtkFontFilterType` `filter_type`, `GtkFontType` `font_type`, `const` `SArray`& `foundries`, `const` `SArray`& `weights`, `const` `SArray`& `slants`, `const` `SArray`& `setwidths`, `const` `SArray`& `spacings`, `const` `SArray`& `charsets`)`;
``bool`` | `set_font_name` | `(`const` `string`& `fontname`)`;
``void`` | `set_preview_text` | `(`const` `string`& `fontname`)`;
``virtual`` | `~FontSelection` | `()`;

## Description:

The `Gtk::FontSelection` widget lists the available fonts, styles and sizes, allowing the user to select a font. It is used in the `Gtk::FontSelectionDialog` widget to provide a dialog box for selecting fonts.

To set the font which is initially selected, use `set_font_name`.

To get the selected font use `get_font` or `get_font_name`.

To change the text which is shown in the preview area, use `set_preview_text`.

Filters can be used to limit the fonts shown. There are 2 filters in the `Gtk::FontSelection` - a base filter and a user filter. The base filter can not be changed by the user, so this can be used when the user must choose from the restricted set of fonts (e.g. for a terminal-type application you may want to force the user to select a fixed-width font). The user filter can be changed or reset by the user, by using the 'Reset Filter' button or changing the options on the 'Filter' page of the widget.

## Function Member Descriptions:

Gtk::FontSelection::get_font - Gets the currently-selected font.

``Gdk_Font`` `get_font``() `const``;

> Returns: The currently-selected font, or NULL if no font is selected.

Gtk::FontSelection::get_font_name - Gets the currently-selected font name.

``string`` `get_font_name``() `const``;
Gtk::FontSelection::get_preview_text - Gets the text displayed in the preview area.

``string`` `get_preview_text``() `const``;

> Returns: The text displayed in the preview area.

Gtk::FontSelection::gtkobj - Returns the underlaying gtk+ object.

``GtkFontSelection`*` `gtkobj``()`;
Gtk::FontSelection::isA - Returns true if object is this type.

``static` `bool`` `isA``(`Object`* `object`)`;
Gtk::FontSelection::set_filter - Sets one of the two font filters, to limit the fonts shown.

``void`` `set_filter``(`GtkFontFilterType` `filter_type`, `GtkFontType` `font_type`, `const` `SArray`& `foundries`, `const` `SArray`& `weights`, `const` `SArray`& `slants`, `const` `SArray`& `setwidths`, `const` `SArray`& `spacings`, `const` `SArray`& `charsets`)`;

> filter_type: Which of the two font filters to set, either `GTK_FONT_FILTER_BASE` or `GTK_FONT_FILTER_USER`. The user filter can be changed by the user, but the base filter is permanent.

> font_type: The types of font to be shown. This is a bitwise combination of `GTK_FONT_BITMAP`, `GTK_FONT_SCALABLE` and `GTK_FONT_SCALABLE_BITMAP`, or `GTK_FONT_ALL` to show all three font types.

> foundries: A NULL-terminated array of strings containing foundry names which will be shown, or NULL to show all foundries.

> weights: A NULL-terminated array of strings containing weight names which will be shown, or NULL to show all weights.

> slants: A NULL-terminated array of strings containing slant names which will be shown, or NULL to show all slants.

> setwidths: A NULL-terminated array of strings containing setwidth names which will be shown, or NULL to show all setwidths.

> spacings: A NULL-terminated array of strings containing spacings which will be shown, or NULL to show all spacings.

> charsets: A NULL-terminated array of strings containing charset names which will be shown, or NULL to show all charsets.

Gtk::FontSelection::set_font_name - Sets the currently-selected font.

``bool`` `set_font_name``(`const` `string`& `fontname`)`;

> fontname: A fontname.

> Returns: TRUE if the font was found.

Gtk::FontSelection::set_preview_text - Sets the text displayed in the preview area.

``void`` `set_preview_text``(`const` `string`& `fontname`)`;

> text: The text to display in the preview area.