Blame platform-demos/C/samples/fontchooserwidget.vala
|
Packit |
1470ea |
public class MyWindow : Gtk.ApplicationWindow {
|
|
Packit |
1470ea |
internal MyWindow (MyApplication app) {
|
|
Packit |
1470ea |
Object (application: app, title: "FontChooserWidget");
|
|
Packit |
1470ea |
|
|
Packit |
1470ea |
var font_chooser = new Gtk.FontChooserWidget ();
|
|
Packit |
1470ea |
font_chooser.set_font ("Sans");
|
|
Packit |
1470ea |
font_chooser.set_preview_text ("This is an example of preview text!");
|
|
Packit |
1470ea |
this.add (font_chooser);
|
|
Packit |
1470ea |
|
|
Packit |
1470ea |
font_chooser.notify["font"].connect (() => {
|
|
Packit |
1470ea |
print ("font: %s\n", font_chooser.get_font ().to_string ());
|
|
Packit |
1470ea |
print ("desc: %s\n", font_chooser.get_font_desc ().to_string ());
|
|
Packit |
1470ea |
print ("face: %s\n", font_chooser.get_font_face ().get_face_name ());
|
|
Packit |
1470ea |
print ("size: %d\n", font_chooser.get_font_size ());
|
|
Packit |
1470ea |
print ("family: %s\n", font_chooser.get_font_family ().get_name ());
|
|
Packit |
1470ea |
print ("monospace: %s\n\n", font_chooser.get_font_family ().is_monospace ().to_string ());
|
|
Packit |
1470ea |
});
|
|
Packit |
1470ea |
|
|
Packit |
1470ea |
this.show_all ();
|
|
Packit |
1470ea |
}
|
|
Packit |
1470ea |
}
|
|
Packit |
1470ea |
|
|
Packit |
1470ea |
public class MyApplication : Gtk.Application {
|
|
Packit |
1470ea |
protected override void activate () {
|
|
Packit |
1470ea |
new MyWindow (this).show ();
|
|
Packit |
1470ea |
}
|
|
Packit |
1470ea |
}
|
|
Packit |
1470ea |
|
|
Packit |
1470ea |
public int main (string[] args) {
|
|
Packit |
1470ea |
return new MyApplication ().run (args);
|
|
Packit |
1470ea |
}
|
|
Packit |
1470ea |
|