static void gtk_fontdialog_ok_callback( GtkWidget *WXUNUSED(widget), wxFontDialog *dialog ) { if (g_isIdle) wxapp_install_idle_handler(); GtkFontSelectionDialog *fontdlg = GTK_FONT_SELECTION_DIALOG(dialog->m_widget); #ifndef __WXGTK20__ GdkFont *gfont = gtk_font_selection_dialog_get_font(fontdlg); if (!gfont) { wxMessageBox(_("Please choose a valid font."), _("Error"), wxOK | wxICON_ERROR); return; } #endif gchar *fontname = gtk_font_selection_dialog_get_font_name(fontdlg); dialog->SetChosenFont( fontname); g_free( fontname ); wxCommandEvent event(wxEVT_COMMAND_BUTTON_CLICKED, wxID_OK); event.SetEventObject( dialog ); dialog->GetEventHandler()->ProcessEvent( event ); }
void calendar_font_selection_ok( GtkWidget *button, CalendarData *calendar ) { GtkStyle *style; GdkFont *font; calendar->font = gtk_font_selection_dialog_get_font_name( GTK_FONT_SELECTION_DIALOG (calendar->font_dialog)); if (calendar->window) { font = gtk_font_selection_dialog_get_font(GTK_FONT_SELECTION_DIALOG(calendar->font_dialog)); if (font) { style = gtk_style_copy (gtk_widget_get_style (calendar->window)); gdk_font_unref (style->font); style->font = font; gdk_font_ref (style->font); gtk_widget_set_style (calendar->window, style); } } }
/* Gets the currently-selected font. */ int clip_GTK_FONTSELECTIONDIALOGGETFONT(ClipMachine * ClipMachineMemory) { C_widget *cfsel = _fetch_cw_arg(ClipMachineMemory); C_object *cfont; GdkFont *font; CHECKCWID(cfsel, GTK_IS_FONT_SELECTION_DIALOG); font = gtk_font_selection_dialog_get_font(GTK_FONT_SELECTION_DIALOG(cfsel->widget)); if (!font) return 0; cfont = _list_get_cobject(ClipMachineMemory, font); if (!cfont) cfont = _register_object(ClipMachineMemory, font, GDK_OBJECT_FONT, NULL, (coDestructor) gdk_object_font_destructor); if (cfont) _clip_mclone(ClipMachineMemory, RETPTR(ClipMachineMemory), &cfont->obj); return 0; err: return 1; }