Fix #314: Remote commands for thumbnail maintenance
[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 /* space between elements within control (ex: icon and it's text) */
36 #define PREF_PAD_GAP     6
37 /* space between label and control(s) */
38 #define PREF_PAD_SPACE  12
39 /* space between window border and controls */
40 #define PREF_PAD_BORDER 12
41 /* indent for group members */
42 #define PREF_PAD_INDENT 12
43 /* vertical space between groups */
44 #define PREF_PAD_GROUP  18
45
46 /* HIG 2.0 chapter 3.13 defines: */
47
48 /* gap between buttons in a dialog */
49 #define PREF_PAD_BUTTON_GAP 6
50 /* space between buttons in a dialog and it's contents */
51 #define PREF_PAD_BUTTON_SPACE 24
52
53 /* and these are not in the GNOME HIG */
54
55 /* gap between similar toolbar items (buttons) */
56 #define PREF_PAD_TOOLBAR_GAP 0
57
58 /* HIG 2.0 states 6 pixels between icons and text,
59  * but GTK's stock buttons ignore this (hard coded to 2), we do it too for consistency
60  */
61 #define PREF_PAD_BUTTON_ICON_GAP 2
62
63
64 GtkWidget *pref_box_new(GtkWidget *parent_box, gboolean fill,
65                         GtkOrientation orientation, gboolean padding);
66
67 GtkWidget *pref_group_new(GtkWidget *parent_box, gboolean fill,
68                           const gchar *text, GtkOrientation orientation);
69 GtkWidget *pref_group_parent(GtkWidget *child);
70
71 GtkWidget *pref_frame_new(GtkWidget *parent_box, gboolean fill,
72                           const gchar *text,
73                           GtkOrientation orientation, gboolean padding);
74
75 GtkWidget *pref_spacer(GtkWidget *parent_box, gboolean padding);
76 GtkWidget *pref_line(GtkWidget *parent_box, gboolean padding);
77
78 GtkWidget *pref_label_new(GtkWidget *parent_box, const gchar *text);
79 GtkWidget *pref_label_new_mnemonic(GtkWidget *parent_box, const gchar *text, GtkWidget *widget);
80 void pref_label_bold(GtkWidget *label, gboolean bold, gboolean increase_size);
81
82 GtkWidget *pref_button_new(GtkWidget *parent_box, const gchar *stock_id,
83                            const gchar *text, gboolean hide_stock_text,
84                            GCallback func, gpointer data);
85
86 GtkWidget *pref_checkbox_new(GtkWidget *parent_box, const gchar *text, gboolean active,
87                              GCallback func, gpointer data);
88 GtkWidget *pref_checkbox_new_mnemonic(GtkWidget *parent_box, const gchar *text, gboolean active,
89                                       GCallback func, gpointer data);
90
91 GtkWidget *pref_checkbox_new_int(GtkWidget *parent_box, const gchar *text, gboolean active,
92                                  gboolean *result);
93
94 void pref_checkbox_link_sensitivity(GtkWidget *button, GtkWidget *widget);
95 void pref_checkbox_link_sensitivity_swap(GtkWidget *button, GtkWidget *widget);
96
97 GtkWidget *pref_radiobutton_new(GtkWidget *parent_box, GtkWidget *sibling,
98                                 const gchar *text, gboolean active,
99                                 GCallback func, gpointer data);
100 GtkWidget *pref_radiobutton_new_mnemonic(GtkWidget *parent_box, GtkWidget *sibling,
101                                          const gchar *text, gboolean active,
102                                          GCallback func, gpointer data);
103
104 GtkWidget *pref_radiobutton_new_int(GtkWidget *parent_box, GtkWidget *sibling,
105                                     const gchar *text, gboolean active,
106                                     gboolean *result, gboolean value,
107                                     GCallback func, gpointer data);
108
109 GtkWidget *pref_spin_new(GtkWidget *parent_box, const gchar *text, const gchar *suffix,
110                          gdouble min, gdouble max, gdouble step, gint digits,
111                          gdouble value,
112                          GCallback func, gpointer data);
113 GtkWidget *pref_spin_new_mnemonic(GtkWidget *parent_box, const gchar *text, const gchar *suffix,
114                                   gdouble min, gdouble max, gdouble step, gint digits,
115                                   gdouble value,
116                                   GCallback func, gpointer data);
117
118 GtkWidget *pref_spin_new_int(GtkWidget *parent_box, const gchar *text, const gchar *suffix,
119                              gint min, gint max, gint step,
120                              gint value, gint *value_var);
121
122 void pref_link_sensitivity(GtkWidget *widget, GtkWidget *watch);
123
124 void pref_signal_block_data(GtkWidget *widget, gpointer data);
125 void pref_signal_unblock_data(GtkWidget *widget, gpointer data);
126
127
128 GtkWidget *pref_table_new(GtkWidget *parent_box, gint columns, gint rows,
129                           gboolean homegeneous, gboolean fill);
130
131 GtkWidget *pref_table_box(GtkWidget *table, gint column, gint row,
132                           GtkOrientation orientation, const gchar *text);
133
134 GtkWidget *pref_table_label(GtkWidget *table, gint column, gint row,
135                             const gchar *text, gfloat alignment);
136
137 GtkWidget *pref_table_button(GtkWidget *table, gint column, gint row,
138                              const gchar *stock_id, const gchar *text, gboolean hide_stock_text,
139                              GCallback func, gpointer data);
140
141 GtkWidget *pref_table_spin(GtkWidget *table, gint column, gint row,
142                            const gchar *text, const gchar *suffix,
143                            gdouble min, gdouble max, gdouble step, gint digits,
144                            gdouble value,
145                            GCallback func, gpointer data);
146
147 GtkWidget *pref_table_spin_new_int(GtkWidget *table, gint column, gint row,
148                                    const gchar *text, const gchar *suffix,
149                                    gint min, gint max, gint step,
150                                    gint value, gint *value_var);
151
152
153 GtkWidget *pref_toolbar_new(GtkWidget *parent_box, GtkToolbarStyle style);
154 GtkWidget *pref_toolbar_button(GtkWidget *toolbar,
155                                const gchar *stock_id, const gchar *label, gboolean toggle,
156                                const gchar *description,
157                                GCallback func, gpointer data);
158 void pref_toolbar_button_set_icon(GtkWidget *button, GtkWidget *widget, const gchar *stock_id);
159 GtkWidget *pref_toolbar_spacer(GtkWidget *toolbar);
160
161
162 GtkWidget *date_selection_new(void);
163
164 void date_selection_set(GtkWidget *widget, gint day, gint month, gint year);
165 void date_selection_get(GtkWidget *widget, gint *day, gint *month, gint *year);
166
167 void date_selection_time_set(GtkWidget *widget, time_t t);
168 time_t date_selection_time_get(GtkWidget *widget);
169
170
171 typedef enum {
172         SIZER_POS_LEFT   = 1 << 0,
173         SIZER_POS_RIGHT  = 1 << 1,
174         SIZER_POS_TOP    = 1 << 2,
175         SIZER_POS_BOTTOM = 1 << 3
176 } SizerPositionType;
177
178 GtkWidget *sizer_new(GtkWidget *parent, GtkWidget *bounding_widget,
179                      SizerPositionType position);
180
181 void sizer_set_limits(GtkWidget *sizer,
182                       gint hsize_min, gint hsize_max,
183                       gint vsize_min, gint vsize_max);
184
185
186 void pref_list_int_set(const gchar *group, const gchar *key, gint value);
187 gboolean pref_list_int_get(const gchar *group, const gchar *key, gint *result);
188
189 void pref_list_double_set(const gchar *group, const gchar *key, gdouble value);
190 gboolean pref_list_double_get(const gchar *group, const gchar *key, gdouble *result);
191
192 void pref_list_string_set(const gchar *group, const gchar *key, const gchar *value);
193 gboolean pref_list_string_get(const gchar *group, const gchar *key, const gchar **result);
194
195
196 void pref_color_button_set_cb(GtkWidget *widget, gpointer data);
197 GtkWidget *pref_color_button_new(GtkWidget *parent_box,
198                                  const gchar *title, const GdkColor *color,
199                                  GCallback func, gpointer data);
200
201 gchar *text_widget_text_pull(GtkWidget *text_widget);
202
203 #endif
204 /* vim: set shiftwidth=8 softtabstop=0 cindent cinoptions={1s: */