6e53370055d156dfeb9bf6ec2db5526d2230d774
[geeqie.git] / src / ui_misc.h
1 /*
2  * (SLIK) SimpLIstic sKin functions
3  * (C) 2004 John Ellis
4  *
5  * Author: John Ellis
6  *
7  * This software is released under the GNU General Public License (GNU GPL).
8  * Please read the included file COPYING for more information.
9  * This software comes with no warranty of any kind, use at your own risk!
10  */
11
12
13 #ifndef UI_MISC_H
14 #define UI_MISC_H
15
16
17 #include <sys/time.h>
18 #include <sys/types.h>
19 #include <time.h>
20
21
22 /* these values are per GNOME HIG */
23
24 /* HIG 2.0 chapter 8 defines: */
25
26 /* space between elements within control (ex: icon and it's text) */
27 #define PREF_PAD_GAP     6
28 /* space between label and control(s) */
29 #define PREF_PAD_SPACE  12
30 /* space between window border and controls */
31 #define PREF_PAD_BORDER 12
32 /* indent for group members */
33 #define PREF_PAD_INDENT 12
34 /* vertical space between groups */
35 #define PREF_PAD_GROUP  18
36
37 /* HIG 2.0 chapter 3.13 defines: */
38
39 /* gap between buttons in a dialog */
40 #define PREF_PAD_BUTTON_GAP 6
41 /* space between buttons in a dialog and it's contents */
42 #define PREF_PAD_BUTTON_SPACE 24
43
44 /* and these are not in the GNOME HIG */
45
46 /* gap between similar toolbar items (buttons) */
47 #define PREF_PAD_TOOLBAR_GAP 0
48
49 /* HIG 2.0 states 6 pixels between icons and text,
50  * but GTK's stock buttons ignore this (hard coded to 2), we do it too for consistency
51  */
52 #define PREF_PAD_BUTTON_ICON_GAP 2
53
54
55 GtkWidget *pref_box_new(GtkWidget *parent_box, gint fill,
56                         GtkOrientation orientation, gint padding);
57
58 GtkWidget *pref_group_new(GtkWidget *parent_box, gint fill,
59                           const gchar *text, GtkOrientation orientation);
60 GtkWidget *pref_group_parent(GtkWidget *child);
61
62 GtkWidget *pref_frame_new(GtkWidget *parent_box, gint fill,
63                           const gchar *text,
64                           GtkOrientation orientation, gint padding);
65
66 GtkWidget *pref_spacer(GtkWidget *parent_box, gint padding);
67 GtkWidget *pref_line(GtkWidget *parent_box, gint padding);
68
69 GtkWidget *pref_label_new(GtkWidget *parent_box, const gchar *text);
70 GtkWidget *pref_label_new_mnemonic(GtkWidget *parent_box, const gchar *text, GtkWidget *widget);
71 void pref_label_bold(GtkWidget *label, gint bold, gint increase_size);
72
73 GtkWidget *pref_button_new(GtkWidget *parent_box, const gchar *stock_id,
74                            const gchar *text, gint hide_stock_text,
75                            GCallback func, gpointer data);
76
77 GtkWidget *pref_checkbox_new(GtkWidget *parent_box, const gchar *text, gint active,
78                              GCallback func, gpointer data);
79 GtkWidget *pref_checkbox_new_mnemonic(GtkWidget *parent_box, const gchar *text, gint active,
80                                       GCallback func, gpointer data);
81
82 GtkWidget *pref_checkbox_new_int(GtkWidget *parent_box, const gchar *text, gint active,
83                                  gint *result);
84
85 void pref_checkbox_link_sensitivity(GtkWidget *button, GtkWidget *widget);
86 void pref_checkbox_link_sensitivity_swap(GtkWidget *button, GtkWidget *widget);
87
88 GtkWidget *pref_radiobutton_new(GtkWidget *parent_box, GtkWidget *sibling,
89                                 const gchar *text, gint active,
90                                 GCallback func, gpointer data);
91 GtkWidget *pref_radiobutton_new_mnemonic(GtkWidget *parent_box, GtkWidget *sibling,
92                                          const gchar *text, gint active,
93                                          GCallback func, gpointer data);
94
95 GtkWidget *pref_radiobutton_new_int(GtkWidget *parent_box, GtkWidget *sibling,
96                                     const gchar *text, gint active,
97                                     gint *result, gint value,
98                                     GCallback func, gpointer data);
99
100 GtkWidget *pref_spin_new(GtkWidget *parent_box, const gchar *text, const gchar *suffix,
101                          gdouble min, gdouble max, gdouble step, gint digits,
102                          gdouble value,
103                          GCallback func, gpointer data);
104 GtkWidget *pref_spin_new_mnemonic(GtkWidget *parent_box, const gchar *text, const gchar *suffix,
105                                   gdouble min, gdouble max, gdouble step, gint digits,
106                                   gdouble value,
107                                   GCallback func, gpointer data);
108
109 GtkWidget *pref_spin_new_int(GtkWidget *parent_box, const gchar *text, const gchar *suffix,
110                              gint min, gint max, gint step,
111                              gint value, gint *value_var);
112
113 void pref_link_sensitivity(GtkWidget *widget, GtkWidget *watch);
114
115 void pref_signal_block_data(GtkWidget *widget, gpointer data);
116 void pref_signal_unblock_data(GtkWidget *widget, gpointer data);
117
118
119 GtkWidget *pref_table_new(GtkWidget *parent_box, gint columns, gint rows,
120                           gint homogenious, gint fill);
121
122 GtkWidget *pref_table_box(GtkWidget *table, gint column, gint row,
123                           GtkOrientation orientation, const gchar *text);
124
125 GtkWidget *pref_table_label(GtkWidget *table, gint column, gint row,
126                             const gchar *text, gfloat alignment);
127
128 GtkWidget *pref_table_button(GtkWidget *table, gint column, gint row,
129                              const gchar *stock_id, const gchar *text, gint hide_stock_text,
130                              GCallback func, gpointer data);
131
132 GtkWidget *pref_table_spin(GtkWidget *table, gint column, gint row,
133                            const gchar *text, const gchar *suffix,
134                            gdouble min, gdouble max, gdouble step, gint digits,
135                            gdouble value,
136                            GCallback func, gpointer data);
137
138
139 GtkWidget *pref_toolbar_new(GtkWidget *parent_box, GtkToolbarStyle style);
140 GtkWidget *pref_toolbar_button(GtkWidget *toolbar, const gchar *stock_id, const gchar *label,
141                                const gchar *description,
142                                GCallback func, gpointer data);
143 GtkWidget *pref_toolbar_spacer(GtkWidget *toolbar);
144
145
146 GtkWidget *date_selection_new(void);
147
148 void date_selection_set(GtkWidget *widget, gint day, gint month, gint year);
149 void date_selection_get(GtkWidget *widget, gint *day, gint *month, gint *year);
150
151 void date_selection_time_set(GtkWidget *widget, time_t t);
152 time_t date_selection_time_get(GtkWidget *widget);
153
154
155 typedef enum {
156         SIZER_POS_LEFT   = 1 << 0,
157         SIZER_POS_RIGHT  = 1 << 1,
158         SIZER_POS_TOP    = 1 << 2,
159         SIZER_POS_BOTTOM = 1 << 3
160 } SizerPositionType;
161
162 GtkWidget *sizer_new(GtkWidget *parent, GtkWidget *bounding_widget,
163                      SizerPositionType position);
164
165 void sizer_set_limits(GtkWidget *sizer,
166                       gint hsize_min, gint hsize_max,
167                       gint vsize_min, gint vsize_max);
168
169
170 void pref_list_int_set(const gchar *group, const gchar *key, gint value);
171 gint pref_list_int_get(const gchar *group, const gchar *key, gint *result);
172
173 void pref_list_double_set(const gchar *group, const gchar *key, gdouble value);
174 gint pref_list_double_get(const gchar *group, const gchar *key, gdouble *result);
175
176 void pref_list_string_set(const gchar *group, const gchar *key, const gchar *value);
177 gint pref_list_string_get(const gchar *group, const gchar *key, const gchar **result);
178
179
180 #endif
181