Simplify vflist_get_formatted()
[geeqie.git] / src / ui_misc.h
1 /*
2  * Copyright (C) 2004 John Ellis
3  * Copyright (C) 2008 - 2016 The Geeqie Team
4  *
5  * Author: John Ellis
6  *
7  * This program is free software; you can redistribute it and/or modify
8  * it under the terms of the GNU General Public License as published by
9  * the Free Software Foundation; either version 2 of the License, or
10  * (at your option) any later version.
11  *
12  * This program is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15  * GNU General Public License for more details.
16  *
17  * You should have received a copy of the GNU General Public License along
18  * with this program; if not, write to the Free Software Foundation, Inc.,
19  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
20  */
21
22 #ifndef UI_MISC_H
23 #define UI_MISC_H
24
25
26 #include <sys/time.h>
27 #include <sys/types.h>
28 #include <time.h>
29
30
31 /* these values are per GNOME HIG */
32
33 /* HIG 2.0 chapter 8 defines: */
34
35 /**
36  * @def PREF_PAD_GAP
37  * space between elements within control (ex: icon and it's text)
38  */
39 #define PREF_PAD_GAP     6
40
41 /**
42  * @def PREF_PAD_SPACE
43  * space between label and control(s)
44  */
45 #define PREF_PAD_SPACE  12
46
47 /**
48  * @def PREF_PAD_BORDER
49  * space between window border and controls
50  */
51 #define PREF_PAD_BORDER 12
52
53 /**
54  * @def PREF_PAD_INDENT
55  * indent for group members
56  */
57 #define PREF_PAD_INDENT 12
58
59 /**
60  * @def PREF_PAD_GROUP
61  * vertical space between groups
62  */
63 #define PREF_PAD_GROUP  18
64
65 /* HIG 2.0 chapter 3.13 defines: */
66
67 /**
68  * @def PREF_PAD_BUTTON_GAP
69  * gap between buttons in a dialog
70  */
71 #define PREF_PAD_BUTTON_GAP 6
72
73 /**
74  * @def PREF_PAD_BUTTON_SPACE
75  * space between buttons in a dialog and it's contents
76  */
77 #define PREF_PAD_BUTTON_SPACE 24
78
79 /* and these are not in the GNOME HIG */
80
81 /**
82  * @def PREF_PAD_TOOLBAR_GAP
83  * gap between similar toolbar items (buttons)
84  */
85 #define PREF_PAD_TOOLBAR_GAP 0
86
87 /**
88  * @def PREF_PAD_BUTTON_ICON_GAP
89  * HIG 2.0 states 6 pixels between icons and text,
90  * but GTK's stock buttons ignore this (hard coded to 2), we do it too for consistency
91  */
92 #define PREF_PAD_BUTTON_ICON_GAP 2
93
94
95 GtkWidget *pref_box_new(GtkWidget *parent_box, gboolean fill,
96                         GtkOrientation orientation, gboolean padding);
97
98 GtkWidget *pref_group_new(GtkWidget *parent_box, gboolean fill,
99                           const gchar *text, GtkOrientation orientation);
100 GtkWidget *pref_group_parent(GtkWidget *child);
101
102 GtkWidget *pref_frame_new(GtkWidget *parent_box, gboolean fill,
103                           const gchar *text,
104                           GtkOrientation orientation, gboolean padding);
105
106 GtkWidget *pref_spacer(GtkWidget *parent_box, gboolean padding);
107 GtkWidget *pref_line(GtkWidget *parent_box, gboolean padding);
108
109 GtkWidget *pref_label_new(GtkWidget *parent_box, const gchar *text);
110 GtkWidget *pref_label_new_mnemonic(GtkWidget *parent_box, const gchar *text, GtkWidget *widget);
111 void pref_label_bold(GtkWidget *label, gboolean bold, gboolean increase_size);
112
113 GtkWidget *pref_button_new(GtkWidget *parent_box, const gchar *stock_id,
114                            const gchar *text, gboolean hide_stock_text,
115                            GCallback func, gpointer data);
116
117 GtkWidget *pref_checkbox_new(GtkWidget *parent_box, const gchar *text, gboolean active,
118                              GCallback func, gpointer data);
119 GtkWidget *pref_checkbox_new_mnemonic(GtkWidget *parent_box, const gchar *text, gboolean active,
120                                       GCallback func, gpointer data);
121
122 GtkWidget *pref_checkbox_new_int(GtkWidget *parent_box, const gchar *text, gboolean active,
123                                  gboolean *result);
124
125 void pref_checkbox_link_sensitivity(GtkWidget *button, GtkWidget *widget);
126 void pref_checkbox_link_sensitivity_swap(GtkWidget *button, GtkWidget *widget);
127
128 GtkWidget *pref_radiobutton_new(GtkWidget *parent_box, GtkWidget *sibling,
129                                 const gchar *text, gboolean active,
130                                 GCallback func, gpointer data);
131 GtkWidget *pref_radiobutton_new_mnemonic(GtkWidget *parent_box, GtkWidget *sibling,
132                                          const gchar *text, gboolean active,
133                                          GCallback func, gpointer data);
134
135 GtkWidget *pref_radiobutton_new_int(GtkWidget *parent_box, GtkWidget *sibling,
136                                     const gchar *text, gboolean active,
137                                     gboolean *result, gboolean value,
138                                     GCallback func, gpointer data);
139
140 GtkWidget *pref_spin_new(GtkWidget *parent_box, const gchar *text, const gchar *suffix,
141                          gdouble min, gdouble max, gdouble step, gint digits,
142                          gdouble value,
143                          GCallback func, gpointer data);
144 GtkWidget *pref_spin_new_mnemonic(GtkWidget *parent_box, const gchar *text, const gchar *suffix,
145                                   gdouble min, gdouble max, gdouble step, gint digits,
146                                   gdouble value,
147                                   GCallback func, gpointer data);
148
149 GtkWidget *pref_spin_new_int(GtkWidget *parent_box, const gchar *text, const gchar *suffix,
150                              gint min, gint max, gint step,
151                              gint value, gint *value_var);
152
153 void pref_link_sensitivity(GtkWidget *widget, GtkWidget *watch);
154
155 void pref_signal_block_data(GtkWidget *widget, gpointer data);
156 void pref_signal_unblock_data(GtkWidget *widget, gpointer data);
157
158
159 GtkWidget *pref_table_new(GtkWidget *parent_box, gint columns, gint rows,
160                           gboolean homegeneous, gboolean fill);
161
162 GtkWidget *pref_table_box(GtkWidget *table, gint column, gint row,
163                           GtkOrientation orientation, const gchar *text);
164
165 GtkWidget *pref_table_label(GtkWidget *table, gint column, gint row,
166                             const gchar *text, gfloat alignment);
167
168 GtkWidget *pref_table_button(GtkWidget *table, gint column, gint row,
169                              const gchar *stock_id, const gchar *text, gboolean hide_stock_text,
170                              GCallback func, gpointer data);
171
172 GtkWidget *pref_table_spin(GtkWidget *table, gint column, gint row,
173                            const gchar *text, const gchar *suffix,
174                            gdouble min, gdouble max, gdouble step, gint digits,
175                            gdouble value,
176                            GCallback func, gpointer data);
177
178 GtkWidget *pref_table_spin_new_int(GtkWidget *table, gint column, gint row,
179                                    const gchar *text, const gchar *suffix,
180                                    gint min, gint max, gint step,
181                                    gint value, gint *value_var);
182
183
184 GtkWidget *pref_toolbar_new(GtkWidget *parent_box, GtkToolbarStyle style);
185 GtkWidget *pref_toolbar_button(GtkWidget *toolbar,
186                                const gchar *stock_id, const gchar *label, gboolean toggle,
187                                const gchar *description,
188                                GCallback func, gpointer data);
189 void pref_toolbar_button_set_icon(GtkWidget *button, GtkWidget *widget, const gchar *stock_id);
190 GtkWidget *pref_toolbar_spacer(GtkWidget *toolbar);
191
192
193 GtkWidget *date_selection_new(void);
194
195 void date_selection_set(GtkWidget *widget, gint day, gint month, gint year);
196 void date_selection_get(GtkWidget *widget, gint *day, gint *month, gint *year);
197
198 void date_selection_time_set(GtkWidget *widget, time_t t);
199 time_t date_selection_time_get(GtkWidget *widget);
200
201
202 typedef enum {
203         SIZER_POS_LEFT   = 1 << 0,
204         SIZER_POS_RIGHT  = 1 << 1,
205         SIZER_POS_TOP    = 1 << 2,
206         SIZER_POS_BOTTOM = 1 << 3
207 } SizerPositionType;
208
209 GtkWidget *sizer_new(GtkWidget *parent, GtkWidget *bounding_widget,
210                      SizerPositionType position);
211
212 void sizer_set_limits(GtkWidget *sizer,
213                       gint hsize_min, gint hsize_max,
214                       gint vsize_min, gint vsize_max);
215
216
217 void pref_list_int_set(const gchar *group, const gchar *key, gint value);
218 gboolean pref_list_int_get(const gchar *group, const gchar *key, gint *result);
219
220 void pref_list_double_set(const gchar *group, const gchar *key, gdouble value);
221 gboolean pref_list_double_get(const gchar *group, const gchar *key, gdouble *result);
222
223 void pref_list_string_set(const gchar *group, const gchar *key, const gchar *value);
224 gboolean pref_list_string_get(const gchar *group, const gchar *key, const gchar **result);
225
226
227 void pref_color_button_set_cb(GtkWidget *widget, gpointer data);
228 GtkWidget *pref_color_button_new(GtkWidget *parent_box,
229                                  const gchar *title, const GdkColor *color,
230                                  GCallback func, gpointer data);
231
232 gchar *text_widget_text_pull(GtkWidget *text_widget);
233 gchar *text_widget_text_pull_selected(GtkWidget *text_widget);
234
235 gboolean defined_mouse_buttons(GtkWidget *widget, GdkEventButton *event, gpointer data);
236 #endif
237 /* vim: set shiftwidth=8 softtabstop=0 cindent cinoptions={1s: */