Fix missing translation
[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 #include <gtk/gtk.h>
31
32 /* these values are per GNOME HIG */
33
34 /* HIG 2.0 chapter 8 defines: */
35
36 /**
37  * @def PREF_PAD_GAP
38  * space between elements within control (ex: icon and it's text)
39  */
40 #define PREF_PAD_GAP     6
41
42 /**
43  * @def PREF_PAD_SPACE
44  * space between label and control(s)
45  */
46 #define PREF_PAD_SPACE  12
47
48 /**
49  * @def PREF_PAD_BORDER
50  * space between window border and controls
51  */
52 #define PREF_PAD_BORDER 12
53
54 /**
55  * @def PREF_PAD_INDENT
56  * indent for group members
57  */
58 #define PREF_PAD_INDENT 12
59
60 /**
61  * @def PREF_PAD_GROUP
62  * vertical space between groups
63  */
64 #define PREF_PAD_GROUP  18
65
66 /* HIG 2.0 chapter 3.13 defines: */
67
68 /**
69  * @def PREF_PAD_BUTTON_GAP
70  * gap between buttons in a dialog
71  */
72 #define PREF_PAD_BUTTON_GAP 6
73
74 /**
75  * @def PREF_PAD_BUTTON_SPACE
76  * space between buttons in a dialog and it's contents
77  */
78 #define PREF_PAD_BUTTON_SPACE 24
79
80 /* and these are not in the GNOME HIG */
81
82 /**
83  * @def PREF_PAD_TOOLBAR_GAP
84  * gap between similar toolbar items (buttons)
85  */
86 #define PREF_PAD_TOOLBAR_GAP 0
87
88 /**
89  * @def PREF_PAD_BUTTON_ICON_GAP
90  * HIG 2.0 states 6 pixels between icons and text,
91  * but GTK's stock buttons ignore this (hard coded to 2), we do it too for consistency
92  */
93 #define PREF_PAD_BUTTON_ICON_GAP 2
94
95
96 GtkWidget *pref_box_new(GtkWidget *parent_box, gboolean fill,
97                         GtkOrientation orientation, gboolean padding);
98
99 GtkWidget *pref_group_new(GtkWidget *parent_box, gboolean fill,
100                           const gchar *text, GtkOrientation orientation);
101 GtkWidget *pref_group_parent(GtkWidget *child);
102
103 GtkWidget *pref_frame_new(GtkWidget *parent_box, gboolean fill,
104                           const gchar *text,
105                           GtkOrientation orientation, gboolean padding);
106
107 GtkWidget *pref_spacer(GtkWidget *parent_box, gboolean padding);
108 GtkWidget *pref_line(GtkWidget *parent_box, gboolean padding);
109
110 GtkWidget *pref_label_new(GtkWidget *parent_box, const gchar *text);
111 GtkWidget *pref_label_new_mnemonic(GtkWidget *parent_box, const gchar *text, GtkWidget *widget);
112 void pref_label_bold(GtkWidget *label, gboolean bold, gboolean increase_size);
113
114 GtkWidget *pref_button_new(GtkWidget *parent_box, const gchar *icon_name,
115                            const gchar *text, 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, gint, gboolean, gboolean);
160
161 GtkWidget *pref_table_box(GtkWidget *table, gint column, gint row,
162                           GtkOrientation orientation, const gchar *text);
163
164 GtkWidget *pref_table_label(GtkWidget *table, gint column, gint row,
165                             const gchar *text, GtkAlign alignment);
166
167 GtkWidget *pref_table_button(GtkWidget *table, gint column, gint row,
168                              const gchar *stock_id, const gchar *text,
169                              GCallback func, gpointer data);
170
171 GtkWidget *pref_table_spin(GtkWidget *table, gint column, gint row,
172                            const gchar *text, const gchar *suffix,
173                            gdouble min, gdouble max, gdouble step, gint digits,
174                            gdouble value,
175                            GCallback func, gpointer data);
176
177 GtkWidget *pref_table_spin_new_int(GtkWidget *table, gint column, gint row,
178                                    const gchar *text, const gchar *suffix,
179                                    gint min, gint max, gint step,
180                                    gint value, gint *value_var);
181
182
183 GtkWidget *pref_toolbar_new(GtkWidget *parent_box);
184 GtkWidget *pref_toolbar_button(GtkWidget *toolbar,
185                                const gchar *icon_name, const gchar *label, gboolean toggle,
186                                const gchar *description,
187                                GCallback func, gpointer data);
188 void pref_toolbar_button_set_icon(GtkWidget *button, GtkWidget *widget, const gchar *stock_id);
189 GtkWidget *pref_toolbar_spacer(GtkWidget *toolbar);
190
191
192 GtkWidget *date_selection_new();
193
194 void date_selection_set(GtkWidget *widget, gint day, gint month, gint year);
195 GDateTime *date_selection_get(GtkWidget *widget);
196
197 void date_selection_time_set(GtkWidget *widget, time_t t);
198 time_t date_selection_time_get(GtkWidget *widget);
199
200
201 enum SizerPositionType {
202         SIZER_POS_LEFT   = 1 << 0,
203         SIZER_POS_RIGHT  = 1 << 1,
204         SIZER_POS_TOP    = 1 << 2,
205         SIZER_POS_BOTTOM = 1 << 3
206 };
207
208 void sizer_set_limits(GtkWidget *sizer,
209                       gint hsize_min, gint hsize_max,
210                       gint vsize_min, gint vsize_max);
211
212
213 void pref_list_int_set(const gchar *group, const gchar *key, gint value);
214 gboolean pref_list_int_get(const gchar *group, const gchar *key, gint *result);
215
216 void pref_list_double_set(const gchar *group, const gchar *key, gdouble value);
217 gboolean pref_list_double_get(const gchar *group, const gchar *key, gdouble *result);
218
219 void pref_list_string_set(const gchar *group, const gchar *key, const gchar *value);
220 gboolean pref_list_string_get(const gchar *group, const gchar *key, const gchar **result);
221
222
223 void pref_color_button_set_cb(GtkWidget *widget, gpointer data);
224 GtkWidget *pref_color_button_new(GtkWidget *parent_box,
225                                  const gchar *title, GdkRGBA *color,
226                                  GCallback func, gpointer data);
227
228 gchar *text_widget_text_pull(GtkWidget *text_widget);
229 gchar *text_widget_text_pull_selected(GtkWidget *text_widget);
230
231 struct ActionItem
232 {
233         const gchar *name; /* GtkActionEntry terminology */
234         const gchar *label;
235         const gchar *icon_name;
236 };
237
238 GList* get_action_items();
239 void action_items_free(GList *list);
240
241 gboolean defined_mouse_buttons(GtkWidget *widget, GdkEventButton *event, gpointer data);
242
243 // Copy pixbuf returned by gtk_icon_theme_load_icon() to avoid GTK+ keeping the old icon theme loaded
244 GdkPixbuf *gq_gtk_icon_theme_load_icon_copy(GtkIconTheme *icon_theme, const gchar *icon_name, gint size, GtkIconLookupFlags flags);
245 #endif
246 /* vim: set shiftwidth=8 softtabstop=0 cindent cinoptions={1s: */