LiVES  1.6.4-svn
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros
widget-helper.h
Go to the documentation of this file.
1 // widget-helper.h
2 // LiVES
3 // (c) G. Finch 2012 <salsaman@gmail.com>
4 // released under the GNU GPL 3 or later
5 // see file ../COPYING or www.gnu.org for licensing details
6 
7 #ifndef HAS_LIVES_WIDGET_HELPER_H
8 #define HAS_LIVES_WIDGET_HELPER_H
9 
10 typedef enum {
17 
18 
19 #ifdef GUI_GTK
20 typedef GtkObject LiVESObject;
21 typedef GtkWidget LiVESWidget;
22 typedef GtkDialog LiVESDialog;
23 typedef GtkBox LiVESBox;
24 typedef GtkComboBox LiVESCombo;
25 typedef GtkComboBox LiVESComboBox;
26 typedef GtkComboBoxText LiVESComboBoxText;
27 typedef GtkToggleButton LiVESToggleButton;
28 typedef GtkTextView LiVESTextView;
29 typedef GtkEntry LiVESEntry;
30 typedef GtkRadioButton LiVESRadioButton;
31 
32 typedef GtkAdjustment LiVESAdjustment;
33 
34 typedef GdkPixbuf LiVESPixbuf;
35 
36 typedef GdkWindow LiVESXWindow;
37 
38 typedef GdkEventButton LiVESEventButton;
39 
40 typedef GError LiVESError;
41 
42 #ifndef IS_MINGW
43 typedef gboolean boolean;
44 #endif
45 
46 typedef GList LiVESList;
47 typedef GSList LiVESSList;
48 
49 
50 typedef GdkPixbufDestroyNotify LiVESPixbufDestroyNotify;
51 
52 typedef GdkInterpType LiVESInterpType;
53 
54 typedef gpointer LiVESObjectPtr;
55 
56 #define LIVES_BOX(widget) GTK_BOX(widget)
57 #define LIVES_COMBO(widget) GTK_COMBO_BOX(widget)
58 #define LIVES_COMBO_BOX(widget) GTK_COMBO_BOX(widget)
59 #define LIVES_COMBO_BOX_TEXT(widget) GTK_COMBO_BOX_TEXT(widget)
60 #define LIVES_RADIO_BUTTON(widget) GTK_RADIO_BUTTON(widget)
61 #define LIVES_TOGGLE_BUTTON(widget) GTK_TOGGLE_BUTTON(widget)
62 
63 #define LIVES_WIDGET_IS_SENSITIVE(widget) GTK_WIDGET_IS_SENSITIVE(widget)
64 #define LIVES_IS_COMBO(widget) GTK_IS_COMBO_BOX(widget)
65 
66 #define LIVES_INTERP_BEST GDK_INTERP_HYPER
67 #define LIVES_INTERP_NORMAL GDK_INTERP_BILINEAR
68 #define LIVES_INTERP_FAST GDK_INTERP_NEAREST
69 
70 typedef GLogLevelFlags LiVESLogLevelFlags;
71 
72 #define LIVES_LOG_LEVEL_WARNING G_LOG_LEVEL_WARNING
73 #define LIVES_LOG_LEVEL_MASK G_LOG_LEVEL_MASK
74 #define LIVES_LOG_LEVEL_CRITICAL G_LOG_LEVEL_CRITICAL
75 #define LIVES_LOG_FATAL_MASK G_LOG_FATAL_MASK
76 
77 #define LIVES_CONTROL_MASK GDK_CONTROL_MASK
78 #define LIVES_ALT_MASK GDK_MOD1_MASK
79 #define LIVES_SHIFT_MASK GDK_SHIFT_MASK
80 #define LIVES_LOCK_MASK GDK_LOCK_MASK
81 
82 #ifdef GDK_KEY_a
83 #define LIVES_KEY_Left GDK_KEY_Left
84 #define LIVES_KEY_Right GDK_KEY_Right
85 #define LIVES_KEY_Up GDK_KEY_Up
86 #define LIVES_KEY_Down GDK_KEY_Down
87 
88 #define LIVES_KEY_Space GDK_KEY_space
89 #define LIVES_KEY_BackSpace GDK_KEY_BackSpace
90 #define LIVES_KEY_Return GDK_KEY_Return
91 #define LIVES_KEY_Tab GDK_KEY_Tab
92 
93 #define LIVES_KEY_q GDK_KEY_q
94 
95 #define LIVES_KEY_1 GDK_KEY_1
96 #define LIVES_KEY_2 GDK_KEY_2
97 #define LIVES_KEY_3 GDK_KEY_3
98 #define LIVES_KEY_4 GDK_KEY_4
99 #define LIVES_KEY_5 GDK_KEY_5
100 #define LIVES_KEY_6 GDK_KEY_6
101 #define LIVES_KEY_7 GDK_KEY_7
102 #define LIVES_KEY_8 GDK_KEY_8
103 #define LIVES_KEY_9 GDK_KEY_9
104 #define LIVES_KEY_0 GDK_KEY_0
105 
106 #define LIVES_KEY_q GDK_KEY_q
107 
108 #define LIVES_KEY_F1 GDK_KEY_F1
109 #define LIVES_KEY_F2 GDK_KEY_F2
110 #define LIVES_KEY_F3 GDK_KEY_F3
111 #define LIVES_KEY_F4 GDK_KEY_F4
112 #define LIVES_KEY_F5 GDK_KEY_F5
113 #define LIVES_KEY_F6 GDK_KEY_F6
114 #define LIVES_KEY_F7 GDK_KEY_F7
115 #define LIVES_KEY_F8 GDK_KEY_F8
116 #define LIVES_KEY_F9 GDK_KEY_F9
117 #define LIVES_KEY_F10 GDK_KEY_F10
118 #define LIVES_KEY_F11 GDK_KEY_F11
119 #define LIVES_KEY_F12 GDK_KEY_F12
120 
121 #define LIVES_KEY_Page_Up GDK_KEY_Page_Up
122 #define LIVES_KEY_Page_Down GDK_KEY_Page_Down
123 
124 #else
125 #define LIVES_KEY_Left GDK_Left
126 #define LIVES_KEY_Right GDK_Right
127 #define LIVES_KEY_Up GDK_Up
128 #define LIVES_KEY_Down GDK_Down
129 
130 #define LIVES_KEY_Space GDK_space
131 #define LIVES_KEY_BackSpace GDK_BackSpace
132 #define LIVES_KEY_Return GDK_Return
133 #define LIVES_KEY_Tab GDK_Tab
134 
135 #define LIVES_KEY_q GDK_q
136 
137 #define LIVES_KEY_1 GDK_1
138 #define LIVES_KEY_2 GDK_2
139 #define LIVES_KEY_3 GDK_3
140 #define LIVES_KEY_4 GDK_4
141 #define LIVES_KEY_5 GDK_5
142 #define LIVES_KEY_6 GDK_6
143 #define LIVES_KEY_7 GDK_7
144 #define LIVES_KEY_8 GDK_8
145 #define LIVES_KEY_9 GDK_9
146 #define LIVES_KEY_0 GDK_0
147 
148 #define LIVES_KEY_q GDK_q
149 
150 #define LIVES_KEY_F1 GDK_F1
151 #define LIVES_KEY_F2 GDK_F2
152 #define LIVES_KEY_F3 GDK_F3
153 #define LIVES_KEY_F4 GDK_F4
154 #define LIVES_KEY_F5 GDK_F5
155 #define LIVES_KEY_F6 GDK_F6
156 #define LIVES_KEY_F7 GDK_F7
157 #define LIVES_KEY_F8 GDK_F8
158 #define LIVES_KEY_F9 GDK_F9
159 #define LIVES_KEY_F10 GDK_F10
160 #define LIVES_KEY_F11 GDK_F11
161 #define LIVES_KEY_F12 GDK_F12
162 
163 #define LIVES_KEY_Page_Up GDK_Page_Up
164 #define LIVES_KEY_Page_Down GDK_Page_Down
165 
166 
167 #endif
168 
169 // TO BE REMOVED:
170 void combo_set_popdown_strings (GtkCombo *combo, LiVESList *list);
171 
172 
173 #endif
174 
175 
176 #ifdef GUI_QT
177 typedef QImage LiVESPixbuf;
178 typedef bool boolean;
179 typedef int gint;
180 typedef uchar guchar;
181 typedef (void *) gpointer;
182 typedef (void *)(LiVESPixbufDestroyNotify(uchar *, gpointer));
183 
184 // etc.
185 
186 
187 
188 #define LIVES_INTERP_BEST Qt::SmoothTransformation
189 #define LIVES_INTERP_NORMAL Qt::SmoothTransformation
190 #define LIVES_INTERP_BEST Qt::FastTransformation
191 
192 
193 #endif
194 
195 
196 
197 
198 
199 
200 
201 
202 
203 
204 
205 
206 
207 
208 // basic functions (wrappers for Toolkit functions)
209 
210 void lives_object_unref(LiVESObjectPtr object);
211 
212 int lives_pixbuf_get_width(const LiVESPixbuf *pixbuf);
213 int lives_pixbuf_get_height(const LiVESPixbuf *pixbuf);
214 boolean lives_pixbuf_get_has_alpha(const LiVESPixbuf *pixbuf);
215 int lives_pixbuf_get_rowstride(const LiVESPixbuf *pixbuf);
216 int lives_pixbuf_get_n_channels(const LiVESPixbuf *pixbuf);
217 unsigned char *lives_pixbuf_get_pixels(const LiVESPixbuf *pixbuf);
218 const unsigned char *lives_pixbuf_get_pixels_readonly(const LiVESPixbuf *pixbuf);
219 LiVESPixbuf *lives_pixbuf_new(boolean has_alpha, int width, int height);
220 LiVESPixbuf *lives_pixbuf_new_from_data (const unsigned char *buf, boolean has_alpha, int width, int height,
221  int rowstride, LiVESPixbufDestroyNotify lives_free_buffer_fn,
222  gpointer destroy_fn_data);
223 
224 LiVESPixbuf *lives_pixbuf_new_from_file(const char *filename, LiVESError **error);
225 LiVESPixbuf *lives_pixbuf_new_from_file_at_scale(const char *filename, int width, int height, boolean preserve_aspect_ratio,
226  LiVESError **error);
227 
228 
229 LiVESPixbuf *lives_pixbuf_scale_simple(const LiVESPixbuf *src, int dest_width, int dest_height,
230  LiVESInterpType interp_type);
231 
232 
233 LiVESWidget *lives_dialog_get_content_area(LiVESDialog *dialog);
234 
235 LiVESWidget *lives_combo_new(void);
236 
237 void lives_combo_append_text(LiVESCombo *combo, const char *text);
238 void lives_combo_set_entry_text_column(LiVESCombo *combo, int column);
239 
240 char *lives_combo_get_active_text(LiVESCombo *combo) WARN_UNUSED;
241 void lives_combo_set_active_text(LiVESCombo *combo, const char *text);
242 
243 void lives_combo_set_active_string(LiVESCombo *combo, const char *active_str);
244 
245 LiVESWidget *lives_combo_get_entry(LiVESCombo *combo);
246 
247 void lives_combo_populate(LiVESCombo *combo, LiVESList *list);
248 
249 boolean lives_toggle_button_get_active(LiVESToggleButton *button);
250 void lives_toggle_button_set_active(LiVESToggleButton *button, boolean active);
251 
252 void lives_tooltips_set (LiVESWidget *widget, const char *tip_text);
253 
254 LiVESSList *lives_radio_button_get_group(LiVESRadioButton *rbutton);
255 
256 
257 // compound functions (composed of basic functions)
258 
259 void lives_tooltips_copy(LiVESWidget *dest, LiVESWidget *source);
260 
261 LiVESWidget *lives_standard_label_new(const char *text);
262 
263 LiVESWidget *lives_standard_check_button_new(const char *label, boolean use_mnemonic, LiVESBox *box, const char *tooltip);
264 LiVESWidget *lives_standard_radio_button_new(const char *labeltext, boolean use_mnemonic, LiVESSList *rbgroup,
265  LiVESBox *box, const char *tooltip);
266 LiVESWidget *lives_standard_spin_button_new(const char *labeltext, boolean use_mnemonic, double val, double min,
267  double max, double step, double page, int dp, LiVESBox *box,
268  const char *tooltip);
269 LiVESWidget *lives_standard_combo_new (const char *labeltext, boolean use_mnemonic, LiVESList *list, LiVESBox *box,
270  const char *tooltip);
271 
272 LiVESWidget *lives_standard_entry_new(const char *labeltext, boolean use_mnemonic, char *txt, int dispwidth, int maxchars, LiVESBox *box,
273  const char *tooltip);
274 
275 // util functions
276 
277 
278 
279 int get_box_child_index (LiVESBox *box, LiVESWidget *tchild);
280 
281 void set_fg_colour(gint red, gint green, gint blue);
282 
283 boolean label_act_toggle (LiVESWidget *, LiVESEventButton *, LiVESToggleButton *);
284 boolean widget_act_toggle (LiVESWidget *, LiVESToggleButton *);
285 
286 void gtk_tooltips_copy(LiVESWidget *dest, LiVESWidget *source);
287 
288 void adjustment_configure(LiVESAdjustment *adjustment, double value, double lower, double upper,
289  double step_increment, double page_increment, double page_size);
290 
291 char *text_view_get_text(LiVESTextView *textview);
292 void text_view_set_text(LiVESTextView *textview, const char *text);
293 
294 void lives_set_cursor_style(lives_cursor_t cstyle, LiVESXWindow *window);
295 
296 void toggle_button_toggle (LiVESToggleButton *tbutton);
297 
298 void unhide_cursor(LiVESXWindow *window);
299 void hide_cursor(LiVESXWindow *window);
300 
301 void get_border_size (LiVESWidget *win, int *bx, int *by);
302 
303 #endif
304