Class Index Cross Index Namespace Index

Class Gtk::FontSelectionDialog

A dialog box for selecting fonts.
Contained in: Gtk
Derived from: Window
Derived by: none

#include <gtk--/fontselection.h>


public function member index:

FontSelectionDialog(const nstring& title=(char*)0);
Button* get_apply_button() const;
Button* get_cancel_button() const;
Gdk_Font get_font() const;
nstring get_font_name() const;
FontSelection* get_font_selection() const;
Button* get_ok_button() const;
string get_preview_text() const;
GtkFontSelectionDialog* gtkobj();
const GtkFontSelectionDialog* 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 ~FontSelectionDialog();
 

Description:

The Gtk::FontSelectionDialog widget is a dialog box for selecting a font.

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::FontSelectionDialog - 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 dialog.


Function Member Descriptions:

Gtk::FontSelectionDialog::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::FontSelectionDialog::get_font_name - Gets the currently-selected font name.

nstring get_font_name() const;
Returns: The currently-selected font name, or NULL if no font is selected.


Gtk::FontSelectionDialog::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::FontSelectionDialog::gtkobj - Returns the underlaying gtk+ object.

GtkFontSelectionDialog* gtkobj();

Gtk::FontSelectionDialog::isA - Returns true if object is this type.

static bool isA(Object* object);

Gtk::FontSelectionDialog::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::FontSelectionDialog::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::FontSelectionDialog::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.