private void OnFont(object o, EventArgs args) { FontSelectionDialog fs = new FontSelectionDialog("Choose font"); int response = fs.Run(); fs.Destroy(); if (response == (int)Gtk.ResponseType.Cancel || response == (int)Gtk.ResponseType.None || response == (int)Gtk.ResponseType.DeleteEvent) { return; } try { textEditor.Font = FontDescription.FromString(fs.FontName); } catch (Exception e) { ShowError("Error setting font"); } }
// Font Change handler void OnFontButtonClicked (object sender, EventArgs args) { Gtk.FontSelectionDialog font_dialog = new Gtk.FontSelectionDialog ( Catalog.GetString ("Choose Note Font")); string font_name = (string) Preferences.Get (Preferences.CUSTOM_FONT_FACE); font_dialog.SetFontName (font_name); if ((int) Gtk.ResponseType.Ok == font_dialog.Run ()) { if (font_dialog.FontName != font_name) { Preferences.Set (Preferences.CUSTOM_FONT_FACE, font_dialog.FontName); UpdateFontButton (font_dialog.FontName); } } font_dialog.Destroy (); }
public void OnSettingsSelectFont (object sender, EventArgs args) { FontSelectionDialog fsd = new FontSelectionDialog ("Select Font"); try { fsd.SetFontName (Font); if (fsd.Run () == (int)Gtk.ResponseType.Ok) { Font = fsd.FontName; } } finally { fsd.Destroy (); } }
protected virtual void OnTextFontBrowseButtonClicked(object sender, System.EventArgs e) { FontSelectionDialog FontDlg = new FontSelectionDialog("Select I/O Text Font"); FontDlg.SetFontName(TextFont); try { if (FontDlg.Run() == (int) ResponseType.Ok) { TextFont = FontDlg.FontName; } } finally { FontDlg.Destroy(); } }
void CreateFontWidget() { var font = new Button(Stock.SelectFont); font.Clicked += delegate { var fs = new FontSelectionDialog(_("Select Font")); fs.Run(); fs.Hide(); }; AttachAligned(0, 2, _("Font:"), 0.0, 0.5, font, 1, true); }