40 return GPOINTER_TO_INT(g_object_get_data(G_OBJECT(cd),
"nbuttons"));
75 gtk_button_set_label(GTK_BUTTON(button), label);
85 gtk_widget_set_tooltip_text(button, tool_tip);
95 GtkWidget *bbox = g_object_get_data(G_OBJECT(cd),
"bbox");
97 gtk_box_reorder_child(GTK_BOX(bbox), button, -1);
106 GtkWidget *
dshell, *dlabel, *vbox, *bbox;
108 dshell = gtk_window_new(GTK_WINDOW_TOPLEVEL);
110 gtk_window_set_position (GTK_WINDOW(
dshell), GTK_WIN_POS_MOUSE);
112 gtk_window_set_title(GTK_WINDOW(
dshell),
name);
114 gtk_window_set_transient_for(GTK_WINDOW(
dshell), parent);
115 gtk_window_set_destroy_with_parent(GTK_WINDOW(
dshell),
TRUE);
117 vbox = gtk_grid_new();
118 gtk_orientable_set_orientation(GTK_ORIENTABLE(vbox),
119 GTK_ORIENTATION_VERTICAL);
120 gtk_grid_set_row_spacing(GTK_GRID(vbox), 5);
121 gtk_container_add(GTK_CONTAINER(
dshell),vbox);
123 gtk_container_set_border_width(GTK_CONTAINER(vbox), 5);
125 dlabel = gtk_label_new(text);
126 gtk_container_add(GTK_CONTAINER(vbox), dlabel);
128 bbox = gtk_button_box_new(GTK_ORIENTATION_VERTICAL);
129 gtk_box_set_spacing(GTK_BOX(bbox), 2);
130 gtk_container_add(GTK_CONTAINER(vbox), bbox);
132 g_object_set_data(G_OBJECT(
dshell),
"bbox", bbox);
133 g_object_set_data(G_OBJECT(
dshell),
"nbuttons", GINT_TO_POINTER(0));
134 g_object_set_data(G_OBJECT(
dshell),
"hide", GINT_TO_POINTER(
FALSE));
136 gtk_widget_show(vbox);
137 gtk_widget_show(dlabel);
148 if (g_object_get_data(G_OBJECT(data),
"hide")) {
149 gtk_widget_hide(GTK_WIDGET(data));
151 gtk_widget_destroy(GTK_WIDGET(data));
159 GCallback handler, gpointer data,
160 bool meta,
const gchar *tool_tip)
162 GtkWidget *button, *bbox;
166 bbox = g_object_get_data(G_OBJECT(
dshell),
"bbox");
168 g_object_set_data(G_OBJECT(
dshell),
"nbuttons", GINT_TO_POINTER(nbuttons+1));
172 button = gtk_button_new_from_stock(label);
173 gtk_container_add(GTK_CONTAINER(bbox), button);
174 g_object_set_data(G_OBJECT(
dshell),
name, button);
177 g_signal_connect(button,
"clicked", handler, data);
182 g_signal_connect_after(button,
"clicked",
186 if (tool_tip != NULL) {
187 gtk_widget_set_tooltip_text(button, tool_tip);
198 bbox = g_object_get_data(G_OBJECT(
dshell),
"bbox");
200 gtk_widget_show_all(bbox);
209 g_object_set_data(G_OBJECT(
dshell),
"hide", GINT_TO_POINTER(
setting));
216 const gchar *text, ...)
224 va_start(args, text);
226 while ((
name = va_arg(args, gchar *))) {
230 handler = va_arg(args, GCallback);
231 data = va_arg(args, gpointer);
GtkWidget * choice_dialog_start(GtkWindow *parent, const gchar *name, const gchar *text)
void choice_dialog_end(GtkWidget *dshell)
static GtkWidget * choice_dialog_get_nth_button(GtkWidget *cd, int button)
int choice_dialog_get_number_of_buttons(GtkWidget *cd)
void choice_dialog_button_set_tooltip(GtkWidget *cd, int number, const char *tool_tip)
static void choice_dialog_clicked(GtkWidget *w, gpointer data)
void choice_dialog_button_move_to_the_end(GtkWidget *cd, const int number)
void choice_dialog_set_hide(GtkWidget *dshell, gboolean setting)
void choice_dialog_add(GtkWidget *dshell, const gchar *label, GCallback handler, gpointer data, bool meta, const gchar *tool_tip)
void choice_dialog_button_set_label(GtkWidget *cd, int number, const char *label)
void choice_dialog_button_set_sensitive(GtkWidget *cd, int button, gboolean state)
GtkWidget * popup_choice_dialog(GtkWindow *parent, const gchar *dialogname, const gchar *text,...)
static GtkWidget * dshell
void setup_dialog(GtkWidget *shell, GtkWidget *parent)
static QString button_name(Qt::MouseButton bt)
int fc_snprintf(char *str, size_t n, const char *format,...)