FontChooserWidget


Object Hierarchy:

Gtk.FontChooserWidget Gtk.FontChooserWidget Gtk.FontChooserWidget Gtk.Box Gtk.Box Gtk.Box->Gtk.FontChooserWidget Gtk.Container Gtk.Container Gtk.Container->Gtk.Box Gtk.Widget Gtk.Widget Gtk.Widget->Gtk.Container GLib.InitiallyUnowned GLib.InitiallyUnowned GLib.InitiallyUnowned->Gtk.Widget GLib.Object GLib.Object GLib.Object->GLib.InitiallyUnowned Atk.Implementor Atk.Implementor Atk.Implementor->Gtk.FontChooserWidget Atk.Implementor->Gtk.Box Atk.Implementor->Gtk.Container Atk.Implementor->Gtk.Widget Gtk.Buildable Gtk.Buildable Gtk.Buildable->Gtk.FontChooserWidget Gtk.Buildable->Gtk.Box Gtk.Buildable->Gtk.Container Gtk.Buildable->Gtk.Widget Gtk.Orientable Gtk.Orientable Gtk.Orientable->Gtk.FontChooserWidget Gtk.Orientable->Gtk.Box Gtk.FontChooser Gtk.FontChooser Gtk.FontChooser->Gtk.FontChooserWidget

Description:

[ CCode ( type_id = "gtk_font_chooser_widget_get_type ()" ) ]
[ Version ( since = "3.2" ) ]
public class FontChooserWidget : Box, Implementor, Buildable, FontChooser, Orientable

The FontChooserWidget widget lists the available fonts, styles and sizes, allowing the user to select a font.

It is used in the FontChooserDialog widget to provide a dialog box for selecting fonts.

To set the font which is initially selected, use set_font or set_font_desc.

To get the selected font use get_font or get_font_desc.

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

CSS nodes

GtkFontChooserWidget has a single CSS node with name fontchooser.

Example: FontChooserWidget:

public class Application : Gtk.Window {

public Application () {
// Prepare Gtk.Window:
this.title = "My Gtk.FontChooserWidget";
this.window_position = Gtk.WindowPosition.CENTER;
this.destroy.connect (Gtk.main_quit);

// The button:
Gtk.FontChooserWidget widget = new Gtk.FontChooserWidget ();
this.add (widget);

widget.font_activated.connect ((font) => {
print ("%s\n", font);
print (" font: %s\n", widget.get_font ().to_string ());
print (" desc: %s\n", widget.get_font_desc ().to_string ());
print (" face: %s\n", widget.get_font_face ().get_face_name ());
print (" size: %d\n", widget.get_font_size ());
print (" family: %s\n", widget.get_font_family ().get_name ());
print (" monospace: %s\n", widget.get_font_family ().is_monospace ().to_string ());
});
}

public static int main (string[] args) {
Gtk.init (ref args);

Application app = new Application ();
app.show_all ();
Gtk.main ();
return 0;
}
}

valac --pkg gtk+-3.0 Gtk.FontChooserWidget.vala


Namespace: Gtk
Package: gtk+-3.0

Content:

Properties:

Creation methods:

Inherited Members:

All known members inherited from class Gtk.Widget
All known members inherited from interface Atk.Implementor
All known members inherited from interface Gtk.Orientable