static void file_dialog_entry_enter_cb(const gchar *path, gpointer data) { GenericDialog *gd = data; file_dialog_entry_cb(NULL, data); if (gd->default_cb) gd->default_cb(gd, gd->data); }
static gboolean generic_dialog_delete_cb(GtkWidget *w, GdkEventAny *event, gpointer data) { GenericDialog *gd = data; gboolean auto_close; auto_close = gd->auto_close; if (gd->cancel_cb) gd->cancel_cb(gd, gd->data); if (auto_close) generic_dialog_close(gd); return TRUE; }
static gboolean generic_dialog_key_press_cb(GtkWidget *widget, GdkEventKey *event, gpointer data) { GenericDialog *gd = data; if (event->keyval == GDK_KEY_Escape) { if (gd->cancel_cb) gd->cancel_cb(gd, gd->data); else if (gd->auto_close) generic_dialog_click_cb(widget, data); return TRUE; } return FALSE; }
static gboolean generic_dialog_default_key_press_cb(GtkWidget *widget, GdkEventKey *event, gpointer data) { GenericDialog *gd = data; if (event->keyval == GDK_KEY_Return && gtk_widget_has_focus(widget) && gd->default_cb) { gboolean auto_close; auto_close = gd->auto_close; gd->default_cb(gd, gd->data); if (auto_close) generic_dialog_close(gd); return TRUE; } return FALSE; }
void showAlgo(IAlgorithm_sptr alg, QStringList enabled, QStringList disabled, QApplication & app) { GenericDialog * dlg = new GenericDialog(NULL); // Set the content dlg->setAlgorithm(alg.get()); //dlg->setPresetValues(preset_values); //dlg->isForScript(forScript); dlg->setOptionalMessage(QString::fromStdString(alg->getOptionalMessage())); dlg->addEnabledAndDisableLists(enabled, disabled); // Setup the layout dlg->initializeLayout(); // Show dialog dlg->show(); app.exec(); dlg->close(); delete dlg; }