Freeciv-3.1
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
21GtkWidget *gtk_stockbutton_new(const gchar *stock, const gchar *label_text);
22void gtk_stockbutton_set_label(GtkWidget *button, const gchar *label_text);
23void gtk_expose_now(GtkWidget *w);
24void set_relative_window_position(GtkWindow *ref, GtkWindow *w, int px, int py);
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);
40gboolean itree_end(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
47gboolean itree_is_selected(GtkTreeSelection *selection, ITree *it);
48void itree_select(GtkTreeSelection *selection, ITree *it);
49void itree_unselect(GtkTreeSelection *selection, ITree *it);
50
51gint gtk_tree_selection_get_row(GtkTreeSelection *selection);
52void gtk_tree_view_focus(GtkTreeView *view);
53void setup_dialog(GtkWidget *shell, GtkWidget *parent);
54GtkTreeViewColumn *add_treeview_column(GtkWidget *view, const char *title,
55 GType gtype, int model_index);
56
57GtkWidget *gtk_aux_menu_bar_new(void);
58
63
64struct gui_dialog;
65
66typedef void (*GUI_DIALOG_RESPONSE_FUN)(struct gui_dialog *, int, gpointer);
67
69{
70 /* public. */
71 GtkWidget *vbox;
72 GtkWidget *action_area;
73
74 /* private. */
75 char *title;
77 int id;
79
82
83 union {
84 GtkWidget *window;
85 struct {
86 GtkWidget *label;
87 GtkWidget *notebook;
88 gulong handler_id;
89 GtkWidget *child;
90 } tab;
91 } v;
92
94
96 gpointer user_data;
97
98 GtkSizeGroup *gui_button;
99};
100
101void gui_dialog_new(struct gui_dialog **pdlg, GtkNotebook *notebook,
102 gpointer user_data, bool check_top);
103void gui_dialog_set_default_response(struct gui_dialog *dlg, int response);
104GtkWidget *gui_dialog_add_button(struct gui_dialog *dlg,
105 const char *text, int response);
106GtkWidget *gui_dialog_add_stockbutton(struct gui_dialog *dlg,
107 const char *stock, const char *text, int response);
108GtkWidget *gui_dialog_add_widget(struct gui_dialog *dlg,
109 GtkWidget *widget);
111 int width, int height);
112void gui_dialog_set_title(struct gui_dialog *dlg, const char *title);
114 int response, bool setting);
115void gui_dialog_show_all(struct gui_dialog *dlg);
116void gui_dialog_present(struct gui_dialog *dlg);
117void gui_dialog_raise(struct gui_dialog *dlg);
118void gui_dialog_alert(struct gui_dialog *dlg);
119void gui_dialog_destroy(struct gui_dialog *dlg);
120void gui_dialog_destroy_all(void);
121GtkWidget *gui_dialog_get_toplevel(struct gui_dialog *dlg);
125 struct gui_dialog *return_dialog);
126
127void gui_update_font_full(const char *font_name, const char *font_value,
128 PangoFontDescription **font_desc);
129
130void disable_gobject_callback(GObject *obj, GCallback cb);
131void enable_gobject_callback(GObject *obj, GCallback cb);
132
133#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
void gtk_tree_view_focus(GtkTreeView *view)
Definition gui_stuff.c:230
void gui_dialog_destroy(struct gui_dialog *dlg)
Definition gui_stuff.c:951
void gui_dialog_present(struct gui_dialog *dlg)
Definition gui_stuff.c:834
void gtk_stockbutton_set_label(GtkWidget *button, const gchar *label_text)
Definition gui_stuff.c:90
void gui_dialog_set_default_response(struct gui_dialog *dlg, int response)
Definition gui_stuff.c:733
void itree_get(ITree *it,...)
Definition gui_stuff.c:158
void itree_set(ITree *it,...)
Definition gui_stuff.c:146
void gui_dialog_raise(struct gui_dialog *dlg)
Definition gui_stuff.c:864
void gui_dialog_new(struct gui_dialog **pdlg, GtkNotebook *notebook, gpointer user_data, bool check_top)
Definition gui_stuff.c:504
void disable_gobject_callback(GObject *obj, GCallback cb)
Definition gui_stuff.c:1087
GtkWidget * gui_dialog_add_widget(struct gui_dialog *dlg, GtkWidget *widget)
Definition gui_stuff.c:721
gint gtk_tree_selection_get_row(GtkTreeSelection *selection)
Definition gui_stuff.c:209
void gui_dialog_set_return_dialog(struct gui_dialog *dlg, struct gui_dialog *return_dialog)
Definition gui_stuff.c:994
gui_dialog_type
Definition gui_stuff.h:59
@ GUI_DIALOG_WINDOW
Definition gui_stuff.h:60
@ GUI_DIALOG_TAB
Definition gui_stuff.h:61
void set_relative_window_position(GtkWindow *ref, GtkWindow *w, int px, int py)
Definition gui_stuff.c:58
void gui_dialog_response_set_callback(struct gui_dialog *dlg, GUI_DIALOG_RESPONSE_FUN fun)
Definition gui_stuff.c:985
void itree_begin(GtkTreeModel *model, ITree *it)
Definition gui_stuff.c:121
GtkWidget * gui_dialog_add_button(struct gui_dialog *dlg, const char *text, int response)
Definition gui_stuff.c:706
void itree_unselect(GtkTreeSelection *selection, ITree *it)
Definition gui_stuff.c:200
void enable_gobject_callback(GObject *obj, GCallback cb)
Definition gui_stuff.c:1103
void(* GUI_DIALOG_RESPONSE_FUN)(struct gui_dialog *, int, gpointer)
Definition gui_stuff.h:66
GtkWidget * gui_dialog_add_stockbutton(struct gui_dialog *dlg, const char *stock, const char *text, int response)
Definition gui_stuff.c:690
void gui_dialog_show_all(struct gui_dialog *dlg)
Definition gui_stuff.c:794
void itree_select(GtkTreeSelection *selection, ITree *it)
Definition gui_stuff.c:192
void gui_dialog_set_title(struct gui_dialog *dlg, const char *title)
Definition gui_stuff.c:932
void gui_dialog_set_default_size(struct gui_dialog *dlg, int width, int height)
Definition gui_stuff.c:916
GtkWidget * gtk_stockbutton_new(const gchar *stock, const gchar *label_text)
Definition gui_stuff.c:74
void gui_dialog_alert(struct gui_dialog *dlg)
Definition gui_stuff.c:887
GtkTreeViewColumn * add_treeview_column(GtkWidget *view, const char *title, GType gtype, int model_index)
Definition gui_stuff.c:1120
void tstore_append(GtkTreeStore *store, ITree *it, ITree *parent)
Definition gui_stuff.c:170
void itree_next(ITree *it)
Definition gui_stuff.c:138
void gui_dialog_destroy_all(void)
Definition gui_stuff.c:971
gboolean itree_is_selected(GtkTreeSelection *selection, ITree *it)
Definition gui_stuff.c:184
GtkWidget * gtk_aux_menu_bar_new(void)
Definition gui_stuff.c:249
void setup_dialog(GtkWidget *shell, GtkWidget *parent)
Definition gui_stuff.c:281
void gui_update_font_full(const char *font_name, const char *font_value, PangoFontDescription **font_desc)
Definition gui_stuff.c:1070
void gtk_expose_now(GtkWidget *w)
Definition gui_stuff.c:50
void gui_dialog_set_response_sensitive(struct gui_dialog *dlg, int response, bool setting)
Definition gui_stuff.c:759
GtkWidget * gui_dialog_get_toplevel(struct gui_dialog *dlg)
Definition gui_stuff.c:786
void intl_slist(int n, const char **s, bool *done)
Definition gui_stuff.c:105
gboolean itree_end(ITree *it)
Definition gui_stuff.c:130
static struct gui_dialog * shell
Definition messagedlg.c:39
const char * title
Definition repodlgs.c:1313
gui_dialog_type
Definition gui_stuff.h:59
void(* GUI_DIALOG_RESPONSE_FUN)(struct gui_dialog *, int, gpointer)
Definition gui_stuff.h:66
const char * font_name
Definition gui_main_g.h:43
GtkTreeModel * model
Definition gui_stuff.h:32
gboolean end
Definition gui_stuff.h:33
GtkTreeIter it
Definition gui_stuff.h:34
char * title
Definition gui_stuff.h:75
gulong handler_id
Definition gui_stuff.h:88
GtkWidget * action_area
Definition gui_stuff.h:72
union gui_dialog::@149 v
GtkSizeGroup * gui_button
Definition gui_stuff.h:98
GtkWidget * vbox
Definition gui_stuff.h:71
GUI_DIALOG_RESPONSE_FUN response_callback
Definition gui_stuff.h:95
GtkWidget * label
Definition gui_stuff.h:86
struct gui_dialog::@149::@150 tab
GtkWidget * notebook
Definition gui_stuff.h:87
int return_dialog_id
Definition gui_stuff.h:78
int default_height
Definition gui_stuff.h:81
struct gui_dialog ** source
Definition gui_stuff.h:93
gpointer user_data
Definition gui_stuff.h:96
GtkWidget * window
Definition gui_stuff.h:84
enum gui_dialog_type type
Definition gui_stuff.h:76
int default_width
Definition gui_stuff.h:80
GtkWidget * child
Definition gui_stuff.h:89