Freeciv-3.3
Loading...
Searching...
No Matches
choice_dialog.c
Go to the documentation of this file.
1/***********************************************************************
2 Freeciv - Copyright (C) 1996-2005 - Freeciv Development Team
3 This program is free software; you can redistribute it and/or modify
4 it under the terms of the GNU General Public License as published by
5 the Free Software Foundation; either version 2, or (at your option)
6 any later version.
7
8 This program is distributed in the hope that it will be useful,
9 but WITHOUT ANY WARRANTY; without even the implied warranty of
10 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 GNU General Public License for more details.
12***********************************************************************/
13#ifdef HAVE_CONFIG_H
14#include <fc_config.h>
15#endif
16
17#include <stdarg.h>
18
19#include <gtk/gtk.h>
20
21/* utility */
22#include "support.h"
23
24/* gui-gtk-3.22 */
25#include "gui_main.h"
26#include "gui_stuff.h"
27
28#include "choice_dialog.h"
29
30/***********************************************************************
31 Choice dialog: A dialog with a label and a list of buttons
32 placed vertically
33***********************************************************************/
34
35/*******************************************************************/
42
43/*******************************************************************/
47 int button)
48{
49 char button_name[512];
50 GtkWidget *b;
51
52 fc_snprintf(button_name, sizeof(button_name), "button%d", button);
53
55
56 return b;
57}
58
59/*******************************************************************/
67
68/*******************************************************************/
72 const char *label)
73{
74 GtkWidget* button = choice_dialog_get_nth_button(cd, number);
75 gtk_button_set_label(GTK_BUTTON(button), label);
76}
77
78/*******************************************************************/
82 const char *tool_tip)
83{
84 GtkWidget* button = choice_dialog_get_nth_button(cd, number);
86}
87
88/*******************************************************************/
92 const int number)
93{
94 GtkWidget *button = choice_dialog_get_nth_button(cd, number);
96
98}
99
100/*******************************************************************/
141
142/*******************************************************************/
147{
148 if (g_object_get_data(G_OBJECT(data), "hide")) {
150 } else {
152 }
153}
154
155/*******************************************************************/
160 bool meta, const gchar *tool_tip)
161{
162 GtkWidget *button, *bbox;
163 char name[512];
164 int nbuttons;
165
169
170 fc_snprintf(name, sizeof(name), "button%d", nbuttons);
171
172 button = gtk_button_new_with_mnemonic(label);
175
176 if (handler) {
177 g_signal_connect(button, "clicked", handler, data);
178 }
179
180 if (!meta) {
181 /* This button makes the choice. */
182 g_signal_connect_after(button, "clicked",
184 }
185
186 if (tool_tip != NULL) {
188 }
189}
190
191/*******************************************************************/
203
204/*******************************************************************/
211
212/*******************************************************************/
216 const gchar *text, ...)
217{
219 va_list args;
220 gchar *name;
221
223
224 va_start(args, text);
225
226 while ((name = va_arg(args, gchar *))) {
228 gpointer data;
229
230 handler = va_arg(args, GCallback);
231 data = va_arg(args, gpointer);
232
234 }
235
236 va_end(args);
237
239
240 return dshell;
241}
char * incite_cost
Definition comments.c:76
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
Definition gotodlg.c:56
GtkWidget * toplevel
Definition gui_main.c:126
void setup_dialog(GtkWidget *shell, GtkWidget *parent)
Definition gui_stuff.c:287
const char * name
Definition inputfile.c:127
static QString button_name(Qt::MouseButton bt)
int fc_snprintf(char *str, size_t n, const char *format,...)
Definition support.c:960
#define TRUE
Definition support.h:46
#define FALSE
Definition support.h:47