Freeciv-3.2
Loading...
Searching...
No Matches
gui_stuff.h
Go to the documentation of this file.
1/***********************************************************************
2 Freeciv - Copyright (C) 1996 - A Kjeldberg, L Gregersen, P Unold
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#ifndef FC__GUI_STUFF_H
14#define FC__GUI_STUFF_H
15
16#include <gtk/gtk.h>
17
18/* utility */
19#include "shared.h"
20
22 const gchar *label_text);
23void gtk_stockbutton_set_label(GtkWidget *button, const gchar *label_text);
25
26void intl_slist(int n, const char **s, bool *done);
27
28/* the standard GTK+ 2.0 API is braindamaged. this is slightly better! */
29
30typedef struct
31{
32 GtkTreeModel *model;
33 gboolean end;
34 GtkTreeIter it;
35} ITree;
36
37#define TREE_ITER_PTR(x) (&(x).it)
38
39void itree_begin(GtkTreeModel *model, ITree *it);
41void itree_next(ITree *it);
42void itree_get(ITree *it, ...);
43void itree_set(ITree *it, ...);
44
45void tstore_append(GtkTreeStore *store, ITree *it, ITree *parent);
46
48void itree_select(GtkTreeSelection *selection, ITree *it);
49void itree_unselect(GtkTreeSelection *selection, ITree *it);
50
56
58
63
64struct gui_dialog;
65
67
68struct gui_dialog
69{
70 /* Public. */
73
74 /* Private. */
75 char *title;
77 int id;
79
80 int default_width;
82
85
86 union {
88 struct {
93 } tab;
94 } v;
95
96 struct gui_dialog **source;
97
100
102};
103
104void dlg_tab_provider_prepare(void);
105
106void gui_dialog_new(struct gui_dialog **pdlg, GtkNotebook *notebook,
109 const char *icon_name,
110 const char *text, int response);
114 GtkWidget *wdg);
116 int width, int height);
117void gui_dialog_set_title(struct gui_dialog *dlg, const char *title);
119 int response, bool setting);
120void gui_dialog_show_all(struct gui_dialog *dlg);
121void gui_dialog_present(struct gui_dialog *dlg);
122void gui_dialog_raise(struct gui_dialog *dlg);
123void gui_dialog_alert(struct gui_dialog *dlg);
124void gui_dialog_destroy(struct gui_dialog *dlg);
125void gui_dialog_destroy_all(void);
130 struct gui_dialog *return_dialog);
131
132void gui_update_font_full(const char *font_name, const char *font_value,
134
137
139void widget_destroyed(GtkWidget *wdg, void *data);
141
142#define menu_item_insert_unref(menu, index, item) \
143{ \
144 GMenuItem *_item_var = item; \
145 g_menu_insert_item(menu, index, _item_var); \
146 g_object_unref(_item_var); \
147}
148
149#define menu_item_append_unref(menu, item) \
150{ \
151 GMenuItem *_item_var = item; \
152 g_menu_append_item(menu, _item_var); \
153 g_object_unref(_item_var); \
154}
155
156#define submenu_insert_unref(menu, index, name, \
157 submenu) \
158{ \
159 GMenuModel *_submenu_var = submenu; \
160 g_menu_insert_submenu(menu, index, name, \
161 _submenu_var); \
162 g_object_unref(_submenu_var); \
163}
164
165#define submenu_append_unref(menu, name, submenu) \
166{ \
167 GMenuModel *_submenu_var = submenu; \
168 g_menu_append_submenu(menu, name, _submenu_var); \
169 g_object_unref(_submenu_var); \
170}
171
172#endif /* FC__GUI_STUFF_H */
#define n
Definition astring.c:77
struct canvas int int struct sprite int int int int height
Definition canvas_g.h:44
struct canvas int int struct sprite int int int width
Definition canvas_g.h:44
char * incite_cost
Definition comments.c:75
void gtk_tree_view_focus(GtkTreeView *view)
Definition gui_stuff.c:236
void gui_dialog_destroy(struct gui_dialog *dlg)
Definition gui_stuff.c:954
void gui_dialog_present(struct gui_dialog *dlg)
Definition gui_stuff.c:835
void gtk_stockbutton_set_label(GtkWidget *button, const gchar *label_text)
Definition gui_stuff.c:96
void itree_get(ITree *it,...)
Definition gui_stuff.c:164
void itree_set(ITree *it,...)
Definition gui_stuff.c:152
void gui_dialog_raise(struct gui_dialog *dlg)
Definition gui_stuff.c:865
void gui_dialog_new(struct gui_dialog **pdlg, GtkNotebook *notebook, gpointer user_data, bool check_top)
Definition gui_stuff.c:517
void disable_gobject_callback(GObject *obj, GCallback cb)
Definition gui_stuff.c:1090
gint gtk_tree_selection_get_row(GtkTreeSelection *selection)
Definition gui_stuff.c:215
void gui_dialog_set_return_dialog(struct gui_dialog *dlg, struct gui_dialog *return_dialog)
Definition gui_stuff.c:997
gui_dialog_type
Definition gui_stuff.h:60
@ GUI_DIALOG_WINDOW
Definition gui_stuff.h:61
@ GUI_DIALOG_TAB
Definition gui_stuff.h:62
void dlg_tab_provider_prepare(void)
Definition gui_stuff.c:1155
void gui_dialog_response_set_callback(struct gui_dialog *dlg, GUI_DIALOG_RESPONSE_FUN fun)
Definition gui_stuff.c:988
void itree_begin(GtkTreeModel *model, ITree *it)
Definition gui_stuff.c:127
void itree_unselect(GtkTreeSelection *selection, ITree *it)
Definition gui_stuff.c:206
void enable_gobject_callback(GObject *obj, GCallback cb)
Definition gui_stuff.c:1106
void(* GUI_DIALOG_RESPONSE_FUN)(struct gui_dialog *, int, gpointer)
Definition gui_stuff.h:67
void gui_dialog_show_all(struct gui_dialog *dlg)
Definition gui_stuff.c:795
void itree_select(GtkTreeSelection *selection, ITree *it)
Definition gui_stuff.c:198
void gui_dialog_set_title(struct gui_dialog *dlg, const char *title)
Definition gui_stuff.c:935
void gui_dialog_set_default_size(struct gui_dialog *dlg, int width, int height)
Definition gui_stuff.c:919
GtkWidget * icon_label_button_new(const gchar *icon_name, const gchar *label_text)
Definition gui_stuff.c:76
void gui_dialog_alert(struct gui_dialog *dlg)
Definition gui_stuff.c:888
GtkTreeViewColumn * add_treeview_column(GtkWidget *view, const char *title, GType gtype, int model_index)
Definition gui_stuff.c:1123
void tstore_append(GtkTreeStore *store, ITree *it, ITree *parent)
Definition gui_stuff.c:176
void itree_next(ITree *it)
Definition gui_stuff.c:144
void gui_dialog_destroy_all(void)
Definition gui_stuff.c:974
gboolean itree_is_selected(GtkTreeSelection *selection, ITree *it)
Definition gui_stuff.c:190
GtkWidget * gui_dialog_add_button(struct gui_dialog *dlg, const char *icon_name, const char *text, int response)
Definition gui_stuff.c:706
void setup_dialog(GtkWidget *shell, GtkWidget *parent)
Definition gui_stuff.c:287
void gui_update_font_full(const char *font_name, const char *font_value, PangoFontDescription **font_desc)
Definition gui_stuff.c:1073
void gtk_expose_now(GtkWidget *w)
Definition gui_stuff.c:52
void gui_dialog_set_response_sensitive(struct gui_dialog *dlg, int response, bool setting)
Definition gui_stuff.c:760
GtkWidget * gui_dialog_get_toplevel(struct gui_dialog *dlg)
Definition gui_stuff.c:787
void intl_slist(int n, const char **s, bool *done)
Definition gui_stuff.c:111
gboolean itree_end(ITree *it)
Definition gui_stuff.c:136
static struct gui_dialog * shell
Definition messagedlg.c:39
const char * title
Definition repodlgs.c:1314
gint blocking_dialog(GtkWidget *dlg)
Definition gui_stuff.c:1135
GtkWidget * aux_menu_new(void)
Definition gui_stuff.c:243
gui_dialog_type
Definition gui_stuff.h:59
void gui_dialog_add_content_widget(struct gui_dialog *dlg, GtkWidget *wdg)
Definition gui_stuff.c:1104
void(* GUI_DIALOG_RESPONSE_FUN)(struct gui_dialog *, int, gpointer)
Definition gui_stuff.h:66
GtkWidget * widget_get_child(GtkWidget *wdg)
Definition gui_stuff.c:1163
GtkWidget * gui_dialog_add_action_widget(struct gui_dialog *dlg, GtkWidget *widget)
Definition gui_stuff.c:689
void widget_destroyed(GtkWidget *wdg, void *data)
Definition gui_stuff.c:1154
const char * font_name
Definition gui_main_g.h:43
char * title
Definition gui_stuff.h:76
gulong handler_id
Definition gui_stuff.h:89
union gui_dialog::@152 v
GtkWidget * actions
Definition gui_stuff.h:72
int content_counter
Definition gui_stuff.h:84
GtkWidget * grid
Definition gui_stuff.h:71
bool vertical_content
Definition gui_stuff.h:83
GtkSizeGroup * gui_button
Definition gui_stuff.h:99
GUI_DIALOG_RESPONSE_FUN response_callback
Definition gui_stuff.h:96
GtkWidget * label
Definition gui_stuff.h:87
struct gui_dialog::@152::@153 tab
GtkWidget * notebook
Definition gui_stuff.h:88
int return_dialog_id
Definition gui_stuff.h:79
int default_height
Definition gui_stuff.h:82
struct gui_dialog ** source
Definition gui_stuff.h:94
gpointer user_data
Definition gui_stuff.h:97
GtkWidget * window
Definition gui_stuff.h:85
enum gui_dialog_type type
Definition gui_stuff.h:77
int default_width
Definition gui_stuff.h:81
GtkWidget * child
Definition gui_stuff.h:90