File: | eel/eel-labeled-image.c |
Warning: | line 1106, column 13 Value stored to 'y_alignment' is never read |
Press '?' to see keyboard shortcuts
Keyboard shortcuts:
1 | /* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */ |
2 | |
3 | /* eel-labeled-image.c - A labeled image. |
4 | |
5 | Copyright (C) 2000 Eazel, Inc. |
6 | |
7 | The Cafe Library is free software; you can redistribute it and/or |
8 | modify it under the terms of the GNU Library General Public License as |
9 | published by the Free Software Foundation; either version 2 of the |
10 | License, or (at your option) any later version. |
11 | |
12 | The Cafe Library 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 GNU |
15 | Library General Public License for more details. |
16 | |
17 | You should have received a copy of the GNU Library General Public |
18 | License along with the Cafe Library; see the file COPYING.LIB. If not, |
19 | write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, |
20 | Boston, MA 02110-1301, USA. |
21 | |
22 | Authors: Ramiro Estrugo <ramiro@eazel.com> |
23 | */ |
24 | |
25 | #include <config.h> |
26 | #include "eel-labeled-image.h" |
27 | |
28 | #include "eel-art-extensions.h" |
29 | #include "eel-art-ctk-extensions.h" |
30 | #include "eel-ctk-container.h" |
31 | #include "eel-ctk-extensions.h" |
32 | #include "eel-accessibility.h" |
33 | #include <ctk/ctk.h> |
34 | #include <ctk/ctk-a11y.h> |
35 | #include <cdk/cdkkeysyms.h> |
36 | #include <atk/atkimage.h> |
37 | |
38 | #define DEFAULT_SPACING0 0 |
39 | #define DEFAULT_X_PADDING0 0 |
40 | #define DEFAULT_Y_PADDING0 0 |
41 | #define DEFAULT_X_ALIGNMENT0.5 0.5 |
42 | #define DEFAULT_Y_ALIGNMENT0.5 0.5 |
43 | |
44 | /* Signals */ |
45 | enum |
46 | { |
47 | ACTIVATE, |
48 | LAST_SIGNAL |
49 | }; |
50 | |
51 | /* Arguments */ |
52 | enum |
53 | { |
54 | PROP_0, |
55 | PROP_FILL, |
56 | PROP_LABEL, |
57 | PROP_LABEL_POSITION, |
58 | PROP_PIXBUF, |
59 | PROP_SHOW_IMAGE, |
60 | PROP_SHOW_LABEL, |
61 | PROP_SPACING, |
62 | PROP_X_ALIGNMENT, |
63 | PROP_X_PADDING, |
64 | PROP_Y_ALIGNMENT, |
65 | PROP_Y_PADDING |
66 | }; |
67 | |
68 | /* Detail member struct */ |
69 | struct EelLabeledImagePrivate |
70 | { |
71 | CtkWidget *image; |
72 | CtkWidget *label; |
73 | CtkPositionType label_position; |
74 | gboolean show_label; |
75 | gboolean show_image; |
76 | guint spacing; |
77 | float x_alignment; |
78 | float y_alignment; |
79 | int x_padding; |
80 | int y_padding; |
81 | int fixed_image_height; |
82 | gboolean fill; |
83 | }; |
84 | |
85 | /* derived types so we can add our accessibility interfaces */ |
86 | static GType eel_labeled_image_button_get_type (void); |
87 | static GType eel_labeled_image_check_button_get_type (void); |
88 | static GType eel_labeled_image_radio_button_get_type (void); |
89 | static GType eel_labeled_image_toggle_button_get_type (void); |
90 | |
91 | /* CtkWidgetClass methods */ |
92 | static GType eel_labeled_image_accessible_get_type (void); |
93 | |
94 | /* Private EelLabeledImage methods */ |
95 | static EelDimensions labeled_image_get_image_dimensions (const EelLabeledImage *labeled_image); |
96 | static EelDimensions labeled_image_get_label_dimensions (const EelLabeledImage *labeled_image); |
97 | static void labeled_image_ensure_label (EelLabeledImage *labeled_image); |
98 | static void labeled_image_ensure_image (EelLabeledImage *labeled_image); |
99 | static EelIRect labeled_image_get_content_bounds (const EelLabeledImage *labeled_image); |
100 | static EelDimensions labeled_image_get_content_dimensions (const EelLabeledImage *labeled_image); |
101 | static void labeled_image_update_alignments (EelLabeledImage *labeled_image); |
102 | static gboolean labeled_image_show_label (const EelLabeledImage *labeled_image); |
103 | static gboolean labeled_image_show_image (const EelLabeledImage *labeled_image); |
104 | |
105 | static guint labeled_image_signals[LAST_SIGNAL] = { 0 }; |
106 | |
107 | G_DEFINE_TYPE_WITH_PRIVATE (EelLabeledImage, eel_labeled_image, CTK_TYPE_CONTAINER)static void eel_labeled_image_init (EelLabeledImage *self); static void eel_labeled_image_class_init (EelLabeledImageClass *klass ); static GType eel_labeled_image_get_type_once (void); static gpointer eel_labeled_image_parent_class = ((void*)0); static gint EelLabeledImage_private_offset; static void eel_labeled_image_class_intern_init (gpointer klass) { eel_labeled_image_parent_class = g_type_class_peek_parent (klass); if (EelLabeledImage_private_offset != 0) g_type_class_adjust_private_offset (klass, &EelLabeledImage_private_offset); eel_labeled_image_class_init ((EelLabeledImageClass*) klass); } __attribute__ ((__unused__ )) static inline gpointer eel_labeled_image_get_instance_private (EelLabeledImage *self) { return (((gpointer) ((guint8*) (self ) + (glong) (EelLabeledImage_private_offset)))); } GType eel_labeled_image_get_type (void) { static GType static_g_define_type_id = 0; if ((__extension__ ({ _Static_assert (sizeof *(&static_g_define_type_id) == sizeof (gpointer), "Expression evaluates to false"); (void) ( 0 ? (gpointer) * (&static_g_define_type_id) : ((void*)0)) ; (!(__extension__ ({ _Static_assert (sizeof *(&static_g_define_type_id ) == sizeof (gpointer), "Expression evaluates to false"); __typeof__ (*(&static_g_define_type_id)) gapg_temp_newval; __typeof__ ((&static_g_define_type_id)) gapg_temp_atomic = (&static_g_define_type_id ); __atomic_load (gapg_temp_atomic, &gapg_temp_newval, 5) ; gapg_temp_newval; })) && g_once_init_enter_pointer ( &static_g_define_type_id)); })) ) { GType g_define_type_id = eel_labeled_image_get_type_once (); (__extension__ ({ _Static_assert (sizeof *(&static_g_define_type_id) == sizeof (gpointer) , "Expression evaluates to false"); 0 ? (void) (*(&static_g_define_type_id ) = (g_define_type_id)) : (void) 0; g_once_init_leave_pointer ((&static_g_define_type_id), (gpointer) (guintptr) (g_define_type_id )); })) ; } return static_g_define_type_id; } __attribute__ ( (__noinline__)) static GType eel_labeled_image_get_type_once ( void) { GType g_define_type_id = g_type_register_static_simple ((ctk_container_get_type ()), g_intern_static_string ("EelLabeledImage" ), sizeof (EelLabeledImageClass), (GClassInitFunc)(void (*)(void )) eel_labeled_image_class_intern_init, sizeof (EelLabeledImage ), (GInstanceInitFunc)(void (*)(void)) eel_labeled_image_init , (GTypeFlags) 0); { {{ EelLabeledImage_private_offset = g_type_add_instance_private (g_define_type_id, sizeof (EelLabeledImagePrivate)); };} } return g_define_type_id; } |
108 | |
109 | static void |
110 | eel_labeled_image_init (EelLabeledImage *labeled_image) |
111 | { |
112 | ctk_widget_set_has_window (CTK_WIDGET (labeled_image)((((CtkWidget*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((labeled_image)), ((ctk_widget_get_type ())))))), FALSE(0)); |
113 | |
114 | labeled_image->details = eel_labeled_image_get_instance_private (labeled_image); |
115 | labeled_image->details->show_label = TRUE(!(0)); |
116 | labeled_image->details->show_image = TRUE(!(0)); |
117 | labeled_image->details->label_position = CTK_POS_BOTTOM; |
118 | labeled_image->details->spacing = DEFAULT_SPACING0; |
119 | labeled_image->details->x_padding = DEFAULT_X_PADDING0; |
120 | labeled_image->details->y_padding = DEFAULT_Y_PADDING0; |
121 | labeled_image->details->x_alignment = DEFAULT_X_ALIGNMENT0.5; |
122 | labeled_image->details->y_alignment = DEFAULT_Y_ALIGNMENT0.5; |
123 | labeled_image->details->fixed_image_height = 0; |
124 | |
125 | eel_labeled_image_set_fill (labeled_image, FALSE(0)); |
126 | } |
127 | |
128 | static void |
129 | eel_labeled_image_destroy (CtkWidget *object) |
130 | { |
131 | EelLabeledImage *labeled_image; |
132 | |
133 | labeled_image = EEL_LABELED_IMAGE (object)((((EelLabeledImage*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((object)), (eel_labeled_image_get_type()))))); |
134 | |
135 | if (labeled_image->details->image != NULL((void*)0)) |
136 | { |
137 | ctk_widget_destroy (labeled_image->details->image); |
138 | } |
139 | |
140 | if (labeled_image->details->label != NULL((void*)0)) |
141 | { |
142 | ctk_widget_destroy (labeled_image->details->label); |
143 | } |
144 | |
145 | CTK_WIDGET_CLASS (eel_labeled_image_parent_class)((((CtkWidgetClass*) (void *) g_type_check_class_cast ((GTypeClass *) ((eel_labeled_image_parent_class)), ((ctk_widget_get_type ( )))))))->destroy (object); |
146 | } |
147 | |
148 | /* GObjectClass methods */ |
149 | static void |
150 | eel_labeled_image_set_property (GObject *object, |
151 | guint property_id, |
152 | const GValue *value, |
153 | GParamSpec *pspec G_GNUC_UNUSED__attribute__ ((__unused__))) |
154 | { |
155 | EelLabeledImage *labeled_image; |
156 | |
157 | g_assert (EEL_IS_LABELED_IMAGE (object))do { if ((((__extension__ ({ GTypeInstance *__inst = (GTypeInstance *) ((object)); GType __t = (eel_labeled_image_get_type()); gboolean __r; if (!__inst) __r = (0); else if (__inst->g_class && __inst->g_class->g_type == __t) __r = (!(0)); else __r = g_type_check_instance_is_a (__inst, __t); __r; }))))) ; else g_assertion_message_expr ("Eel", "eel-labeled-image.c", 157, ((const char*) (__func__)), "EEL_IS_LABELED_IMAGE (object)") ; } while (0); |
158 | |
159 | labeled_image = EEL_LABELED_IMAGE (object)((((EelLabeledImage*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((object)), (eel_labeled_image_get_type()))))); |
160 | |
161 | switch (property_id) |
162 | { |
163 | case PROP_PIXBUF: |
164 | eel_labeled_image_set_pixbuf (labeled_image, |
165 | g_value_get_object (value)); |
166 | break; |
167 | |
168 | case PROP_LABEL: |
169 | eel_labeled_image_set_text (labeled_image, g_value_get_string (value)); |
170 | break; |
171 | |
172 | case PROP_LABEL_POSITION: |
173 | eel_labeled_image_set_label_position (labeled_image, |
174 | g_value_get_enum (value)); |
175 | break; |
176 | |
177 | case PROP_SHOW_LABEL: |
178 | eel_labeled_image_set_show_label (labeled_image, |
179 | g_value_get_boolean (value)); |
180 | break; |
181 | |
182 | case PROP_SHOW_IMAGE: |
183 | eel_labeled_image_set_show_image (labeled_image, |
184 | g_value_get_boolean (value)); |
185 | break; |
186 | |
187 | case PROP_SPACING: |
188 | eel_labeled_image_set_spacing (labeled_image, |
189 | g_value_get_uint (value)); |
190 | break; |
191 | |
192 | case PROP_X_PADDING: |
193 | eel_labeled_image_set_x_padding (labeled_image, |
194 | g_value_get_int (value)); |
195 | break; |
196 | |
197 | case PROP_Y_PADDING: |
198 | eel_labeled_image_set_y_padding (labeled_image, |
199 | g_value_get_int (value)); |
200 | break; |
201 | |
202 | case PROP_X_ALIGNMENT: |
203 | eel_labeled_image_set_x_alignment (labeled_image, |
204 | g_value_get_float (value)); |
205 | break; |
206 | |
207 | case PROP_Y_ALIGNMENT: |
208 | eel_labeled_image_set_y_alignment (labeled_image, |
209 | g_value_get_float (value)); |
210 | break; |
211 | |
212 | case PROP_FILL: |
213 | eel_labeled_image_set_fill (labeled_image, |
214 | g_value_get_boolean (value)); |
215 | break; |
216 | default: |
217 | g_assert_not_reached ()do { g_assertion_message_expr ("Eel", "eel-labeled-image.c", 217 , ((const char*) (__func__)), ((void*)0)); } while (0); |
218 | } |
219 | } |
220 | |
221 | static void |
222 | eel_labeled_image_get_property (GObject *object, |
223 | guint property_id, |
224 | GValue *value, |
225 | GParamSpec *pspec G_GNUC_UNUSED__attribute__ ((__unused__))) |
226 | { |
227 | EelLabeledImage *labeled_image; |
228 | |
229 | g_assert (EEL_IS_LABELED_IMAGE (object))do { if ((((__extension__ ({ GTypeInstance *__inst = (GTypeInstance *) ((object)); GType __t = (eel_labeled_image_get_type()); gboolean __r; if (!__inst) __r = (0); else if (__inst->g_class && __inst->g_class->g_type == __t) __r = (!(0)); else __r = g_type_check_instance_is_a (__inst, __t); __r; }))))) ; else g_assertion_message_expr ("Eel", "eel-labeled-image.c", 229, ((const char*) (__func__)), "EEL_IS_LABELED_IMAGE (object)") ; } while (0); |
230 | |
231 | labeled_image = EEL_LABELED_IMAGE (object)((((EelLabeledImage*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((object)), (eel_labeled_image_get_type()))))); |
232 | |
233 | switch (property_id) |
234 | { |
235 | case PROP_LABEL: |
236 | if (labeled_image->details->label == NULL((void*)0)) |
237 | { |
238 | g_value_set_string (value, NULL((void*)0)); |
239 | } |
240 | else |
241 | { |
242 | g_value_set_string (value, |
243 | ctk_label_get_text (CTK_LABEL (((((CtkLabel*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((labeled_image->details->label)), ((ctk_label_get_type ())))))) |
244 | labeled_image->details->label)((((CtkLabel*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((labeled_image->details->label)), ((ctk_label_get_type ())))))))); |
245 | } |
246 | break; |
247 | |
248 | case PROP_LABEL_POSITION: |
249 | g_value_set_enum (value, eel_labeled_image_get_label_position (labeled_image)); |
250 | break; |
251 | |
252 | case PROP_SHOW_LABEL: |
253 | g_value_set_boolean (value, eel_labeled_image_get_show_label (labeled_image)); |
254 | break; |
255 | |
256 | case PROP_SHOW_IMAGE: |
257 | g_value_set_boolean (value, eel_labeled_image_get_show_image (labeled_image)); |
258 | break; |
259 | |
260 | case PROP_SPACING: |
261 | g_value_set_uint (value, eel_labeled_image_get_spacing (labeled_image)); |
262 | break; |
263 | |
264 | case PROP_X_PADDING: |
265 | g_value_set_int (value, eel_labeled_image_get_x_padding (labeled_image)); |
266 | break; |
267 | |
268 | case PROP_Y_PADDING: |
269 | g_value_set_int (value, eel_labeled_image_get_y_padding (labeled_image)); |
270 | break; |
271 | |
272 | case PROP_X_ALIGNMENT: |
273 | g_value_set_float (value, eel_labeled_image_get_x_alignment (labeled_image)); |
274 | break; |
275 | |
276 | case PROP_Y_ALIGNMENT: |
277 | g_value_set_float (value, eel_labeled_image_get_y_alignment (labeled_image)); |
278 | break; |
279 | |
280 | case PROP_FILL: |
281 | g_value_set_boolean (value, eel_labeled_image_get_fill (labeled_image)); |
282 | break; |
283 | |
284 | default: |
285 | g_assert_not_reached ()do { g_assertion_message_expr ("Eel", "eel-labeled-image.c", 285 , ((const char*) (__func__)), ((void*)0)); } while (0); |
286 | } |
287 | } |
288 | |
289 | /* CtkWidgetClass methods */ |
290 | static void |
291 | eel_labeled_image_size_request (CtkWidget *widget, |
292 | CtkRequisition *requisition) |
293 | { |
294 | EelLabeledImage *labeled_image; |
295 | EelDimensions content_dimensions; |
296 | |
297 | g_assert (EEL_IS_LABELED_IMAGE (widget))do { if ((((__extension__ ({ GTypeInstance *__inst = (GTypeInstance *) ((widget)); GType __t = (eel_labeled_image_get_type()); gboolean __r; if (!__inst) __r = (0); else if (__inst->g_class && __inst->g_class->g_type == __t) __r = (!(0)); else __r = g_type_check_instance_is_a (__inst, __t); __r; }))))) ; else g_assertion_message_expr ("Eel", "eel-labeled-image.c", 297, ((const char*) (__func__)), "EEL_IS_LABELED_IMAGE (widget)") ; } while (0); |
298 | g_assert (requisition != NULL)do { if (requisition != ((void*)0)) ; else g_assertion_message_expr ("Eel", "eel-labeled-image.c", 298, ((const char*) (__func__ )), "requisition != NULL"); } while (0); |
299 | |
300 | labeled_image = EEL_LABELED_IMAGE (widget)((((EelLabeledImage*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((widget)), (eel_labeled_image_get_type()))))); |
301 | |
302 | content_dimensions = labeled_image_get_content_dimensions (labeled_image); |
303 | |
304 | requisition->width = |
305 | MAX (1, content_dimensions.width)(((1) > (content_dimensions.width)) ? (1) : (content_dimensions .width)) + |
306 | 2 * labeled_image->details->x_padding; |
307 | |
308 | requisition->height = |
309 | MAX (1, content_dimensions.height)(((1) > (content_dimensions.height)) ? (1) : (content_dimensions .height)) + |
310 | 2 * labeled_image->details->y_padding; |
311 | } |
312 | |
313 | static void |
314 | eel_labeled_image_get_preferred_width (CtkWidget *widget, |
315 | gint *minimum_width, |
316 | gint *natural_width) |
317 | { |
318 | CtkRequisition req; |
319 | eel_labeled_image_size_request (widget, &req); |
320 | *minimum_width = *natural_width = req.width; |
321 | } |
322 | |
323 | static void |
324 | eel_labeled_image_get_preferred_height (CtkWidget *widget, |
325 | gint *minimum_height, |
326 | gint *natural_height) |
327 | { |
328 | CtkRequisition req; |
329 | eel_labeled_image_size_request (widget, &req); |
330 | *minimum_height = *natural_height = req.height; |
331 | } |
332 | |
333 | static void |
334 | eel_labeled_image_size_allocate (CtkWidget *widget, |
335 | CtkAllocation *allocation) |
336 | { |
337 | EelLabeledImage *labeled_image; |
338 | EelIRect image_bounds; |
339 | EelIRect label_bounds; |
340 | |
341 | g_assert (EEL_IS_LABELED_IMAGE (widget))do { if ((((__extension__ ({ GTypeInstance *__inst = (GTypeInstance *) ((widget)); GType __t = (eel_labeled_image_get_type()); gboolean __r; if (!__inst) __r = (0); else if (__inst->g_class && __inst->g_class->g_type == __t) __r = (!(0)); else __r = g_type_check_instance_is_a (__inst, __t); __r; }))))) ; else g_assertion_message_expr ("Eel", "eel-labeled-image.c", 341, ((const char*) (__func__)), "EEL_IS_LABELED_IMAGE (widget)") ; } while (0); |
342 | g_assert (allocation != NULL)do { if (allocation != ((void*)0)) ; else g_assertion_message_expr ("Eel", "eel-labeled-image.c", 342, ((const char*) (__func__ )), "allocation != NULL"); } while (0); |
343 | |
344 | labeled_image = EEL_LABELED_IMAGE (widget)((((EelLabeledImage*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((widget)), (eel_labeled_image_get_type()))))); |
345 | |
346 | ctk_widget_set_allocation (widget, allocation); |
347 | |
348 | label_bounds = eel_labeled_image_get_label_bounds (labeled_image); |
349 | eel_ctk_container_child_size_allocate (CTK_CONTAINER (widget)((((CtkContainer*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((widget)), ((ctk_container_get_type ())))))), |
350 | labeled_image->details->label, |
351 | label_bounds); |
352 | |
353 | image_bounds = eel_labeled_image_get_image_bounds (labeled_image); |
354 | eel_ctk_container_child_size_allocate (CTK_CONTAINER (widget)((((CtkContainer*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((widget)), ((ctk_container_get_type ())))))), |
355 | labeled_image->details->image, |
356 | image_bounds); |
357 | } |
358 | |
359 | static int |
360 | eel_labeled_image_draw (CtkWidget *widget, |
361 | cairo_t *cr) |
362 | { |
363 | EelLabeledImage *labeled_image; |
364 | EelIRect label_bounds; |
365 | CtkStyleContext *context; |
366 | |
367 | g_assert (EEL_IS_LABELED_IMAGE (widget))do { if ((((__extension__ ({ GTypeInstance *__inst = (GTypeInstance *) ((widget)); GType __t = (eel_labeled_image_get_type()); gboolean __r; if (!__inst) __r = (0); else if (__inst->g_class && __inst->g_class->g_type == __t) __r = (!(0)); else __r = g_type_check_instance_is_a (__inst, __t); __r; }))))) ; else g_assertion_message_expr ("Eel", "eel-labeled-image.c", 367, ((const char*) (__func__)), "EEL_IS_LABELED_IMAGE (widget)") ; } while (0); |
368 | g_assert (ctk_widget_get_realized (widget))do { if (ctk_widget_get_realized (widget)) ; else g_assertion_message_expr ("Eel", "eel-labeled-image.c", 368, ((const char*) (__func__ )), "ctk_widget_get_realized (widget)"); } while (0); |
369 | |
370 | labeled_image = EEL_LABELED_IMAGE (widget)((((EelLabeledImage*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((widget)), (eel_labeled_image_get_type()))))); |
371 | |
372 | context = ctk_widget_get_style_context (widget); |
373 | ctk_style_context_save (context); |
374 | |
375 | if (ctk_widget_get_state_flags (widget) == CTK_STATE_FLAG_SELECTED || |
376 | ctk_widget_get_state_flags (widget) == CTK_STATE_FLAG_ACTIVE) |
377 | { |
378 | label_bounds = eel_labeled_image_get_label_bounds (EEL_LABELED_IMAGE (widget)((((EelLabeledImage*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((widget)), (eel_labeled_image_get_type())))))); |
379 | |
380 | ctk_widget_get_state_flags (widget); |
381 | ctk_render_background (context, |
382 | cr, |
383 | label_bounds.x0, label_bounds.y0, |
384 | label_bounds.x1 - label_bounds.x0, |
385 | label_bounds.y1 - label_bounds.y0); |
386 | |
387 | ctk_render_frame (context, |
388 | cr, |
389 | label_bounds.x0, label_bounds.y0, |
390 | label_bounds.x1 - label_bounds.x0, |
391 | label_bounds.y1 - label_bounds.y0); |
392 | } |
393 | |
394 | if (labeled_image_show_label (labeled_image)) |
395 | { |
396 | eel_ctk_container_child_expose_event (CTK_CONTAINER (widget)((((CtkContainer*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((widget)), ((ctk_container_get_type ())))))), |
397 | labeled_image->details->label, |
398 | cr); |
399 | } |
400 | |
401 | if (labeled_image_show_image (labeled_image)) |
402 | { |
403 | eel_ctk_container_child_expose_event (CTK_CONTAINER (widget)((((CtkContainer*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((widget)), ((ctk_container_get_type ())))))), |
404 | labeled_image->details->image, |
405 | cr); |
406 | } |
407 | |
408 | if (ctk_widget_has_focus (widget)) |
409 | { |
410 | label_bounds = eel_labeled_image_get_image_bounds (EEL_LABELED_IMAGE (widget)((((EelLabeledImage*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((widget)), (eel_labeled_image_get_type())))))); |
411 | ctk_widget_set_state_flags (widget, CTK_STATE_FLAG_NORMAL, TRUE(!(0))); |
412 | ctk_render_focus (context, |
413 | cr, |
414 | label_bounds.x0, label_bounds.y0, |
415 | label_bounds.x1 - label_bounds.x0, |
416 | label_bounds.y1 - label_bounds.y0); |
417 | } |
418 | |
419 | ctk_style_context_restore (context); |
420 | |
421 | return FALSE(0); |
422 | } |
423 | |
424 | static void |
425 | eel_labeled_image_map (CtkWidget *widget) |
426 | { |
427 | EelLabeledImage *labeled_image; |
428 | |
429 | g_assert (EEL_IS_LABELED_IMAGE (widget))do { if ((((__extension__ ({ GTypeInstance *__inst = (GTypeInstance *) ((widget)); GType __t = (eel_labeled_image_get_type()); gboolean __r; if (!__inst) __r = (0); else if (__inst->g_class && __inst->g_class->g_type == __t) __r = (!(0)); else __r = g_type_check_instance_is_a (__inst, __t); __r; }))))) ; else g_assertion_message_expr ("Eel", "eel-labeled-image.c", 429, ((const char*) (__func__)), "EEL_IS_LABELED_IMAGE (widget)") ; } while (0); |
430 | |
431 | labeled_image = EEL_LABELED_IMAGE (widget)((((EelLabeledImage*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((widget)), (eel_labeled_image_get_type()))))); |
432 | |
433 | ctk_widget_set_mapped (widget, TRUE(!(0))); |
434 | |
435 | if (labeled_image_show_label (labeled_image)) |
436 | { |
437 | eel_ctk_container_child_map (CTK_CONTAINER (widget)((((CtkContainer*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((widget)), ((ctk_container_get_type ())))))), labeled_image->details->label); |
438 | } |
439 | |
440 | if (labeled_image_show_image (labeled_image)) |
441 | { |
442 | eel_ctk_container_child_map (CTK_CONTAINER (widget)((((CtkContainer*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((widget)), ((ctk_container_get_type ())))))), labeled_image->details->image); |
443 | } |
444 | } |
445 | |
446 | static void |
447 | eel_labeled_image_unmap (CtkWidget *widget) |
448 | { |
449 | EelLabeledImage *labeled_image; |
450 | |
451 | g_assert (EEL_IS_LABELED_IMAGE (widget))do { if ((((__extension__ ({ GTypeInstance *__inst = (GTypeInstance *) ((widget)); GType __t = (eel_labeled_image_get_type()); gboolean __r; if (!__inst) __r = (0); else if (__inst->g_class && __inst->g_class->g_type == __t) __r = (!(0)); else __r = g_type_check_instance_is_a (__inst, __t); __r; }))))) ; else g_assertion_message_expr ("Eel", "eel-labeled-image.c", 451, ((const char*) (__func__)), "EEL_IS_LABELED_IMAGE (widget)") ; } while (0); |
452 | |
453 | labeled_image = EEL_LABELED_IMAGE (widget)((((EelLabeledImage*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((widget)), (eel_labeled_image_get_type()))))); |
454 | |
455 | ctk_widget_set_mapped (widget, FALSE(0)); |
456 | |
457 | eel_ctk_container_child_unmap (CTK_CONTAINER (widget)((((CtkContainer*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((widget)), ((ctk_container_get_type ())))))), labeled_image->details->label); |
458 | eel_ctk_container_child_unmap (CTK_CONTAINER (widget)((((CtkContainer*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((widget)), ((ctk_container_get_type ())))))), labeled_image->details->image); |
459 | } |
460 | |
461 | /* CtkContainerClass methods */ |
462 | static void |
463 | eel_labeled_image_add (CtkContainer *container, |
464 | CtkWidget *child) |
465 | { |
466 | g_assert (CTK_IS_LABEL (child) || CTK_IS_IMAGE (child))do { if ((((__extension__ ({ GTypeInstance *__inst = (GTypeInstance *) ((child)); GType __t = ((ctk_label_get_type ())); gboolean __r; if (!__inst) __r = (0); else if (__inst->g_class && __inst->g_class->g_type == __t) __r = (!(0)); else __r = g_type_check_instance_is_a (__inst, __t); __r; })))) || (( (__extension__ ({ GTypeInstance *__inst = (GTypeInstance*) (( child)); GType __t = ((ctk_image_get_type ())); gboolean __r; if (!__inst) __r = (0); else if (__inst->g_class && __inst->g_class->g_type == __t) __r = (!(0)); else __r = g_type_check_instance_is_a (__inst, __t); __r; }))))) ; else g_assertion_message_expr ("Eel", "eel-labeled-image.c", 466, ((const char*) (__func__)), "CTK_IS_LABEL (child) || CTK_IS_IMAGE (child)" ); } while (0); |
467 | |
468 | eel_ctk_container_child_add (container, child); |
469 | } |
470 | |
471 | static void |
472 | eel_labeled_image_remove (CtkContainer *container, |
473 | CtkWidget *child) |
474 | { |
475 | EelLabeledImage *labeled_image; |
476 | |
477 | g_assert (CTK_IS_LABEL (child) || CTK_IS_IMAGE (child))do { if ((((__extension__ ({ GTypeInstance *__inst = (GTypeInstance *) ((child)); GType __t = ((ctk_label_get_type ())); gboolean __r; if (!__inst) __r = (0); else if (__inst->g_class && __inst->g_class->g_type == __t) __r = (!(0)); else __r = g_type_check_instance_is_a (__inst, __t); __r; })))) || (( (__extension__ ({ GTypeInstance *__inst = (GTypeInstance*) (( child)); GType __t = ((ctk_image_get_type ())); gboolean __r; if (!__inst) __r = (0); else if (__inst->g_class && __inst->g_class->g_type == __t) __r = (!(0)); else __r = g_type_check_instance_is_a (__inst, __t); __r; }))))) ; else g_assertion_message_expr ("Eel", "eel-labeled-image.c", 477, ((const char*) (__func__)), "CTK_IS_LABEL (child) || CTK_IS_IMAGE (child)" ); } while (0); |
478 | |
479 | labeled_image = EEL_LABELED_IMAGE (container)((((EelLabeledImage*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((container)), (eel_labeled_image_get_type())))));; |
480 | |
481 | g_assert (child == labeled_image->details->image || child == labeled_image->details->label)do { if (child == labeled_image->details->image || child == labeled_image->details->label) ; else g_assertion_message_expr ("Eel", "eel-labeled-image.c", 481, ((const char*) (__func__ )), "child == labeled_image->details->image || child == labeled_image->details->label" ); } while (0); |
482 | |
483 | eel_ctk_container_child_remove (container, child); |
484 | |
485 | if (labeled_image->details->image == child) |
486 | { |
487 | labeled_image->details->image = NULL((void*)0); |
488 | } |
489 | |
490 | if (labeled_image->details->label == child) |
491 | { |
492 | labeled_image->details->label = NULL((void*)0); |
493 | } |
494 | } |
495 | |
496 | static void |
497 | eel_labeled_image_forall (CtkContainer *container, |
498 | gboolean include_internals, |
499 | CtkCallback callback, |
500 | gpointer callback_data) |
501 | { |
502 | EelLabeledImage *labeled_image; |
503 | |
504 | g_assert (EEL_IS_LABELED_IMAGE (container))do { if ((((__extension__ ({ GTypeInstance *__inst = (GTypeInstance *) ((container)); GType __t = (eel_labeled_image_get_type()); gboolean __r; if (!__inst) __r = (0); else if (__inst->g_class && __inst->g_class->g_type == __t) __r = (!(0) ); else __r = g_type_check_instance_is_a (__inst, __t); __r; } ))))) ; else g_assertion_message_expr ("Eel", "eel-labeled-image.c" , 504, ((const char*) (__func__)), "EEL_IS_LABELED_IMAGE (container)" ); } while (0); |
505 | g_assert (callback != NULL)do { if (callback != ((void*)0)) ; else g_assertion_message_expr ("Eel", "eel-labeled-image.c", 505, ((const char*) (__func__ )), "callback != NULL"); } while (0); |
506 | |
507 | labeled_image = EEL_LABELED_IMAGE (container)((((EelLabeledImage*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((container)), (eel_labeled_image_get_type()))))); |
508 | |
509 | if (include_internals) |
510 | { |
511 | if (labeled_image->details->image != NULL((void*)0)) |
512 | { |
513 | (* callback) (labeled_image->details->image, callback_data); |
514 | } |
515 | |
516 | if (labeled_image->details->label != NULL((void*)0)) |
517 | { |
518 | (* callback) (labeled_image->details->label, callback_data); |
519 | } |
520 | } |
521 | } |
522 | |
523 | /* Class init methods */ |
524 | static void |
525 | eel_labeled_image_class_init (EelLabeledImageClass *labeled_image_class) |
526 | { |
527 | GObjectClass *gobject_class = G_OBJECT_CLASS (labeled_image_class)((((GObjectClass*) (void *) g_type_check_class_cast ((GTypeClass *) ((labeled_image_class)), (((GType) ((20) << (2)))))) )); |
528 | CtkWidgetClass *widget_class = CTK_WIDGET_CLASS (labeled_image_class)((((CtkWidgetClass*) (void *) g_type_check_class_cast ((GTypeClass *) ((labeled_image_class)), ((ctk_widget_get_type ())))))); |
529 | CtkContainerClass *container_class = CTK_CONTAINER_CLASS (labeled_image_class)((((CtkContainerClass*) (void *) g_type_check_class_cast ((GTypeClass *) ((labeled_image_class)), ((ctk_container_get_type ())))))); |
530 | CtkBindingSet *binding_set; |
531 | |
532 | /* GObjectClass */ |
533 | gobject_class->set_property = eel_labeled_image_set_property; |
534 | gobject_class->get_property = eel_labeled_image_get_property; |
535 | |
536 | widget_class->destroy = eel_labeled_image_destroy; |
537 | |
538 | |
539 | /* CtkWidgetClass */ |
540 | widget_class->size_allocate = eel_labeled_image_size_allocate; |
541 | widget_class->get_preferred_width = eel_labeled_image_get_preferred_width; |
542 | widget_class->get_preferred_height = eel_labeled_image_get_preferred_height; |
543 | widget_class->draw = eel_labeled_image_draw; |
544 | |
545 | widget_class->map = eel_labeled_image_map; |
546 | widget_class->unmap = eel_labeled_image_unmap; |
547 | |
548 | ctk_widget_class_set_accessible_type (widget_class, eel_labeled_image_accessible_get_type ()); |
549 | |
550 | |
551 | /* CtkContainerClass */ |
552 | container_class->add = eel_labeled_image_add; |
553 | container_class->remove = eel_labeled_image_remove; |
554 | container_class->forall = eel_labeled_image_forall; |
555 | |
556 | labeled_image_signals[ACTIVATE] = |
557 | g_signal_new ("activate", |
558 | G_TYPE_FROM_CLASS (labeled_image_class)(((GTypeClass*) (labeled_image_class))->g_type), |
559 | G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION, |
560 | G_STRUCT_OFFSET (EelLabeledImageClass,((glong) __builtin_offsetof(EelLabeledImageClass, activate)) |
561 | activate)((glong) __builtin_offsetof(EelLabeledImageClass, activate)), |
562 | NULL((void*)0), NULL((void*)0), |
563 | g_cclosure_marshal_VOID__VOID, |
564 | G_TYPE_NONE((GType) ((1) << (2))), 0); |
565 | widget_class->activate_signal = labeled_image_signals[ACTIVATE]; |
566 | |
567 | binding_set = ctk_binding_set_by_class (gobject_class); |
568 | |
569 | ctk_binding_entry_add_signal (binding_set, |
570 | CDK_KEY_Return0xff0d, 0, |
571 | "activate", 0); |
572 | ctk_binding_entry_add_signal (binding_set, |
573 | CDK_KEY_KP_Enter0xff8d, 0, |
574 | "activate", 0); |
575 | ctk_binding_entry_add_signal (binding_set, |
576 | CDK_KEY_space0x020, 0, |
577 | "activate", 0); |
578 | |
579 | |
580 | /* Properties */ |
581 | g_object_class_install_property ( |
582 | gobject_class, |
583 | PROP_PIXBUF, |
584 | g_param_spec_object ("pixbuf", NULL((void*)0), NULL((void*)0), |
585 | GDK_TYPE_PIXBUF(gdk_pixbuf_get_type ()), G_PARAM_READWRITE)); |
586 | |
587 | g_object_class_install_property ( |
588 | gobject_class, |
589 | PROP_LABEL, |
590 | g_param_spec_string ("label", NULL((void*)0), NULL((void*)0), |
591 | "", G_PARAM_READWRITE)); |
592 | |
593 | |
594 | g_object_class_install_property ( |
595 | gobject_class, |
596 | PROP_LABEL_POSITION, |
597 | g_param_spec_enum ("label_position", NULL((void*)0), NULL((void*)0), |
598 | CTK_TYPE_POSITION_TYPE(ctk_position_type_get_type ()), |
599 | CTK_POS_BOTTOM, |
600 | G_PARAM_READWRITE)); |
601 | |
602 | g_object_class_install_property ( |
603 | gobject_class, |
604 | PROP_SHOW_LABEL, |
605 | g_param_spec_boolean ("show_label", NULL((void*)0), NULL((void*)0), |
606 | TRUE(!(0)), G_PARAM_READWRITE)); |
607 | |
608 | g_object_class_install_property ( |
609 | gobject_class, |
610 | PROP_SHOW_IMAGE, |
611 | g_param_spec_boolean ("show_image", NULL((void*)0), NULL((void*)0), |
612 | TRUE(!(0)), G_PARAM_READWRITE)); |
613 | |
614 | |
615 | g_object_class_install_property ( |
616 | gobject_class, |
617 | PROP_SPACING, |
618 | g_param_spec_uint ("spacing", NULL((void*)0), NULL((void*)0), |
619 | 0, |
620 | G_MAXINT2147483647, |
621 | DEFAULT_SPACING0, |
622 | G_PARAM_READWRITE)); |
623 | |
624 | g_object_class_install_property ( |
625 | gobject_class, |
626 | PROP_X_PADDING, |
627 | g_param_spec_int ("x_padding", NULL((void*)0), NULL((void*)0), |
628 | 0, |
629 | G_MAXINT2147483647, |
630 | DEFAULT_X_PADDING0, |
631 | G_PARAM_READWRITE)); |
632 | |
633 | g_object_class_install_property ( |
634 | gobject_class, |
635 | PROP_Y_PADDING, |
636 | g_param_spec_int ("y_padding", NULL((void*)0), NULL((void*)0), |
637 | 0, |
638 | G_MAXINT2147483647, |
639 | DEFAULT_Y_PADDING0, |
640 | G_PARAM_READWRITE)); |
641 | |
642 | g_object_class_install_property ( |
643 | gobject_class, |
644 | PROP_X_ALIGNMENT, |
645 | g_param_spec_float ("x_alignment", NULL((void*)0), NULL((void*)0), |
646 | 0.0, |
647 | 1.0, |
648 | DEFAULT_X_ALIGNMENT0.5, |
649 | G_PARAM_READWRITE)); |
650 | |
651 | g_object_class_install_property ( |
652 | gobject_class, |
653 | PROP_Y_ALIGNMENT, |
654 | g_param_spec_float ("y_alignment", NULL((void*)0), NULL((void*)0), |
655 | 0.0, |
656 | 1.0, |
657 | DEFAULT_Y_ALIGNMENT0.5, |
658 | G_PARAM_READWRITE)); |
659 | |
660 | g_object_class_install_property ( |
661 | gobject_class, |
662 | PROP_FILL, |
663 | g_param_spec_boolean ("fill", NULL((void*)0), NULL((void*)0), |
664 | FALSE(0), |
665 | G_PARAM_READWRITE)); |
666 | |
667 | } |
668 | |
669 | /* Private EelLabeledImage methods */ |
670 | static gboolean |
671 | is_fixed_height (const EelLabeledImage *labeled_image) |
672 | { |
673 | return labeled_image->details->fixed_image_height > 0; |
674 | } |
675 | |
676 | static EelDimensions |
677 | labeled_image_get_image_dimensions (const EelLabeledImage *labeled_image) |
678 | { |
679 | EelDimensions image_dimensions; |
680 | CtkRequisition image_requisition; |
681 | |
682 | g_assert (EEL_IS_LABELED_IMAGE (labeled_image))do { if ((((__extension__ ({ GTypeInstance *__inst = (GTypeInstance *) ((labeled_image)); GType __t = (eel_labeled_image_get_type ()); gboolean __r; if (!__inst) __r = (0); else if (__inst-> g_class && __inst->g_class->g_type == __t) __r = (!(0)); else __r = g_type_check_instance_is_a (__inst, __t); __r; }))))) ; else g_assertion_message_expr ("Eel", "eel-labeled-image.c" , 682, ((const char*) (__func__)), "EEL_IS_LABELED_IMAGE (labeled_image)" ); } while (0); |
683 | |
684 | if (!labeled_image_show_image (labeled_image)) |
685 | { |
686 | return eel_dimensions_empty; |
687 | } |
688 | |
689 | ctk_widget_get_preferred_size (labeled_image->details->image, &image_requisition, NULL((void*)0)); |
690 | |
691 | image_dimensions.width = (int) image_requisition.width; |
692 | image_dimensions.height = (int) image_requisition.height; |
693 | |
694 | if (is_fixed_height (labeled_image)) |
695 | { |
696 | image_dimensions.height = labeled_image->details->fixed_image_height; |
697 | } |
698 | |
699 | return image_dimensions; |
700 | } |
701 | |
702 | static EelDimensions |
703 | labeled_image_get_label_dimensions (const EelLabeledImage *labeled_image) |
704 | { |
705 | EelDimensions label_dimensions; |
706 | CtkRequisition label_requisition; |
707 | |
708 | g_assert (EEL_IS_LABELED_IMAGE (labeled_image))do { if ((((__extension__ ({ GTypeInstance *__inst = (GTypeInstance *) ((labeled_image)); GType __t = (eel_labeled_image_get_type ()); gboolean __r; if (!__inst) __r = (0); else if (__inst-> g_class && __inst->g_class->g_type == __t) __r = (!(0)); else __r = g_type_check_instance_is_a (__inst, __t); __r; }))))) ; else g_assertion_message_expr ("Eel", "eel-labeled-image.c" , 708, ((const char*) (__func__)), "EEL_IS_LABELED_IMAGE (labeled_image)" ); } while (0); |
709 | |
710 | if (!labeled_image_show_label (labeled_image)) |
711 | { |
712 | return eel_dimensions_empty; |
713 | } |
714 | |
715 | ctk_widget_get_preferred_size (labeled_image->details->label, &label_requisition, NULL((void*)0)); |
716 | |
717 | label_dimensions.width = (int) label_requisition.width; |
718 | label_dimensions.height = (int) label_requisition.height; |
719 | |
720 | return label_dimensions; |
721 | } |
722 | |
723 | static EelIRect |
724 | labeled_image_get_image_bounds_fill (const EelLabeledImage *labeled_image) |
725 | { |
726 | EelIRect image_bounds; |
727 | EelDimensions image_dimensions; |
728 | EelIRect content_bounds; |
729 | EelIRect bounds; |
730 | |
731 | g_assert (EEL_IS_LABELED_IMAGE (labeled_image))do { if ((((__extension__ ({ GTypeInstance *__inst = (GTypeInstance *) ((labeled_image)); GType __t = (eel_labeled_image_get_type ()); gboolean __r; if (!__inst) __r = (0); else if (__inst-> g_class && __inst->g_class->g_type == __t) __r = (!(0)); else __r = g_type_check_instance_is_a (__inst, __t); __r; }))))) ; else g_assertion_message_expr ("Eel", "eel-labeled-image.c" , 731, ((const char*) (__func__)), "EEL_IS_LABELED_IMAGE (labeled_image)" ); } while (0); |
732 | |
733 | image_dimensions = labeled_image_get_image_dimensions (labeled_image); |
734 | |
735 | if (eel_dimensions_are_empty (image_dimensions)) |
736 | { |
737 | return eel_irect_empty; |
738 | } |
739 | |
740 | content_bounds = labeled_image_get_content_bounds (labeled_image); |
741 | bounds = eel_ctk_widget_get_bounds (CTK_WIDGET (labeled_image)((((CtkWidget*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((labeled_image)), ((ctk_widget_get_type ()))))))); |
742 | |
743 | if (!labeled_image_show_label (labeled_image)) |
744 | { |
745 | image_bounds = bounds; |
746 | } |
747 | else |
748 | { |
749 | switch (labeled_image->details->label_position) |
750 | { |
751 | case CTK_POS_LEFT: |
752 | image_bounds.y0 = bounds.y0; |
753 | image_bounds.x0 = content_bounds.x1 - image_dimensions.width; |
754 | image_bounds.y1 = bounds.y1; |
755 | image_bounds.x1 = bounds.x1; |
756 | break; |
757 | |
758 | case CTK_POS_RIGHT: |
759 | image_bounds.y0 = bounds.y0; |
760 | image_bounds.x0 = bounds.x0; |
761 | image_bounds.y1 = bounds.y1; |
762 | image_bounds.x1 = content_bounds.x0 + image_dimensions.width; |
763 | break; |
764 | |
765 | case CTK_POS_TOP: |
766 | image_bounds.x0 = bounds.x0; |
767 | image_bounds.y0 = content_bounds.y1 - image_dimensions.height; |
768 | image_bounds.x1 = bounds.x1; |
769 | image_bounds.y1 = bounds.y1; |
770 | break; |
771 | |
772 | case CTK_POS_BOTTOM: |
773 | image_bounds.x0 = bounds.x0; |
774 | image_bounds.y0 = bounds.y0; |
775 | image_bounds.x1 = bounds.x1; |
776 | image_bounds.y1 = content_bounds.y0 + image_dimensions.height; |
777 | break; |
778 | |
779 | default: |
780 | image_bounds.x0 = 0; |
781 | image_bounds.y0 = 0; |
782 | image_bounds.x1 = 0; |
783 | image_bounds.y1 = 0; |
784 | g_assert_not_reached ()do { g_assertion_message_expr ("Eel", "eel-labeled-image.c", 784 , ((const char*) (__func__)), ((void*)0)); } while (0); |
785 | } |
786 | } |
787 | |
788 | return image_bounds; |
789 | } |
790 | |
791 | EelIRect |
792 | eel_labeled_image_get_image_bounds (const EelLabeledImage *labeled_image) |
793 | { |
794 | EelDimensions image_dimensions; |
795 | EelDimensions label_dimensions; |
796 | CtkRequisition image_requisition; |
797 | EelIRect image_bounds; |
798 | EelIRect content_bounds; |
799 | |
800 | g_return_val_if_fail (EEL_IS_LABELED_IMAGE (labeled_image), eel_irect_empty)do { if (((((__extension__ ({ GTypeInstance *__inst = (GTypeInstance *) ((labeled_image)); GType __t = (eel_labeled_image_get_type ()); gboolean __r; if (!__inst) __r = (0); else if (__inst-> g_class && __inst->g_class->g_type == __t) __r = (!(0)); else __r = g_type_check_instance_is_a (__inst, __t); __r; })))))) { } else { g_return_if_fail_warning ("Eel", ((const char*) (__func__)), "EEL_IS_LABELED_IMAGE (labeled_image)"); return (eel_irect_empty); } } while (0); |
801 | |
802 | if (labeled_image->details->fill) |
803 | { |
804 | return labeled_image_get_image_bounds_fill (labeled_image); |
805 | } |
806 | |
807 | /* get true real dimensions if we're in fixed height mode */ |
808 | if (is_fixed_height (labeled_image) && labeled_image_show_image (labeled_image)) |
809 | { |
810 | ctk_widget_get_preferred_size (labeled_image->details->image, &image_requisition, NULL((void*)0)); |
811 | image_dimensions.width = (int) image_requisition.width; |
812 | image_dimensions.height = (int) image_requisition.height; |
813 | } |
814 | else |
815 | { |
816 | image_dimensions = labeled_image_get_image_dimensions (labeled_image); |
817 | } |
818 | |
819 | label_dimensions = labeled_image_get_label_dimensions (labeled_image); |
820 | |
821 | if (eel_dimensions_are_empty (image_dimensions)) |
822 | { |
823 | return eel_irect_empty; |
824 | } |
825 | |
826 | content_bounds = labeled_image_get_content_bounds (labeled_image); |
827 | |
828 | if (!labeled_image_show_label (labeled_image)) |
829 | { |
830 | image_bounds.x0 = |
831 | content_bounds.x0 + |
832 | (eel_irect_get_width (content_bounds) - image_dimensions.width) / 2; |
833 | image_bounds.y0 = |
834 | content_bounds.y0 + |
835 | (eel_irect_get_height (content_bounds) - image_dimensions.height) / 2; |
836 | } |
837 | else |
838 | { |
839 | switch (labeled_image->details->label_position) |
840 | { |
841 | case CTK_POS_LEFT: |
842 | image_bounds.x0 = content_bounds.x1 - image_dimensions.width; |
843 | image_bounds.y0 = |
844 | content_bounds.y0 + |
845 | (eel_irect_get_height (content_bounds) - image_dimensions.height) / 2; |
846 | break; |
847 | |
848 | case CTK_POS_RIGHT: |
849 | image_bounds.x0 = content_bounds.x0; |
850 | image_bounds.y0 = |
851 | content_bounds.y0 + |
852 | (eel_irect_get_height (content_bounds) - image_dimensions.height) / 2; |
853 | break; |
854 | |
855 | case CTK_POS_TOP: |
856 | image_bounds.x0 = |
857 | content_bounds.x0 + |
858 | (eel_irect_get_width (content_bounds) - image_dimensions.width) / 2; |
859 | image_bounds.y0 = content_bounds.y1 - image_dimensions.height; |
860 | break; |
861 | |
862 | case CTK_POS_BOTTOM: |
863 | image_bounds.x0 = |
864 | content_bounds.x0 + |
865 | (eel_irect_get_width (content_bounds) - image_dimensions.width) / 2; |
866 | |
867 | if (is_fixed_height (labeled_image)) |
868 | { |
869 | image_bounds.y0 = content_bounds.y0 + eel_irect_get_height (content_bounds) |
870 | - image_dimensions.height |
871 | - label_dimensions.height |
872 | - labeled_image->details->spacing; |
873 | } |
874 | else |
875 | { |
876 | image_bounds.y0 = content_bounds.y0; |
877 | } |
878 | |
879 | break; |
880 | |
881 | default: |
882 | image_bounds.x0 = 0; |
883 | image_bounds.y0 = 0; |
884 | g_assert_not_reached ()do { g_assertion_message_expr ("Eel", "eel-labeled-image.c", 884 , ((const char*) (__func__)), ((void*)0)); } while (0); |
885 | } |
886 | } |
887 | |
888 | image_bounds.x1 = image_bounds.x0 + image_dimensions.width; |
889 | image_bounds.y1 = image_bounds.y0 + image_dimensions.height; |
890 | |
891 | return image_bounds; |
892 | } |
893 | |
894 | static EelIRect |
895 | labeled_image_get_label_bounds_fill (const EelLabeledImage *labeled_image) |
896 | { |
897 | EelIRect label_bounds; |
898 | EelDimensions label_dimensions; |
899 | EelIRect content_bounds; |
900 | EelIRect bounds; |
901 | |
902 | g_assert (EEL_IS_LABELED_IMAGE (labeled_image))do { if ((((__extension__ ({ GTypeInstance *__inst = (GTypeInstance *) ((labeled_image)); GType __t = (eel_labeled_image_get_type ()); gboolean __r; if (!__inst) __r = (0); else if (__inst-> g_class && __inst->g_class->g_type == __t) __r = (!(0)); else __r = g_type_check_instance_is_a (__inst, __t); __r; }))))) ; else g_assertion_message_expr ("Eel", "eel-labeled-image.c" , 902, ((const char*) (__func__)), "EEL_IS_LABELED_IMAGE (labeled_image)" ); } while (0); |
903 | |
904 | label_dimensions = labeled_image_get_label_dimensions (labeled_image); |
905 | |
906 | if (eel_dimensions_are_empty (label_dimensions)) |
907 | { |
908 | return eel_irect_empty; |
909 | } |
910 | |
911 | content_bounds = labeled_image_get_content_bounds (labeled_image); |
912 | bounds = eel_ctk_widget_get_bounds (CTK_WIDGET (labeled_image)((((CtkWidget*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((labeled_image)), ((ctk_widget_get_type ()))))))); |
913 | |
914 | /* Only the label is shown */ |
915 | if (!labeled_image_show_image (labeled_image)) |
916 | { |
917 | label_bounds = bounds; |
918 | /* Both label and image are shown */ |
919 | } |
920 | else |
921 | { |
922 | switch (labeled_image->details->label_position) |
923 | { |
924 | case CTK_POS_LEFT: |
925 | label_bounds.y0 = bounds.y0; |
926 | label_bounds.x0 = bounds.x0; |
927 | label_bounds.y1 = bounds.y1; |
928 | label_bounds.x1 = content_bounds.x0 + label_dimensions.width; |
929 | break; |
930 | |
931 | case CTK_POS_RIGHT: |
932 | label_bounds.y0 = bounds.y0; |
933 | label_bounds.x0 = content_bounds.x1 - label_dimensions.width; |
934 | label_bounds.y1 = bounds.y1; |
935 | label_bounds.x1 = bounds.x1; |
936 | break; |
937 | |
938 | case CTK_POS_TOP: |
939 | label_bounds.x0 = bounds.x0; |
940 | label_bounds.y0 = bounds.y0; |
941 | label_bounds.x1 = bounds.x1; |
942 | label_bounds.y1 = content_bounds.y0 + label_dimensions.height; |
943 | break; |
944 | |
945 | case CTK_POS_BOTTOM: |
946 | label_bounds.x0 = bounds.x0; |
947 | label_bounds.y0 = content_bounds.y1 - label_dimensions.height; |
948 | label_bounds.x1 = bounds.x1; |
949 | label_bounds.y1 = bounds.y1; |
950 | break; |
951 | |
952 | default: |
953 | label_bounds.x0 = 0; |
954 | label_bounds.y0 = 0; |
955 | label_bounds.x1 = 0; |
956 | label_bounds.y1 = 0; |
957 | g_assert_not_reached ()do { g_assertion_message_expr ("Eel", "eel-labeled-image.c", 957 , ((const char*) (__func__)), ((void*)0)); } while (0); |
958 | } |
959 | } |
960 | |
961 | return label_bounds; |
962 | } |
963 | |
964 | EelIRect |
965 | eel_labeled_image_get_label_bounds (const EelLabeledImage *labeled_image) |
966 | { |
967 | EelIRect label_bounds; |
968 | EelDimensions label_dimensions; |
969 | EelIRect content_bounds; |
970 | |
971 | g_return_val_if_fail (EEL_IS_LABELED_IMAGE (labeled_image), eel_irect_empty)do { if (((((__extension__ ({ GTypeInstance *__inst = (GTypeInstance *) ((labeled_image)); GType __t = (eel_labeled_image_get_type ()); gboolean __r; if (!__inst) __r = (0); else if (__inst-> g_class && __inst->g_class->g_type == __t) __r = (!(0)); else __r = g_type_check_instance_is_a (__inst, __t); __r; })))))) { } else { g_return_if_fail_warning ("Eel", ((const char*) (__func__)), "EEL_IS_LABELED_IMAGE (labeled_image)"); return (eel_irect_empty); } } while (0); |
972 | |
973 | if (labeled_image->details->fill) |
974 | { |
975 | return labeled_image_get_label_bounds_fill (labeled_image); |
976 | } |
977 | |
978 | label_dimensions = labeled_image_get_label_dimensions (labeled_image); |
979 | |
980 | if (eel_dimensions_are_empty (label_dimensions)) |
981 | { |
982 | return eel_irect_empty; |
983 | } |
984 | |
985 | content_bounds = labeled_image_get_content_bounds (labeled_image); |
986 | |
987 | /* Only the label is shown */ |
988 | if (!labeled_image_show_image (labeled_image)) |
989 | { |
990 | label_bounds.x0 = |
991 | content_bounds.x0 + |
992 | (eel_irect_get_width (content_bounds) - label_dimensions.width) / 2; |
993 | label_bounds.y0 = |
994 | content_bounds.y0 + |
995 | (eel_irect_get_height (content_bounds) - label_dimensions.height) / 2; |
996 | /* Both label and image are shown */ |
997 | } |
998 | else |
999 | { |
1000 | switch (labeled_image->details->label_position) |
1001 | { |
1002 | case CTK_POS_LEFT: |
1003 | label_bounds.x0 = content_bounds.x0; |
1004 | label_bounds.y0 = |
1005 | content_bounds.y0 + |
1006 | (eel_irect_get_height (content_bounds) - label_dimensions.height) / 2; |
1007 | break; |
1008 | |
1009 | case CTK_POS_RIGHT: |
1010 | label_bounds.x0 = content_bounds.x1 - label_dimensions.width; |
1011 | label_bounds.y0 = |
1012 | content_bounds.y0 + |
1013 | (eel_irect_get_height (content_bounds) - label_dimensions.height) / 2; |
1014 | break; |
1015 | |
1016 | case CTK_POS_TOP: |
1017 | label_bounds.x0 = |
1018 | content_bounds.x0 + |
1019 | (eel_irect_get_width (content_bounds) - label_dimensions.width) / 2; |
1020 | label_bounds.y0 = content_bounds.y0; |
1021 | break; |
1022 | |
1023 | case CTK_POS_BOTTOM: |
1024 | label_bounds.x0 = |
1025 | content_bounds.x0 + |
1026 | (eel_irect_get_width (content_bounds) - label_dimensions.width) / 2; |
1027 | label_bounds.y0 = content_bounds.y1 - label_dimensions.height; |
1028 | break; |
1029 | |
1030 | default: |
1031 | label_bounds.x0 = 0; |
1032 | label_bounds.y0 = 0; |
1033 | g_assert_not_reached ()do { g_assertion_message_expr ("Eel", "eel-labeled-image.c", 1033 , ((const char*) (__func__)), ((void*)0)); } while (0); |
1034 | } |
1035 | } |
1036 | |
1037 | label_bounds.x1 = label_bounds.x0 + label_dimensions.width; |
1038 | label_bounds.y1 = label_bounds.y0 + label_dimensions.height; |
1039 | |
1040 | return label_bounds; |
1041 | } |
1042 | |
1043 | static void |
1044 | labeled_image_update_alignments (EelLabeledImage *labeled_image) |
1045 | { |
1046 | |
1047 | g_assert (EEL_IS_LABELED_IMAGE (labeled_image))do { if ((((__extension__ ({ GTypeInstance *__inst = (GTypeInstance *) ((labeled_image)); GType __t = (eel_labeled_image_get_type ()); gboolean __r; if (!__inst) __r = (0); else if (__inst-> g_class && __inst->g_class->g_type == __t) __r = (!(0)); else __r = g_type_check_instance_is_a (__inst, __t); __r; }))))) ; else g_assertion_message_expr ("Eel", "eel-labeled-image.c" , 1047, ((const char*) (__func__)), "EEL_IS_LABELED_IMAGE (labeled_image)" ); } while (0); |
1048 | |
1049 | if (labeled_image->details->label != NULL((void*)0)) |
1050 | { |
1051 | if (labeled_image->details->fill) |
1052 | { |
1053 | float x_alignment; |
1054 | float y_alignment; |
1055 | |
1056 | x_alignment = ctk_label_get_xalign (CTK_LABEL (labeled_image->details->label)((((CtkLabel*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((labeled_image->details->label)), ((ctk_label_get_type ()))))))); |
1057 | y_alignment = ctk_label_get_yalign (CTK_LABEL (labeled_image->details->label)((((CtkLabel*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((labeled_image->details->label)), ((ctk_label_get_type ()))))))); |
1058 | |
1059 | /* Only the label is shown */ |
1060 | if (!labeled_image_show_image (labeled_image)) |
1061 | { |
1062 | x_alignment = 0.5; |
1063 | y_alignment = 0.5; |
1064 | /* Both label and image are shown */ |
1065 | } |
1066 | else |
1067 | { |
1068 | switch (labeled_image->details->label_position) |
1069 | { |
1070 | case CTK_POS_LEFT: |
1071 | x_alignment = 1.0; |
1072 | y_alignment = 0.5; |
1073 | break; |
1074 | |
1075 | case CTK_POS_RIGHT: |
1076 | x_alignment = 0.0; |
1077 | y_alignment = 0.5; |
1078 | break; |
1079 | |
1080 | case CTK_POS_TOP: |
1081 | x_alignment = 0.5; |
1082 | y_alignment = 1.0; |
1083 | break; |
1084 | |
1085 | case CTK_POS_BOTTOM: |
1086 | x_alignment = 0.5; |
1087 | y_alignment = 0.0; |
1088 | break; |
1089 | } |
1090 | |
1091 | } |
1092 | |
1093 | ctk_label_set_xalign (CTK_LABEL (labeled_image->details->label)((((CtkLabel*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((labeled_image->details->label)), ((ctk_label_get_type ())))))), x_alignment); |
1094 | ctk_label_set_yalign (CTK_LABEL (labeled_image->details->label)((((CtkLabel*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((labeled_image->details->label)), ((ctk_label_get_type ())))))), y_alignment); |
1095 | } |
1096 | } |
1097 | |
1098 | if (labeled_image->details->image != NULL((void*)0)) |
1099 | { |
1100 | if (labeled_image->details->fill) |
1101 | { |
1102 | float x_alignment; |
1103 | float y_alignment; |
1104 | |
1105 | x_alignment = ctk_widget_get_halign (labeled_image->details->image); |
1106 | y_alignment = ctk_widget_get_valign (labeled_image->details->image); |
Value stored to 'y_alignment' is never read | |
1107 | |
1108 | /* Only the image is shown */ |
1109 | if (!labeled_image_show_label (labeled_image)) |
1110 | { |
1111 | x_alignment = 0.5; |
1112 | y_alignment = 0.5; |
1113 | /* Both label and image are shown */ |
1114 | } |
1115 | else |
1116 | { |
1117 | switch (labeled_image->details->label_position) |
1118 | { |
1119 | case CTK_POS_LEFT: |
1120 | x_alignment = 0.0; |
1121 | y_alignment = 0.5; |
1122 | break; |
1123 | |
1124 | case CTK_POS_RIGHT: |
1125 | x_alignment = 1.0; |
1126 | y_alignment = 0.5; |
1127 | break; |
1128 | |
1129 | case CTK_POS_TOP: |
1130 | x_alignment = 0.5; |
1131 | y_alignment = 0.0; |
1132 | break; |
1133 | |
1134 | case CTK_POS_BOTTOM: |
1135 | x_alignment = 0.5; |
1136 | y_alignment = 1.0; |
1137 | break; |
1138 | } |
1139 | } |
1140 | |
1141 | ctk_widget_set_halign (labeled_image->details->image, x_alignment); |
1142 | ctk_widget_set_valign (labeled_image->details->image, y_alignment); |
1143 | } |
1144 | } |
1145 | } |
1146 | |
1147 | static EelDimensions |
1148 | labeled_image_get_content_dimensions (const EelLabeledImage *labeled_image) |
1149 | { |
1150 | EelDimensions image_dimensions; |
1151 | EelDimensions label_dimensions; |
1152 | EelDimensions content_dimensions; |
1153 | |
1154 | g_assert (EEL_IS_LABELED_IMAGE (labeled_image))do { if ((((__extension__ ({ GTypeInstance *__inst = (GTypeInstance *) ((labeled_image)); GType __t = (eel_labeled_image_get_type ()); gboolean __r; if (!__inst) __r = (0); else if (__inst-> g_class && __inst->g_class->g_type == __t) __r = (!(0)); else __r = g_type_check_instance_is_a (__inst, __t); __r; }))))) ; else g_assertion_message_expr ("Eel", "eel-labeled-image.c" , 1154, ((const char*) (__func__)), "EEL_IS_LABELED_IMAGE (labeled_image)" ); } while (0); |
1155 | |
1156 | image_dimensions = labeled_image_get_image_dimensions (labeled_image); |
1157 | label_dimensions = labeled_image_get_label_dimensions (labeled_image); |
1158 | |
1159 | content_dimensions = eel_dimensions_empty; |
1160 | |
1161 | /* Both shown */ |
1162 | if (!eel_dimensions_are_empty (image_dimensions) && !eel_dimensions_are_empty (label_dimensions)) |
1163 | { |
1164 | content_dimensions.width = |
1165 | image_dimensions.width + labeled_image->details->spacing + label_dimensions.width; |
1166 | switch (labeled_image->details->label_position) |
1167 | { |
1168 | case CTK_POS_LEFT: |
1169 | case CTK_POS_RIGHT: |
1170 | content_dimensions.width = |
1171 | image_dimensions.width + labeled_image->details->spacing + label_dimensions.width; |
1172 | content_dimensions.height = MAX (image_dimensions.height, label_dimensions.height)(((image_dimensions.height) > (label_dimensions.height)) ? (image_dimensions.height) : (label_dimensions.height)); |
1173 | break; |
1174 | |
1175 | case CTK_POS_TOP: |
1176 | case CTK_POS_BOTTOM: |
1177 | content_dimensions.width = MAX (image_dimensions.width, label_dimensions.width)(((image_dimensions.width) > (label_dimensions.width)) ? ( image_dimensions.width) : (label_dimensions.width)); |
1178 | content_dimensions.height = |
1179 | image_dimensions.height + labeled_image->details->spacing + label_dimensions.height; |
1180 | break; |
1181 | } |
1182 | /* Only image shown */ |
1183 | } |
1184 | else if (!eel_dimensions_are_empty (image_dimensions)) |
1185 | { |
1186 | content_dimensions.width = image_dimensions.width; |
1187 | content_dimensions.height = image_dimensions.height; |
1188 | /* Only label shown */ |
1189 | } |
1190 | else |
1191 | { |
1192 | content_dimensions.width = label_dimensions.width; |
1193 | content_dimensions.height = label_dimensions.height; |
1194 | } |
1195 | |
1196 | return content_dimensions; |
1197 | } |
1198 | |
1199 | static EelIRect |
1200 | labeled_image_get_content_bounds (const EelLabeledImage *labeled_image) |
1201 | { |
1202 | EelDimensions content_dimensions; |
1203 | EelIRect content_bounds; |
1204 | EelIRect bounds; |
1205 | |
1206 | g_assert (EEL_IS_LABELED_IMAGE (labeled_image))do { if ((((__extension__ ({ GTypeInstance *__inst = (GTypeInstance *) ((labeled_image)); GType __t = (eel_labeled_image_get_type ()); gboolean __r; if (!__inst) __r = (0); else if (__inst-> g_class && __inst->g_class->g_type == __t) __r = (!(0)); else __r = g_type_check_instance_is_a (__inst, __t); __r; }))))) ; else g_assertion_message_expr ("Eel", "eel-labeled-image.c" , 1206, ((const char*) (__func__)), "EEL_IS_LABELED_IMAGE (labeled_image)" ); } while (0); |
1207 | |
1208 | bounds = eel_ctk_widget_get_bounds (CTK_WIDGET (labeled_image)((((CtkWidget*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((labeled_image)), ((ctk_widget_get_type ()))))))); |
1209 | |
1210 | content_dimensions = labeled_image_get_content_dimensions (labeled_image); |
1211 | content_bounds = eel_irect_align (bounds, |
1212 | content_dimensions.width, |
1213 | content_dimensions.height, |
1214 | labeled_image->details->x_alignment, |
1215 | labeled_image->details->y_alignment); |
1216 | |
1217 | return content_bounds; |
1218 | } |
1219 | |
1220 | static void |
1221 | labeled_image_ensure_label (EelLabeledImage *labeled_image) |
1222 | { |
1223 | g_assert (EEL_IS_LABELED_IMAGE (labeled_image))do { if ((((__extension__ ({ GTypeInstance *__inst = (GTypeInstance *) ((labeled_image)); GType __t = (eel_labeled_image_get_type ()); gboolean __r; if (!__inst) __r = (0); else if (__inst-> g_class && __inst->g_class->g_type == __t) __r = (!(0)); else __r = g_type_check_instance_is_a (__inst, __t); __r; }))))) ; else g_assertion_message_expr ("Eel", "eel-labeled-image.c" , 1223, ((const char*) (__func__)), "EEL_IS_LABELED_IMAGE (labeled_image)" ); } while (0); |
1224 | |
1225 | if (labeled_image->details->label != NULL((void*)0)) |
1226 | { |
1227 | return; |
1228 | } |
1229 | |
1230 | labeled_image->details->label = ctk_label_new (NULL((void*)0)); |
1231 | ctk_container_add (CTK_CONTAINER (labeled_image)((((CtkContainer*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((labeled_image)), ((ctk_container_get_type ())))))), labeled_image->details->label); |
1232 | ctk_widget_show (labeled_image->details->label); |
1233 | } |
1234 | |
1235 | static void |
1236 | labeled_image_ensure_image (EelLabeledImage *labeled_image) |
1237 | { |
1238 | g_assert (EEL_IS_LABELED_IMAGE (labeled_image))do { if ((((__extension__ ({ GTypeInstance *__inst = (GTypeInstance *) ((labeled_image)); GType __t = (eel_labeled_image_get_type ()); gboolean __r; if (!__inst) __r = (0); else if (__inst-> g_class && __inst->g_class->g_type == __t) __r = (!(0)); else __r = g_type_check_instance_is_a (__inst, __t); __r; }))))) ; else g_assertion_message_expr ("Eel", "eel-labeled-image.c" , 1238, ((const char*) (__func__)), "EEL_IS_LABELED_IMAGE (labeled_image)" ); } while (0); |
1239 | |
1240 | if (labeled_image->details->image != NULL((void*)0)) |
1241 | { |
1242 | return; |
1243 | } |
1244 | |
1245 | labeled_image->details->image = ctk_image_new (); |
1246 | ctk_container_add (CTK_CONTAINER (labeled_image)((((CtkContainer*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((labeled_image)), ((ctk_container_get_type ())))))), labeled_image->details->image); |
1247 | ctk_widget_show (labeled_image->details->image); |
1248 | } |
1249 | |
1250 | static gboolean |
1251 | labeled_image_show_image (const EelLabeledImage *labeled_image) |
1252 | { |
1253 | g_assert (EEL_IS_LABELED_IMAGE (labeled_image))do { if ((((__extension__ ({ GTypeInstance *__inst = (GTypeInstance *) ((labeled_image)); GType __t = (eel_labeled_image_get_type ()); gboolean __r; if (!__inst) __r = (0); else if (__inst-> g_class && __inst->g_class->g_type == __t) __r = (!(0)); else __r = g_type_check_instance_is_a (__inst, __t); __r; }))))) ; else g_assertion_message_expr ("Eel", "eel-labeled-image.c" , 1253, ((const char*) (__func__)), "EEL_IS_LABELED_IMAGE (labeled_image)" ); } while (0); |
1254 | |
1255 | return labeled_image->details->image != NULL((void*)0) && labeled_image->details->show_image; |
1256 | } |
1257 | |
1258 | static gboolean |
1259 | labeled_image_show_label (const EelLabeledImage *labeled_image) |
1260 | { |
1261 | g_assert (EEL_IS_LABELED_IMAGE (labeled_image))do { if ((((__extension__ ({ GTypeInstance *__inst = (GTypeInstance *) ((labeled_image)); GType __t = (eel_labeled_image_get_type ()); gboolean __r; if (!__inst) __r = (0); else if (__inst-> g_class && __inst->g_class->g_type == __t) __r = (!(0)); else __r = g_type_check_instance_is_a (__inst, __t); __r; }))))) ; else g_assertion_message_expr ("Eel", "eel-labeled-image.c" , 1261, ((const char*) (__func__)), "EEL_IS_LABELED_IMAGE (labeled_image)" ); } while (0); |
1262 | |
1263 | return labeled_image->details->label != NULL((void*)0) && labeled_image->details->show_label; |
1264 | } |
1265 | |
1266 | /** |
1267 | * eel_labeled_image_new: |
1268 | * @text: Text to use for label or NULL. |
1269 | * @pixbuf: Pixbuf to use for image or NULL. |
1270 | * |
1271 | * Returns A newly allocated EelLabeledImage. If the &text parameter is not |
1272 | * NULL then the LabeledImage will show a label. If the &pixbuf parameter is not |
1273 | * NULL then the LabeledImage will show a pixbuf. Either of these can be NULL at |
1274 | * creation time. |
1275 | * |
1276 | * Later in the lifetime of the widget you can invoke methods that affect the |
1277 | * label and/or the image. If at creation time these were NULL, then they will |
1278 | * be created as neeeded. |
1279 | * |
1280 | * Thus, using this widget in place of EelImage or EelLabel is "free" with |
1281 | * only the CtkWidget and function call overhead. |
1282 | * |
1283 | */ |
1284 | CtkWidget* |
1285 | eel_labeled_image_new (const char *text, |
1286 | GdkPixbuf *pixbuf) |
1287 | { |
1288 | EelLabeledImage *labeled_image; |
1289 | |
1290 | labeled_image = EEL_LABELED_IMAGE (ctk_widget_new (eel_labeled_image_get_type (), NULL))((((EelLabeledImage*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((ctk_widget_new (eel_labeled_image_get_type (), ((void*)0 )))), (eel_labeled_image_get_type()))))); |
1291 | |
1292 | if (text != NULL((void*)0)) |
1293 | { |
1294 | eel_labeled_image_set_text (labeled_image, text); |
1295 | } |
1296 | |
1297 | if (pixbuf != NULL((void*)0)) |
1298 | { |
1299 | eel_labeled_image_set_pixbuf (labeled_image, pixbuf); |
1300 | } |
1301 | |
1302 | labeled_image_update_alignments (labeled_image); |
1303 | |
1304 | return CTK_WIDGET (labeled_image)((((CtkWidget*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((labeled_image)), ((ctk_widget_get_type ())))))); |
1305 | } |
1306 | |
1307 | /** |
1308 | * eel_labeled_image_new_from_file_name: |
1309 | * @text: Text to use for label or NULL. |
1310 | * @file_name: File name of picture to use for pixbuf. Cannot be NULL. |
1311 | * |
1312 | * Returns A newly allocated EelLabeledImage. If the &text parameter is not |
1313 | * NULL then the LabeledImage will show a label. |
1314 | * |
1315 | */ |
1316 | CtkWidget* |
1317 | eel_labeled_image_new_from_file_name (const char *text, |
1318 | const char *pixbuf_file_name) |
1319 | { |
1320 | EelLabeledImage *labeled_image; |
1321 | |
1322 | g_return_val_if_fail (pixbuf_file_name != NULL, NULL)do { if ((pixbuf_file_name != ((void*)0))) { } else { g_return_if_fail_warning ("Eel", ((const char*) (__func__)), "pixbuf_file_name != NULL" ); return (((void*)0)); } } while (0); |
1323 | |
1324 | labeled_image = EEL_LABELED_IMAGE (eel_labeled_image_new (text, NULL))((((EelLabeledImage*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((eel_labeled_image_new (text, ((void*)0)))), (eel_labeled_image_get_type ()))))); |
1325 | eel_labeled_image_set_pixbuf_from_file_name (labeled_image, pixbuf_file_name); |
1326 | return CTK_WIDGET (labeled_image)((((CtkWidget*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((labeled_image)), ((ctk_widget_get_type ())))))); |
1327 | } |
1328 | |
1329 | /** |
1330 | * eel_labeled_image_set_label_position: |
1331 | * @labeled_image: A EelLabeledImage. |
1332 | * @label_position: The position of the label with respect to the image. |
1333 | * |
1334 | * Set the position of the label with respect to the image as follows: |
1335 | * |
1336 | * CTK_POS_LEFT: |
1337 | * [ <label> <image> ] |
1338 | * |
1339 | * CTK_POS_RIGHT: |
1340 | * [ <image> <label> ] |
1341 | * |
1342 | * CTK_POS_TOP: |
1343 | * [ <label> ] |
1344 | * [ <image> ] |
1345 | * |
1346 | * CTK_POS_BOTTOM: |
1347 | * [ <image> ] |
1348 | * [ <label> ] |
1349 | * |
1350 | */ |
1351 | void |
1352 | eel_labeled_image_set_label_position (EelLabeledImage *labeled_image, |
1353 | CtkPositionType label_position) |
1354 | { |
1355 | g_return_if_fail (EEL_IS_LABELED_IMAGE (labeled_image))do { if (((((__extension__ ({ GTypeInstance *__inst = (GTypeInstance *) ((labeled_image)); GType __t = (eel_labeled_image_get_type ()); gboolean __r; if (!__inst) __r = (0); else if (__inst-> g_class && __inst->g_class->g_type == __t) __r = (!(0)); else __r = g_type_check_instance_is_a (__inst, __t); __r; })))))) { } else { g_return_if_fail_warning ("Eel", ((const char*) (__func__)), "EEL_IS_LABELED_IMAGE (labeled_image)"); return; } } while (0); |
1356 | g_return_if_fail (label_position >= CTK_POS_LEFT)do { if ((label_position >= CTK_POS_LEFT)) { } else { g_return_if_fail_warning ("Eel", ((const char*) (__func__)), "label_position >= CTK_POS_LEFT" ); return; } } while (0); |
1357 | g_return_if_fail (label_position <= CTK_POS_BOTTOM)do { if ((label_position <= CTK_POS_BOTTOM)) { } else { g_return_if_fail_warning ("Eel", ((const char*) (__func__)), "label_position <= CTK_POS_BOTTOM" ); return; } } while (0); |
1358 | |
1359 | if (labeled_image->details->label_position == label_position) |
1360 | { |
1361 | return; |
1362 | } |
1363 | |
1364 | labeled_image->details->label_position = label_position; |
1365 | |
1366 | labeled_image_update_alignments (labeled_image); |
1367 | |
1368 | ctk_widget_queue_resize (CTK_WIDGET (labeled_image)((((CtkWidget*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((labeled_image)), ((ctk_widget_get_type ()))))))); |
1369 | } |
1370 | |
1371 | /** |
1372 | * eel_labeled_image_get_label_postiion: |
1373 | * @labeled_image: A EelLabeledImage. |
1374 | * |
1375 | * Returns an enumeration indicating the position of the label with respect to the image. |
1376 | */ |
1377 | CtkPositionType |
1378 | eel_labeled_image_get_label_position (const EelLabeledImage *labeled_image) |
1379 | { |
1380 | g_return_val_if_fail (EEL_IS_LABELED_IMAGE (labeled_image), 0)do { if (((((__extension__ ({ GTypeInstance *__inst = (GTypeInstance *) ((labeled_image)); GType __t = (eel_labeled_image_get_type ()); gboolean __r; if (!__inst) __r = (0); else if (__inst-> g_class && __inst->g_class->g_type == __t) __r = (!(0)); else __r = g_type_check_instance_is_a (__inst, __t); __r; })))))) { } else { g_return_if_fail_warning ("Eel", ((const char*) (__func__)), "EEL_IS_LABELED_IMAGE (labeled_image)"); return (0); } } while (0); |
1381 | |
1382 | return labeled_image->details->label_position; |
1383 | } |
1384 | |
1385 | /** |
1386 | * eel_labeled_image_set_show_label: |
1387 | * @labeled_image: A EelLabeledImage. |
1388 | * @show_image: A boolean value indicating whether the label should be shown. |
1389 | * |
1390 | * Update the labeled image to either show or hide the internal label widget. |
1391 | * This function doesnt have any effect if the LabeledImage doesnt already |
1392 | * contain an label. |
1393 | */ |
1394 | void |
1395 | eel_labeled_image_set_show_label (EelLabeledImage *labeled_image, |
1396 | gboolean show_label) |
1397 | { |
1398 | g_return_if_fail (EEL_IS_LABELED_IMAGE (labeled_image))do { if (((((__extension__ ({ GTypeInstance *__inst = (GTypeInstance *) ((labeled_image)); GType __t = (eel_labeled_image_get_type ()); gboolean __r; if (!__inst) __r = (0); else if (__inst-> g_class && __inst->g_class->g_type == __t) __r = (!(0)); else __r = g_type_check_instance_is_a (__inst, __t); __r; })))))) { } else { g_return_if_fail_warning ("Eel", ((const char*) (__func__)), "EEL_IS_LABELED_IMAGE (labeled_image)"); return; } } while (0); |
1399 | |
1400 | if (labeled_image->details->show_label == show_label) |
1401 | { |
1402 | return; |
1403 | } |
1404 | |
1405 | labeled_image->details->show_label = show_label; |
1406 | |
1407 | if (labeled_image->details->label != NULL((void*)0)) |
1408 | { |
1409 | if (labeled_image->details->show_label) |
1410 | { |
1411 | ctk_widget_show (labeled_image->details->label); |
1412 | } |
1413 | else |
1414 | { |
1415 | ctk_widget_hide (labeled_image->details->label); |
1416 | } |
1417 | } |
1418 | |
1419 | labeled_image_update_alignments (labeled_image); |
1420 | |
1421 | ctk_widget_queue_resize (CTK_WIDGET (labeled_image)((((CtkWidget*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((labeled_image)), ((ctk_widget_get_type ()))))))); |
1422 | } |
1423 | |
1424 | /** |
1425 | * eel_labeled_image_get_show_label: |
1426 | * @labeled_image: A EelLabeledImage. |
1427 | * |
1428 | * Returns a boolean value indicating whether the internal label is shown. |
1429 | */ |
1430 | gboolean |
1431 | eel_labeled_image_get_show_label (const EelLabeledImage *labeled_image) |
1432 | { |
1433 | g_return_val_if_fail (EEL_IS_LABELED_IMAGE (labeled_image), 0)do { if (((((__extension__ ({ GTypeInstance *__inst = (GTypeInstance *) ((labeled_image)); GType __t = (eel_labeled_image_get_type ()); gboolean __r; if (!__inst) __r = (0); else if (__inst-> g_class && __inst->g_class->g_type == __t) __r = (!(0)); else __r = g_type_check_instance_is_a (__inst, __t); __r; })))))) { } else { g_return_if_fail_warning ("Eel", ((const char*) (__func__)), "EEL_IS_LABELED_IMAGE (labeled_image)"); return (0); } } while (0); |
1434 | |
1435 | return labeled_image->details->show_label; |
1436 | } |
1437 | |
1438 | /** |
1439 | * eel_labeled_image_set_show_image: |
1440 | * @labeled_image: A EelLabeledImage. |
1441 | * @show_image: A boolean value indicating whether the image should be shown. |
1442 | * |
1443 | * Update the labeled image to either show or hide the internal image widget. |
1444 | * This function doesnt have any effect if the LabeledImage doesnt already |
1445 | * contain an image. |
1446 | */ |
1447 | void |
1448 | eel_labeled_image_set_show_image (EelLabeledImage *labeled_image, |
1449 | gboolean show_image) |
1450 | { |
1451 | g_return_if_fail (EEL_IS_LABELED_IMAGE (labeled_image))do { if (((((__extension__ ({ GTypeInstance *__inst = (GTypeInstance *) ((labeled_image)); GType __t = (eel_labeled_image_get_type ()); gboolean __r; if (!__inst) __r = (0); else if (__inst-> g_class && __inst->g_class->g_type == __t) __r = (!(0)); else __r = g_type_check_instance_is_a (__inst, __t); __r; })))))) { } else { g_return_if_fail_warning ("Eel", ((const char*) (__func__)), "EEL_IS_LABELED_IMAGE (labeled_image)"); return; } } while (0); |
1452 | |
1453 | if (labeled_image->details->show_image == show_image) |
1454 | { |
1455 | return; |
1456 | } |
1457 | |
1458 | labeled_image->details->show_image = show_image; |
1459 | |
1460 | if (labeled_image->details->image != NULL((void*)0)) |
1461 | { |
1462 | if (labeled_image->details->show_image) |
1463 | { |
1464 | ctk_widget_show (labeled_image->details->image); |
1465 | } |
1466 | else |
1467 | { |
1468 | ctk_widget_hide (labeled_image->details->image); |
1469 | } |
1470 | } |
1471 | |
1472 | labeled_image_update_alignments (labeled_image); |
1473 | |
1474 | ctk_widget_queue_resize (CTK_WIDGET (labeled_image)((((CtkWidget*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((labeled_image)), ((ctk_widget_get_type ()))))))); |
1475 | } |
1476 | |
1477 | /** |
1478 | * eel_labeled_image_get_show_image: |
1479 | * @labeled_image: A EelLabeledImage. |
1480 | * |
1481 | * Returns a boolean value indicating whether the internal image is shown. |
1482 | */ |
1483 | gboolean |
1484 | eel_labeled_image_get_show_image (const EelLabeledImage *labeled_image) |
1485 | { |
1486 | g_return_val_if_fail (EEL_IS_LABELED_IMAGE (labeled_image), 0)do { if (((((__extension__ ({ GTypeInstance *__inst = (GTypeInstance *) ((labeled_image)); GType __t = (eel_labeled_image_get_type ()); gboolean __r; if (!__inst) __r = (0); else if (__inst-> g_class && __inst->g_class->g_type == __t) __r = (!(0)); else __r = g_type_check_instance_is_a (__inst, __t); __r; })))))) { } else { g_return_if_fail_warning ("Eel", ((const char*) (__func__)), "EEL_IS_LABELED_IMAGE (labeled_image)"); return (0); } } while (0); |
1487 | |
1488 | return labeled_image->details->show_image; |
1489 | } |
1490 | |
1491 | |
1492 | /** |
1493 | * eel_labeled_image_set_fixed_image_height: |
1494 | * @labeled_image: A EelLabeledImage. |
1495 | * @fixed_image_height: The new fixed image height. |
1496 | * |
1497 | * Normally, we measure the height of images, but it's sometimes useful |
1498 | * to use a fixed height for all the images. This routine sets the |
1499 | * image height to the passed in value |
1500 | * |
1501 | */ |
1502 | void |
1503 | eel_labeled_image_set_fixed_image_height (EelLabeledImage *labeled_image, |
1504 | int new_height) |
1505 | { |
1506 | g_return_if_fail (EEL_IS_LABELED_IMAGE (labeled_image))do { if (((((__extension__ ({ GTypeInstance *__inst = (GTypeInstance *) ((labeled_image)); GType __t = (eel_labeled_image_get_type ()); gboolean __r; if (!__inst) __r = (0); else if (__inst-> g_class && __inst->g_class->g_type == __t) __r = (!(0)); else __r = g_type_check_instance_is_a (__inst, __t); __r; })))))) { } else { g_return_if_fail_warning ("Eel", ((const char*) (__func__)), "EEL_IS_LABELED_IMAGE (labeled_image)"); return; } } while (0); |
1507 | |
1508 | if (labeled_image->details->fixed_image_height == new_height) |
1509 | { |
1510 | return; |
1511 | } |
1512 | |
1513 | labeled_image->details->fixed_image_height = new_height; |
1514 | |
1515 | labeled_image_update_alignments (labeled_image); |
1516 | |
1517 | ctk_widget_queue_resize (CTK_WIDGET (labeled_image)((((CtkWidget*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((labeled_image)), ((ctk_widget_get_type ()))))))); |
1518 | } |
1519 | |
1520 | /** |
1521 | * eel_labeled_image_set_selected: |
1522 | * @labeled_image: A EelLabeledImage. |
1523 | * @selected: A boolean value indicating whether the labeled image |
1524 | * should be selected. |
1525 | * |
1526 | * Selects or deselects the labeled image. |
1527 | * |
1528 | */ |
1529 | void |
1530 | eel_labeled_image_set_selected (EelLabeledImage *labeled_image, |
1531 | gboolean selected) |
1532 | { |
1533 | CtkStateType state; |
1534 | g_return_if_fail (EEL_IS_LABELED_IMAGE (labeled_image))do { if (((((__extension__ ({ GTypeInstance *__inst = (GTypeInstance *) ((labeled_image)); GType __t = (eel_labeled_image_get_type ()); gboolean __r; if (!__inst) __r = (0); else if (__inst-> g_class && __inst->g_class->g_type == __t) __r = (!(0)); else __r = g_type_check_instance_is_a (__inst, __t); __r; })))))) { } else { g_return_if_fail_warning ("Eel", ((const char*) (__func__)), "EEL_IS_LABELED_IMAGE (labeled_image)"); return; } } while (0); |
1535 | |
1536 | state = selected ? CTK_STATE_FLAG_SELECTED : CTK_STATE_FLAG_NORMAL; |
1537 | |
1538 | ctk_widget_set_state_flags (CTK_WIDGET (labeled_image)((((CtkWidget*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((labeled_image)), ((ctk_widget_get_type ())))))), state, TRUE(!(0))); |
1539 | ctk_widget_set_state_flags (labeled_image->details->image, state, TRUE(!(0))); |
1540 | ctk_widget_set_state_flags (labeled_image->details->label, state, TRUE(!(0))); |
1541 | |
1542 | } |
1543 | |
1544 | /** |
1545 | * eel_labeled_image_get_selected: |
1546 | * @labeled_image: A EelLabeledImage. |
1547 | * |
1548 | * Returns the selected state of the labeled image. |
1549 | * |
1550 | */ |
1551 | gboolean |
1552 | eel_labeled_image_get_selected (EelLabeledImage *labeled_image) |
1553 | { |
1554 | g_return_val_if_fail (EEL_IS_LABELED_IMAGE (labeled_image), FALSE)do { if (((((__extension__ ({ GTypeInstance *__inst = (GTypeInstance *) ((labeled_image)); GType __t = (eel_labeled_image_get_type ()); gboolean __r; if (!__inst) __r = (0); else if (__inst-> g_class && __inst->g_class->g_type == __t) __r = (!(0)); else __r = g_type_check_instance_is_a (__inst, __t); __r; })))))) { } else { g_return_if_fail_warning ("Eel", ((const char*) (__func__)), "EEL_IS_LABELED_IMAGE (labeled_image)"); return ((0)); } } while (0); |
1555 | |
1556 | return ctk_widget_get_state_flags (CTK_WIDGET (labeled_image)((((CtkWidget*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((labeled_image)), ((ctk_widget_get_type ()))))))) == CTK_STATE_FLAG_SELECTED; |
1557 | } |
1558 | |
1559 | /** |
1560 | * eel_labeled_image_set_spacing: |
1561 | * @labeled_image: A EelLabeledImage. |
1562 | * @spacing: The new spacing between label and image. |
1563 | * |
1564 | * Set the spacing between label and image. This will only affect |
1565 | * the geometry of the widget if both a label and image are currently |
1566 | * visible. |
1567 | * |
1568 | */ |
1569 | void |
1570 | eel_labeled_image_set_spacing (EelLabeledImage *labeled_image, |
1571 | guint spacing) |
1572 | { |
1573 | g_return_if_fail (EEL_IS_LABELED_IMAGE (labeled_image))do { if (((((__extension__ ({ GTypeInstance *__inst = (GTypeInstance *) ((labeled_image)); GType __t = (eel_labeled_image_get_type ()); gboolean __r; if (!__inst) __r = (0); else if (__inst-> g_class && __inst->g_class->g_type == __t) __r = (!(0)); else __r = g_type_check_instance_is_a (__inst, __t); __r; })))))) { } else { g_return_if_fail_warning ("Eel", ((const char*) (__func__)), "EEL_IS_LABELED_IMAGE (labeled_image)"); return; } } while (0); |
1574 | |
1575 | if (labeled_image->details->spacing == spacing) |
1576 | { |
1577 | return; |
1578 | } |
1579 | |
1580 | labeled_image->details->spacing = spacing; |
1581 | |
1582 | labeled_image_update_alignments (labeled_image); |
1583 | |
1584 | ctk_widget_queue_resize (CTK_WIDGET (labeled_image)((((CtkWidget*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((labeled_image)), ((ctk_widget_get_type ()))))))); |
1585 | } |
1586 | |
1587 | /** |
1588 | * eel_labeled_image_get_spacing: |
1589 | * @labeled_image: A EelLabeledImage. |
1590 | * |
1591 | * Returns: The spacing between the label and image. |
1592 | */ |
1593 | guint |
1594 | eel_labeled_image_get_spacing (const EelLabeledImage *labeled_image) |
1595 | { |
1596 | g_return_val_if_fail (EEL_IS_LABELED_IMAGE (labeled_image), 0)do { if (((((__extension__ ({ GTypeInstance *__inst = (GTypeInstance *) ((labeled_image)); GType __t = (eel_labeled_image_get_type ()); gboolean __r; if (!__inst) __r = (0); else if (__inst-> g_class && __inst->g_class->g_type == __t) __r = (!(0)); else __r = g_type_check_instance_is_a (__inst, __t); __r; })))))) { } else { g_return_if_fail_warning ("Eel", ((const char*) (__func__)), "EEL_IS_LABELED_IMAGE (labeled_image)"); return (0); } } while (0); |
1597 | |
1598 | return labeled_image->details->spacing; |
1599 | } |
1600 | |
1601 | /** |
1602 | * eel_labeled_image_set_x_padding: |
1603 | * @labeled_image: A EelLabeledImage. |
1604 | * @x_padding: The new horizontal padding. |
1605 | * |
1606 | * Set horizontal padding for the EelLabeledImage. The padding |
1607 | * attribute work just like that in CtkMisc. |
1608 | */ |
1609 | void |
1610 | eel_labeled_image_set_x_padding (EelLabeledImage *labeled_image, |
1611 | int x_padding) |
1612 | { |
1613 | g_return_if_fail (EEL_IS_LABELED_IMAGE (labeled_image))do { if (((((__extension__ ({ GTypeInstance *__inst = (GTypeInstance *) ((labeled_image)); GType __t = (eel_labeled_image_get_type ()); gboolean __r; if (!__inst) __r = (0); else if (__inst-> g_class && __inst->g_class->g_type == __t) __r = (!(0)); else __r = g_type_check_instance_is_a (__inst, __t); __r; })))))) { } else { g_return_if_fail_warning ("Eel", ((const char*) (__func__)), "EEL_IS_LABELED_IMAGE (labeled_image)"); return; } } while (0); |
1614 | |
1615 | x_padding = MAX (0, x_padding)(((0) > (x_padding)) ? (0) : (x_padding)); |
1616 | |
1617 | if (labeled_image->details->x_padding == x_padding) |
1618 | { |
1619 | return; |
1620 | } |
1621 | |
1622 | labeled_image->details->x_padding = x_padding; |
1623 | labeled_image_update_alignments (labeled_image); |
1624 | ctk_widget_queue_resize (CTK_WIDGET (labeled_image)((((CtkWidget*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((labeled_image)), ((ctk_widget_get_type ()))))))); |
1625 | } |
1626 | |
1627 | /** |
1628 | * eel_labeled_image_get_x_padding: |
1629 | * @labeled_image: A EelLabeledImage. |
1630 | * |
1631 | * Returns: The horizontal padding for the LabeledImage's content. |
1632 | */ |
1633 | int |
1634 | eel_labeled_image_get_x_padding (const EelLabeledImage *labeled_image) |
1635 | { |
1636 | g_return_val_if_fail (EEL_IS_LABELED_IMAGE (labeled_image), 0)do { if (((((__extension__ ({ GTypeInstance *__inst = (GTypeInstance *) ((labeled_image)); GType __t = (eel_labeled_image_get_type ()); gboolean __r; if (!__inst) __r = (0); else if (__inst-> g_class && __inst->g_class->g_type == __t) __r = (!(0)); else __r = g_type_check_instance_is_a (__inst, __t); __r; })))))) { } else { g_return_if_fail_warning ("Eel", ((const char*) (__func__)), "EEL_IS_LABELED_IMAGE (labeled_image)"); return (0); } } while (0); |
1637 | |
1638 | return labeled_image->details->x_padding; |
1639 | } |
1640 | |
1641 | /** |
1642 | * eel_labeled_image_set_y_padding: |
1643 | * @labeled_image: A EelLabeledImage. |
1644 | * @x_padding: The new vertical padding. |
1645 | * |
1646 | * Set vertical padding for the EelLabeledImage. The padding |
1647 | * attribute work just like that in CtkMisc. |
1648 | */ |
1649 | void |
1650 | eel_labeled_image_set_y_padding (EelLabeledImage *labeled_image, |
1651 | int y_padding) |
1652 | { |
1653 | g_return_if_fail (EEL_IS_LABELED_IMAGE (labeled_image))do { if (((((__extension__ ({ GTypeInstance *__inst = (GTypeInstance *) ((labeled_image)); GType __t = (eel_labeled_image_get_type ()); gboolean __r; if (!__inst) __r = (0); else if (__inst-> g_class && __inst->g_class->g_type == __t) __r = (!(0)); else __r = g_type_check_instance_is_a (__inst, __t); __r; })))))) { } else { g_return_if_fail_warning ("Eel", ((const char*) (__func__)), "EEL_IS_LABELED_IMAGE (labeled_image)"); return; } } while (0); |
1654 | |
1655 | y_padding = MAX (0, y_padding)(((0) > (y_padding)) ? (0) : (y_padding)); |
1656 | |
1657 | if (labeled_image->details->y_padding == y_padding) |
1658 | { |
1659 | return; |
1660 | } |
1661 | |
1662 | labeled_image->details->y_padding = y_padding; |
1663 | labeled_image_update_alignments (labeled_image); |
1664 | ctk_widget_queue_resize (CTK_WIDGET (labeled_image)((((CtkWidget*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((labeled_image)), ((ctk_widget_get_type ()))))))); |
1665 | } |
1666 | |
1667 | /** |
1668 | * eel_labeled_image_get_x_padding: |
1669 | * @labeled_image: A EelLabeledImage. |
1670 | * |
1671 | * Returns: The vertical padding for the LabeledImage's content. |
1672 | */ |
1673 | int |
1674 | eel_labeled_image_get_y_padding (const EelLabeledImage *labeled_image) |
1675 | { |
1676 | g_return_val_if_fail (EEL_IS_LABELED_IMAGE (labeled_image), 0)do { if (((((__extension__ ({ GTypeInstance *__inst = (GTypeInstance *) ((labeled_image)); GType __t = (eel_labeled_image_get_type ()); gboolean __r; if (!__inst) __r = (0); else if (__inst-> g_class && __inst->g_class->g_type == __t) __r = (!(0)); else __r = g_type_check_instance_is_a (__inst, __t); __r; })))))) { } else { g_return_if_fail_warning ("Eel", ((const char*) (__func__)), "EEL_IS_LABELED_IMAGE (labeled_image)"); return (0); } } while (0); |
1677 | |
1678 | return labeled_image->details->y_padding; |
1679 | } |
1680 | |
1681 | /** |
1682 | * eel_labeled_image_set_x_alignment: |
1683 | * @labeled_image: A EelLabeledImage. |
1684 | * @x_alignment: The new horizontal alignment. |
1685 | * |
1686 | * Set horizontal alignment for the EelLabeledImage's content. |
1687 | * The 'content' is the union of the image and label. The alignment |
1688 | * attribute work just like that in CtkMisc. |
1689 | */ |
1690 | void |
1691 | eel_labeled_image_set_x_alignment (EelLabeledImage *labeled_image, |
1692 | float x_alignment) |
1693 | { |
1694 | g_return_if_fail (EEL_IS_LABELED_IMAGE (labeled_image))do { if (((((__extension__ ({ GTypeInstance *__inst = (GTypeInstance *) ((labeled_image)); GType __t = (eel_labeled_image_get_type ()); gboolean __r; if (!__inst) __r = (0); else if (__inst-> g_class && __inst->g_class->g_type == __t) __r = (!(0)); else __r = g_type_check_instance_is_a (__inst, __t); __r; })))))) { } else { g_return_if_fail_warning ("Eel", ((const char*) (__func__)), "EEL_IS_LABELED_IMAGE (labeled_image)"); return; } } while (0); |
1695 | |
1696 | x_alignment = MAX (0, x_alignment)(((0) > (x_alignment)) ? (0) : (x_alignment)); |
1697 | x_alignment = MIN (1.0, x_alignment)(((1.0) < (x_alignment)) ? (1.0) : (x_alignment)); |
1698 | |
1699 | if (labeled_image->details->x_alignment == x_alignment) |
1700 | { |
1701 | return; |
1702 | } |
1703 | |
1704 | labeled_image->details->x_alignment = x_alignment; |
1705 | ctk_widget_queue_resize (CTK_WIDGET (labeled_image)((((CtkWidget*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((labeled_image)), ((ctk_widget_get_type ()))))))); |
1706 | } |
1707 | |
1708 | /** |
1709 | * eel_labeled_image_get_x_alignment: |
1710 | * @labeled_image: A EelLabeledImage. |
1711 | * |
1712 | * Returns: The horizontal alignment for the LabeledImage's content. |
1713 | */ |
1714 | float |
1715 | eel_labeled_image_get_x_alignment (const EelLabeledImage *labeled_image) |
1716 | { |
1717 | g_return_val_if_fail (EEL_IS_LABELED_IMAGE (labeled_image), 0)do { if (((((__extension__ ({ GTypeInstance *__inst = (GTypeInstance *) ((labeled_image)); GType __t = (eel_labeled_image_get_type ()); gboolean __r; if (!__inst) __r = (0); else if (__inst-> g_class && __inst->g_class->g_type == __t) __r = (!(0)); else __r = g_type_check_instance_is_a (__inst, __t); __r; })))))) { } else { g_return_if_fail_warning ("Eel", ((const char*) (__func__)), "EEL_IS_LABELED_IMAGE (labeled_image)"); return (0); } } while (0); |
1718 | |
1719 | return labeled_image->details->x_alignment; |
1720 | } |
1721 | |
1722 | /** |
1723 | * eel_labeled_image_set_y_alignment: |
1724 | * @labeled_image: A EelLabeledImage. |
1725 | * @y_alignment: The new vertical alignment. |
1726 | * |
1727 | * Set vertical alignment for the EelLabeledImage's content. |
1728 | * The 'content' is the union of the image and label. The alignment |
1729 | * attribute work just like that in CtkMisc. |
1730 | */ |
1731 | void |
1732 | eel_labeled_image_set_y_alignment (EelLabeledImage *labeled_image, |
1733 | float y_alignment) |
1734 | { |
1735 | g_return_if_fail (EEL_IS_LABELED_IMAGE (labeled_image))do { if (((((__extension__ ({ GTypeInstance *__inst = (GTypeInstance *) ((labeled_image)); GType __t = (eel_labeled_image_get_type ()); gboolean __r; if (!__inst) __r = (0); else if (__inst-> g_class && __inst->g_class->g_type == __t) __r = (!(0)); else __r = g_type_check_instance_is_a (__inst, __t); __r; })))))) { } else { g_return_if_fail_warning ("Eel", ((const char*) (__func__)), "EEL_IS_LABELED_IMAGE (labeled_image)"); return; } } while (0); |
1736 | |
1737 | y_alignment = MAX (0, y_alignment)(((0) > (y_alignment)) ? (0) : (y_alignment)); |
1738 | y_alignment = MIN (1.0, y_alignment)(((1.0) < (y_alignment)) ? (1.0) : (y_alignment)); |
1739 | |
1740 | if (labeled_image->details->y_alignment == y_alignment) |
1741 | { |
1742 | return; |
1743 | } |
1744 | |
1745 | labeled_image->details->y_alignment = y_alignment; |
1746 | ctk_widget_queue_resize (CTK_WIDGET (labeled_image)((((CtkWidget*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((labeled_image)), ((ctk_widget_get_type ()))))))); |
1747 | } |
1748 | |
1749 | /** |
1750 | * eel_labeled_image_get_y_alignment: |
1751 | * @labeled_image: A EelLabeledImage. |
1752 | * |
1753 | * Returns: The vertical alignment for the LabeledImage's content. |
1754 | */ |
1755 | float |
1756 | eel_labeled_image_get_y_alignment (const EelLabeledImage *labeled_image) |
1757 | { |
1758 | g_return_val_if_fail (EEL_IS_LABELED_IMAGE (labeled_image), 0)do { if (((((__extension__ ({ GTypeInstance *__inst = (GTypeInstance *) ((labeled_image)); GType __t = (eel_labeled_image_get_type ()); gboolean __r; if (!__inst) __r = (0); else if (__inst-> g_class && __inst->g_class->g_type == __t) __r = (!(0)); else __r = g_type_check_instance_is_a (__inst, __t); __r; })))))) { } else { g_return_if_fail_warning ("Eel", ((const char*) (__func__)), "EEL_IS_LABELED_IMAGE (labeled_image)"); return (0); } } while (0); |
1759 | |
1760 | return labeled_image->details->y_alignment; |
1761 | } |
1762 | |
1763 | /** |
1764 | * eel_labeled_image_set_fill: |
1765 | * @labeled_image: A EelLabeledImage. |
1766 | * @fill: A boolean value indicating whether the internal image and label |
1767 | * widgets should fill all the available allocation. |
1768 | * |
1769 | * By default the internal image and label wigets are sized to their natural |
1770 | * preferred geometry. You can use the 'fill' attribute of LabeledImage |
1771 | * to have the internal widgets fill as much of the LabeledImage allocation |
1772 | * as is available. |
1773 | */ |
1774 | void |
1775 | eel_labeled_image_set_fill (EelLabeledImage *labeled_image, |
1776 | gboolean fill) |
1777 | { |
1778 | g_return_if_fail (EEL_IS_LABELED_IMAGE (labeled_image))do { if (((((__extension__ ({ GTypeInstance *__inst = (GTypeInstance *) ((labeled_image)); GType __t = (eel_labeled_image_get_type ()); gboolean __r; if (!__inst) __r = (0); else if (__inst-> g_class && __inst->g_class->g_type == __t) __r = (!(0)); else __r = g_type_check_instance_is_a (__inst, __t); __r; })))))) { } else { g_return_if_fail_warning ("Eel", ((const char*) (__func__)), "EEL_IS_LABELED_IMAGE (labeled_image)"); return; } } while (0); |
1779 | |
1780 | if (labeled_image->details->fill == fill) |
1781 | { |
1782 | return; |
1783 | } |
1784 | |
1785 | labeled_image->details->fill = fill; |
1786 | |
1787 | labeled_image_update_alignments (labeled_image); |
1788 | |
1789 | ctk_widget_queue_resize (CTK_WIDGET (labeled_image)((((CtkWidget*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((labeled_image)), ((ctk_widget_get_type ()))))))); |
1790 | } |
1791 | |
1792 | /** |
1793 | * eel_labeled_image_get_fill: |
1794 | * @labeled_image: A EelLabeledImage. |
1795 | * |
1796 | * Retruns a boolean value indicating whether the internal widgets fill |
1797 | * all the available allocation. |
1798 | */ |
1799 | gboolean |
1800 | eel_labeled_image_get_fill (const EelLabeledImage *labeled_image) |
1801 | { |
1802 | g_return_val_if_fail (EEL_IS_LABELED_IMAGE (labeled_image), 0)do { if (((((__extension__ ({ GTypeInstance *__inst = (GTypeInstance *) ((labeled_image)); GType __t = (eel_labeled_image_get_type ()); gboolean __r; if (!__inst) __r = (0); else if (__inst-> g_class && __inst->g_class->g_type == __t) __r = (!(0)); else __r = g_type_check_instance_is_a (__inst, __t); __r; })))))) { } else { g_return_if_fail_warning ("Eel", ((const char*) (__func__)), "EEL_IS_LABELED_IMAGE (labeled_image)"); return (0); } } while (0); |
1803 | |
1804 | return labeled_image->details->fill; |
1805 | } |
1806 | |
1807 | static void |
1808 | eel_labled_set_mnemonic_widget (CtkWidget *image_widget, |
1809 | CtkWidget *mnemonic_widget) |
1810 | { |
1811 | EelLabeledImage *image; |
1812 | |
1813 | g_assert (EEL_IS_LABELED_IMAGE (image_widget))do { if ((((__extension__ ({ GTypeInstance *__inst = (GTypeInstance *) ((image_widget)); GType __t = (eel_labeled_image_get_type( )); gboolean __r; if (!__inst) __r = (0); else if (__inst-> g_class && __inst->g_class->g_type == __t) __r = (!(0)); else __r = g_type_check_instance_is_a (__inst, __t); __r; }))))) ; else g_assertion_message_expr ("Eel", "eel-labeled-image.c" , 1813, ((const char*) (__func__)), "EEL_IS_LABELED_IMAGE (image_widget)" ); } while (0); |
1814 | |
1815 | image = EEL_LABELED_IMAGE (image_widget)((((EelLabeledImage*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((image_widget)), (eel_labeled_image_get_type()))))); |
1816 | |
1817 | if (image->details->label) |
1818 | ctk_label_set_mnemonic_widget |
1819 | (CTK_LABEL (image->details->label)((((CtkLabel*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((image->details->label)), ((ctk_label_get_type ())) )))), mnemonic_widget); |
1820 | } |
1821 | |
1822 | /** |
1823 | * eel_labeled_image_button_new: |
1824 | * @text: Text to use for label or NULL. |
1825 | * @pixbuf: Pixbuf to use for image or NULL. |
1826 | * |
1827 | * Create a stock CtkButton with a EelLabeledImage child. |
1828 | * |
1829 | */ |
1830 | CtkWidget * |
1831 | eel_labeled_image_button_new (const char *text, |
1832 | GdkPixbuf *pixbuf) |
1833 | { |
1834 | CtkWidget *button; |
1835 | CtkWidget *labeled_image; |
1836 | |
1837 | button = g_object_new (eel_labeled_image_button_get_type (), NULL((void*)0)); |
1838 | labeled_image = eel_labeled_image_new (text, pixbuf); |
1839 | ctk_container_add (CTK_CONTAINER (button)((((CtkContainer*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((button)), ((ctk_container_get_type ())))))), labeled_image); |
1840 | eel_labled_set_mnemonic_widget (labeled_image, button); |
1841 | ctk_widget_show (labeled_image); |
1842 | |
1843 | return button; |
1844 | } |
1845 | |
1846 | /** |
1847 | * eel_labeled_image_button_new_from_file_name: |
1848 | * @text: Text to use for label or NULL. |
1849 | * @pixbuf_file_name: Name of pixbuf to use for image. Cannot be NULL. |
1850 | * |
1851 | * Create a stock CtkToggleButton with a EelLabeledImage child. |
1852 | * |
1853 | */ |
1854 | CtkWidget * |
1855 | eel_labeled_image_button_new_from_file_name (const char *text, |
1856 | const char *pixbuf_file_name) |
1857 | { |
1858 | CtkWidget *button; |
1859 | CtkWidget *labeled_image; |
1860 | |
1861 | g_return_val_if_fail (pixbuf_file_name != NULL, NULL)do { if ((pixbuf_file_name != ((void*)0))) { } else { g_return_if_fail_warning ("Eel", ((const char*) (__func__)), "pixbuf_file_name != NULL" ); return (((void*)0)); } } while (0); |
1862 | |
1863 | button = g_object_new (eel_labeled_image_button_get_type (), NULL((void*)0)); |
1864 | labeled_image = eel_labeled_image_new_from_file_name (text, pixbuf_file_name); |
1865 | ctk_container_add (CTK_CONTAINER (button)((((CtkContainer*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((button)), ((ctk_container_get_type ())))))), labeled_image); |
1866 | eel_labled_set_mnemonic_widget (labeled_image, button); |
1867 | ctk_widget_show (labeled_image); |
1868 | |
1869 | return button; |
1870 | } |
1871 | |
1872 | /** |
1873 | * eel_labeled_image_toggle_button_new: |
1874 | * @text: Text to use for label or NULL. |
1875 | * @pixbuf: Pixbuf to use for image or NULL. |
1876 | * |
1877 | * Create a stock CtkToggleButton with a EelLabeledImage child. |
1878 | * |
1879 | */ |
1880 | CtkWidget * |
1881 | eel_labeled_image_toggle_button_new (const char *text, |
1882 | GdkPixbuf *pixbuf) |
1883 | { |
1884 | CtkWidget *toggle_button; |
1885 | CtkWidget *labeled_image; |
1886 | |
1887 | toggle_button = g_object_new (eel_labeled_image_toggle_button_get_type (), NULL((void*)0)); |
1888 | labeled_image = eel_labeled_image_new (text, pixbuf); |
1889 | ctk_container_add (CTK_CONTAINER (toggle_button)((((CtkContainer*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((toggle_button)), ((ctk_container_get_type ())))))), labeled_image); |
1890 | eel_labled_set_mnemonic_widget (labeled_image, toggle_button); |
1891 | ctk_widget_show (labeled_image); |
1892 | |
1893 | return toggle_button; |
1894 | } |
1895 | |
1896 | /** |
1897 | * eel_labeled_image_toggle_button_new_from_file_name: |
1898 | * @text: Text to use for label or NULL. |
1899 | * @pixbuf_file_name: Name of pixbuf to use for image. Cannot be NULL. |
1900 | * |
1901 | * Create a stock CtkToggleButton with a EelLabeledImage child. |
1902 | * |
1903 | */ |
1904 | CtkWidget * |
1905 | eel_labeled_image_toggle_button_new_from_file_name (const char *text, |
1906 | const char *pixbuf_file_name) |
1907 | { |
1908 | CtkWidget *toggle_button; |
1909 | CtkWidget *labeled_image; |
1910 | |
1911 | g_return_val_if_fail (pixbuf_file_name != NULL, NULL)do { if ((pixbuf_file_name != ((void*)0))) { } else { g_return_if_fail_warning ("Eel", ((const char*) (__func__)), "pixbuf_file_name != NULL" ); return (((void*)0)); } } while (0); |
1912 | |
1913 | toggle_button = g_object_new (eel_labeled_image_toggle_button_get_type (), NULL((void*)0)); |
1914 | labeled_image = eel_labeled_image_new_from_file_name (text, pixbuf_file_name); |
1915 | ctk_container_add (CTK_CONTAINER (toggle_button)((((CtkContainer*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((toggle_button)), ((ctk_container_get_type ())))))), labeled_image); |
1916 | eel_labled_set_mnemonic_widget (labeled_image, toggle_button); |
1917 | ctk_widget_show (labeled_image); |
1918 | |
1919 | return toggle_button; |
1920 | } |
1921 | |
1922 | /** |
1923 | * eel_labeled_image_toggle_button_new: |
1924 | * @text: Text to use for label or NULL. |
1925 | * @pixbuf: Pixbuf to use for image or NULL. |
1926 | * |
1927 | * Create a stock CtkToggleButton with a EelLabeledImage child. |
1928 | * |
1929 | * Returns: the new radio button. |
1930 | */ |
1931 | CtkWidget * |
1932 | eel_labeled_image_radio_button_new (const char *text, |
1933 | GdkPixbuf *pixbuf) |
1934 | { |
1935 | CtkWidget *radio_button; |
1936 | CtkWidget *labeled_image; |
1937 | |
1938 | radio_button = g_object_new (eel_labeled_image_radio_button_get_type (), NULL((void*)0)); |
1939 | labeled_image = eel_labeled_image_new (text, pixbuf); |
1940 | ctk_container_add (CTK_CONTAINER (radio_button)((((CtkContainer*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((radio_button)), ((ctk_container_get_type ())))))), labeled_image); |
1941 | eel_labled_set_mnemonic_widget (labeled_image, radio_button); |
1942 | ctk_widget_show (labeled_image); |
1943 | |
1944 | return radio_button; |
1945 | } |
1946 | |
1947 | /** |
1948 | * eel_labeled_image_radio_button_new_from_file_name: |
1949 | * @text: Text to use for label or NULL. |
1950 | * @pixbuf_file_name: Name of pixbuf to use for image. Cannot be NULL. |
1951 | * |
1952 | * Create a stock CtkRadioButton with a EelLabeledImage child. |
1953 | * |
1954 | * Returns: the new radio button. |
1955 | */ |
1956 | CtkWidget * |
1957 | eel_labeled_image_radio_button_new_from_file_name (const char *text, |
1958 | const char *pixbuf_file_name) |
1959 | { |
1960 | CtkWidget *radio_button; |
1961 | CtkWidget *labeled_image; |
1962 | |
1963 | g_return_val_if_fail (pixbuf_file_name != NULL, NULL)do { if ((pixbuf_file_name != ((void*)0))) { } else { g_return_if_fail_warning ("Eel", ((const char*) (__func__)), "pixbuf_file_name != NULL" ); return (((void*)0)); } } while (0); |
1964 | |
1965 | radio_button = g_object_new (eel_labeled_image_radio_button_get_type (), NULL((void*)0)); |
1966 | labeled_image = eel_labeled_image_new_from_file_name (text, pixbuf_file_name); |
1967 | ctk_container_add (CTK_CONTAINER (radio_button)((((CtkContainer*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((radio_button)), ((ctk_container_get_type ())))))), labeled_image); |
1968 | eel_labled_set_mnemonic_widget (labeled_image, radio_button); |
1969 | ctk_widget_show (labeled_image); |
1970 | |
1971 | return radio_button; |
1972 | } |
1973 | |
1974 | /* |
1975 | * Workaround some bugs in CtkCheckButton where the widget |
1976 | * does not redraw properly after leave or focus out events |
1977 | * |
1978 | * The workaround is to draw a little bit more than the |
1979 | * widget itself - 4 pixels worth. For some reason the |
1980 | * widget does not properly redraw its edges. |
1981 | */ |
1982 | static void |
1983 | button_leave_callback (CtkWidget *widget, |
1984 | gpointer callback_data G_GNUC_UNUSED__attribute__ ((__unused__))) |
1985 | { |
1986 | g_assert (CTK_IS_WIDGET (widget))do { if ((((__extension__ ({ GTypeInstance *__inst = (GTypeInstance *) ((widget)); GType __t = ((ctk_widget_get_type ())); gboolean __r; if (!__inst) __r = (0); else if (__inst->g_class && __inst->g_class->g_type == __t) __r = (!(0)); else __r = g_type_check_instance_is_a (__inst, __t); __r; }))))) ; else g_assertion_message_expr ("Eel", "eel-labeled-image.c", 1986 , ((const char*) (__func__)), "CTK_IS_WIDGET (widget)"); } while (0); |
1987 | |
1988 | if (ctk_widget_is_drawable (widget)) |
1989 | { |
1990 | const int fudge = 4; |
1991 | EelIRect bounds; |
1992 | |
1993 | bounds = eel_ctk_widget_get_bounds (widget); |
1994 | |
1995 | bounds.x0 -= fudge; |
1996 | bounds.y0 -= fudge; |
1997 | bounds.x1 += fudge; |
1998 | bounds.y1 += fudge; |
1999 | |
2000 | ctk_widget_queue_draw_area (ctk_widget_get_parent (widget), |
2001 | bounds.x0, |
2002 | bounds.y0, |
2003 | eel_irect_get_width (bounds), |
2004 | eel_irect_get_height (bounds)); |
2005 | } |
2006 | } |
2007 | |
2008 | static gint |
2009 | button_focus_out_event_callback (CtkWidget *widget, |
2010 | CdkEventFocus *event G_GNUC_UNUSED__attribute__ ((__unused__)), |
2011 | gpointer callback_data) |
2012 | { |
2013 | g_assert (CTK_IS_WIDGET (widget))do { if ((((__extension__ ({ GTypeInstance *__inst = (GTypeInstance *) ((widget)); GType __t = ((ctk_widget_get_type ())); gboolean __r; if (!__inst) __r = (0); else if (__inst->g_class && __inst->g_class->g_type == __t) __r = (!(0)); else __r = g_type_check_instance_is_a (__inst, __t); __r; }))))) ; else g_assertion_message_expr ("Eel", "eel-labeled-image.c", 2013 , ((const char*) (__func__)), "CTK_IS_WIDGET (widget)"); } while (0); |
2014 | |
2015 | button_leave_callback (widget, callback_data); |
2016 | |
2017 | return FALSE(0); |
2018 | } |
2019 | |
2020 | /** |
2021 | * eel_labeled_image_check_button_new: |
2022 | * @text: Text to use for label or NULL. |
2023 | * @pixbuf: Pixbuf to use for image or NULL. |
2024 | * |
2025 | * Create a stock CtkCheckButton with a EelLabeledImage child. |
2026 | * |
2027 | */ |
2028 | CtkWidget * |
2029 | eel_labeled_image_check_button_new (const char *text, |
2030 | GdkPixbuf *pixbuf) |
2031 | { |
2032 | CtkWidget *check_button; |
2033 | CtkWidget *labeled_image; |
2034 | |
2035 | check_button = g_object_new (eel_labeled_image_check_button_get_type (), NULL((void*)0)); |
2036 | labeled_image = eel_labeled_image_new (text, pixbuf); |
2037 | ctk_container_add (CTK_CONTAINER (check_button)((((CtkContainer*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((check_button)), ((ctk_container_get_type ())))))), labeled_image); |
2038 | eel_labled_set_mnemonic_widget (labeled_image, check_button); |
2039 | ctk_widget_show (labeled_image); |
2040 | |
2041 | /* |
2042 | * Workaround some bugs in CtkCheckButton where the widget |
2043 | * does not redraw properly after leave or focus out events |
2044 | */ |
2045 | g_signal_connect (check_button, "leave",g_signal_connect_data ((check_button), ("leave"), (((GCallback ) (button_leave_callback))), (((void*)0)), ((void*)0), (GConnectFlags ) 0) |
2046 | G_CALLBACK (button_leave_callback), NULL)g_signal_connect_data ((check_button), ("leave"), (((GCallback ) (button_leave_callback))), (((void*)0)), ((void*)0), (GConnectFlags ) 0); |
2047 | g_signal_connect (check_button, "focus_out_event",g_signal_connect_data ((check_button), ("focus_out_event"), ( ((GCallback) (button_focus_out_event_callback))), (((void*)0) ), ((void*)0), (GConnectFlags) 0) |
2048 | G_CALLBACK (button_focus_out_event_callback), NULL)g_signal_connect_data ((check_button), ("focus_out_event"), ( ((GCallback) (button_focus_out_event_callback))), (((void*)0) ), ((void*)0), (GConnectFlags) 0); |
2049 | |
2050 | return check_button; |
2051 | } |
2052 | |
2053 | /** |
2054 | * eel_labeled_image_check_button_new_from_file_name: |
2055 | * @text: Text to use for label or NULL. |
2056 | * @pixbuf_file_name: Name of pixbuf to use for image. Cannot be NULL. |
2057 | * |
2058 | * Create a stock CtkCheckButton with a EelLabeledImage child. |
2059 | * |
2060 | */ |
2061 | CtkWidget * |
2062 | eel_labeled_image_check_button_new_from_file_name (const char *text, |
2063 | const char *pixbuf_file_name) |
2064 | { |
2065 | CtkWidget *check_button; |
2066 | CtkWidget *labeled_image; |
2067 | |
2068 | g_return_val_if_fail (pixbuf_file_name != NULL, NULL)do { if ((pixbuf_file_name != ((void*)0))) { } else { g_return_if_fail_warning ("Eel", ((const char*) (__func__)), "pixbuf_file_name != NULL" ); return (((void*)0)); } } while (0); |
2069 | |
2070 | check_button = g_object_new (eel_labeled_image_check_button_get_type (), NULL((void*)0)); |
2071 | labeled_image = eel_labeled_image_new_from_file_name (text, pixbuf_file_name); |
2072 | ctk_container_add (CTK_CONTAINER (check_button)((((CtkContainer*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((check_button)), ((ctk_container_get_type ())))))), labeled_image); |
2073 | eel_labled_set_mnemonic_widget (labeled_image, check_button); |
2074 | ctk_widget_show (labeled_image); |
2075 | |
2076 | return check_button; |
2077 | } |
2078 | |
2079 | /* |
2080 | * The rest of the methods are proxies for those in EelImage and |
2081 | * EelLabel. We have all these so that we dont have to expose |
2082 | * our internal widgets at all. Probably more of these will be added |
2083 | * as they are needed. |
2084 | */ |
2085 | |
2086 | /** |
2087 | * eel_labeled_image_set_pixbuf: |
2088 | * @labaled_image: A EelLabeledImage. |
2089 | * @pixbuf: New pixbuf to use or NULL. |
2090 | * |
2091 | * Change the pixbuf displayed by the LabeledImage. Note that the widget display |
2092 | * is only updated if the show_image attribute is TRUE. |
2093 | * |
2094 | * If no internal image widget exists as of yet, a new one will be created. |
2095 | * |
2096 | * A NULL &pixbuf will cause the internal image widget (if alive) to be destroyed. |
2097 | */ |
2098 | void |
2099 | eel_labeled_image_set_pixbuf (EelLabeledImage *labeled_image, |
2100 | GdkPixbuf *pixbuf) |
2101 | { |
2102 | g_return_if_fail (EEL_IS_LABELED_IMAGE (labeled_image))do { if (((((__extension__ ({ GTypeInstance *__inst = (GTypeInstance *) ((labeled_image)); GType __t = (eel_labeled_image_get_type ()); gboolean __r; if (!__inst) __r = (0); else if (__inst-> g_class && __inst->g_class->g_type == __t) __r = (!(0)); else __r = g_type_check_instance_is_a (__inst, __t); __r; })))))) { } else { g_return_if_fail_warning ("Eel", ((const char*) (__func__)), "EEL_IS_LABELED_IMAGE (labeled_image)"); return; } } while (0); |
2103 | |
2104 | if (pixbuf == NULL((void*)0)) |
2105 | { |
2106 | if (labeled_image->details->image != NULL((void*)0)) |
2107 | { |
2108 | ctk_widget_destroy (labeled_image->details->image); |
2109 | labeled_image->details->image = NULL((void*)0); |
2110 | } |
2111 | |
2112 | ctk_widget_queue_resize (CTK_WIDGET (labeled_image)((((CtkWidget*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((labeled_image)), ((ctk_widget_get_type ()))))))); |
2113 | } |
2114 | else |
2115 | { |
2116 | labeled_image_ensure_image (labeled_image); |
2117 | ctk_image_set_from_pixbuf (CTK_IMAGE (labeled_image->details->image)((((CtkImage*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((labeled_image->details->image)), ((ctk_image_get_type ())))))), pixbuf); |
2118 | } |
2119 | } |
2120 | |
2121 | void |
2122 | eel_labeled_image_set_pixbuf_from_file_name (EelLabeledImage *labeled_image, |
2123 | const char *pixbuf_file_name) |
2124 | { |
2125 | g_return_if_fail (EEL_IS_LABELED_IMAGE (labeled_image))do { if (((((__extension__ ({ GTypeInstance *__inst = (GTypeInstance *) ((labeled_image)); GType __t = (eel_labeled_image_get_type ()); gboolean __r; if (!__inst) __r = (0); else if (__inst-> g_class && __inst->g_class->g_type == __t) __r = (!(0)); else __r = g_type_check_instance_is_a (__inst, __t); __r; })))))) { } else { g_return_if_fail_warning ("Eel", ((const char*) (__func__)), "EEL_IS_LABELED_IMAGE (labeled_image)"); return; } } while (0); |
2126 | |
2127 | labeled_image_ensure_image (labeled_image); |
2128 | ctk_image_set_from_file (CTK_IMAGE (labeled_image->details->image)((((CtkImage*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((labeled_image->details->image)), ((ctk_image_get_type ())))))), pixbuf_file_name); |
2129 | } |
2130 | |
2131 | /** |
2132 | * eel_labeled_image_set_text: |
2133 | * @labaled_image: A EelLabeledImage. |
2134 | * @text: New text (with mnemnonic) to use or NULL. |
2135 | * |
2136 | * Change the text displayed by the LabeledImage. Note that the widget display |
2137 | * is only updated if the show_label attribute is TRUE. |
2138 | * |
2139 | * If no internal label widget exists as of yet, a new one will be created. |
2140 | * |
2141 | * A NULL &text will cause the internal label widget (if alive) to be destroyed. |
2142 | */ |
2143 | void |
2144 | eel_labeled_image_set_text (EelLabeledImage *labeled_image, |
2145 | const char *text) |
2146 | { |
2147 | g_return_if_fail (EEL_IS_LABELED_IMAGE (labeled_image))do { if (((((__extension__ ({ GTypeInstance *__inst = (GTypeInstance *) ((labeled_image)); GType __t = (eel_labeled_image_get_type ()); gboolean __r; if (!__inst) __r = (0); else if (__inst-> g_class && __inst->g_class->g_type == __t) __r = (!(0)); else __r = g_type_check_instance_is_a (__inst, __t); __r; })))))) { } else { g_return_if_fail_warning ("Eel", ((const char*) (__func__)), "EEL_IS_LABELED_IMAGE (labeled_image)"); return; } } while (0); |
2148 | |
2149 | if (text == NULL((void*)0)) |
2150 | { |
2151 | if (labeled_image->details->label) |
2152 | { |
2153 | ctk_widget_destroy (labeled_image->details->label); |
2154 | labeled_image->details->label = NULL((void*)0); |
2155 | } |
2156 | |
2157 | ctk_widget_queue_resize (CTK_WIDGET (labeled_image)((((CtkWidget*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((labeled_image)), ((ctk_widget_get_type ()))))))); |
2158 | } |
2159 | else |
2160 | { |
2161 | labeled_image_ensure_label (labeled_image); |
2162 | ctk_label_set_text_with_mnemonic |
2163 | (CTK_LABEL (labeled_image->details->label)((((CtkLabel*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((labeled_image->details->label)), ((ctk_label_get_type ())))))), text); |
2164 | } |
2165 | } |
2166 | |
2167 | char * |
2168 | eel_labeled_image_get_text (const EelLabeledImage *labeled_image) |
2169 | { |
2170 | g_return_val_if_fail (EEL_IS_LABELED_IMAGE (labeled_image), NULL)do { if (((((__extension__ ({ GTypeInstance *__inst = (GTypeInstance *) ((labeled_image)); GType __t = (eel_labeled_image_get_type ()); gboolean __r; if (!__inst) __r = (0); else if (__inst-> g_class && __inst->g_class->g_type == __t) __r = (!(0)); else __r = g_type_check_instance_is_a (__inst, __t); __r; })))))) { } else { g_return_if_fail_warning ("Eel", ((const char*) (__func__)), "EEL_IS_LABELED_IMAGE (labeled_image)"); return (((void*)0)); } } while (0); |
2171 | |
2172 | if (labeled_image->details->label == NULL((void*)0)) |
2173 | { |
2174 | return NULL((void*)0); |
2175 | } |
2176 | |
2177 | return g_strdup (ctk_label_get_text (CTK_LABEL (labeled_image->details->label)))g_strdup_inline (ctk_label_get_text (((((CtkLabel*) (void *) g_type_check_instance_cast ((GTypeInstance*) ((labeled_image->details->label)), ( (ctk_label_get_type ())))))))); |
2178 | } |
2179 | |
2180 | void |
2181 | eel_labeled_image_set_can_focus (EelLabeledImage *labeled_image, |
2182 | gboolean can_focus) |
2183 | { |
2184 | ctk_widget_set_can_focus (CTK_WIDGET (labeled_image)((((CtkWidget*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((labeled_image)), ((ctk_widget_get_type ())))))), can_focus); |
2185 | } |
2186 | |
2187 | static AtkObjectClass *a11y_parent_class = NULL((void*)0); |
2188 | |
2189 | static void |
2190 | eel_labeled_image_accessible_initialize (AtkObject *accessible, |
2191 | gpointer widget) |
2192 | { |
2193 | a11y_parent_class->initialize (accessible, widget); |
2194 | atk_object_set_role (accessible, ATK_ROLE_IMAGE); |
2195 | |
2196 | } |
2197 | |
2198 | static EelLabeledImage * |
2199 | get_image (gpointer object) |
2200 | { |
2201 | CtkWidget *widget; |
2202 | |
2203 | if (!(widget = ctk_accessible_get_widget (CTK_ACCESSIBLE (object)((((CtkAccessible*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((object)), ((ctk_accessible_get_type ()))))))))) |
2204 | { |
2205 | return NULL((void*)0); |
2206 | } |
2207 | |
2208 | if (CTK_IS_BUTTON (widget)(((__extension__ ({ GTypeInstance *__inst = (GTypeInstance*) ( (widget)); GType __t = ((ctk_button_get_type ())); gboolean __r ; if (!__inst) __r = (0); else if (__inst->g_class && __inst->g_class->g_type == __t) __r = (!(0)); else __r = g_type_check_instance_is_a (__inst, __t); __r; }))))) |
2209 | widget = ctk_bin_get_child (CTK_BIN (widget)((((CtkBin*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((widget)), ((ctk_bin_get_type ()))))))); |
2210 | |
2211 | return EEL_LABELED_IMAGE (widget)((((EelLabeledImage*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((widget)), (eel_labeled_image_get_type()))))); |
2212 | } |
2213 | |
2214 | static const gchar* eel_labeled_image_accessible_get_name(AtkObject* accessible) |
2215 | { |
2216 | EelLabeledImage* labeled_image; |
2217 | |
2218 | labeled_image = get_image(accessible); |
2219 | |
2220 | if (labeled_image && labeled_image->details && labeled_image->details->label) |
2221 | { |
2222 | return ctk_label_get_text(CTK_LABEL(labeled_image->details->label)((((CtkLabel*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((labeled_image->details->label)), ((ctk_label_get_type ()))))))); |
2223 | } |
2224 | |
2225 | g_warning("no label on '%p'", labeled_image); |
2226 | |
2227 | return NULL((void*)0); |
2228 | } |
2229 | |
2230 | static void |
2231 | eel_labeled_image_accessible_image_get_size (AtkImage *image, |
2232 | gint *width, |
2233 | gint *height) |
2234 | { |
2235 | EelLabeledImage *labeled_image; |
2236 | CtkAllocation allocation; |
2237 | |
2238 | labeled_image = get_image (image); |
2239 | |
2240 | if (!labeled_image || !labeled_image->details->image) |
2241 | { |
2242 | *width = *height = 0; |
2243 | return; |
2244 | } |
2245 | |
2246 | ctk_widget_get_allocation (labeled_image->details->image, &allocation); |
2247 | *width = allocation.width; |
2248 | *height = allocation.height; |
2249 | } |
2250 | |
2251 | static void |
2252 | eel_labeled_image_accessible_image_interface_init (AtkImageIface *iface) |
2253 | { |
2254 | iface->get_image_size = eel_labeled_image_accessible_image_get_size; |
2255 | } |
2256 | |
2257 | typedef struct _EelLabeledImageAccessible EelLabeledImageAccessible; |
2258 | typedef struct _EelLabeledImageAccessibleClass EelLabeledImageAccessibleClass; |
2259 | |
2260 | struct _EelLabeledImageAccessible |
2261 | { |
2262 | CtkContainerAccessible parent; |
2263 | }; |
2264 | |
2265 | struct _EelLabeledImageAccessibleClass |
2266 | { |
2267 | CtkContainerAccessibleClass parent_class; |
2268 | }; |
2269 | |
2270 | G_DEFINE_TYPE_WITH_CODE (EelLabeledImageAccessible,static void eel_labeled_image_accessible_init (EelLabeledImageAccessible *self); static void eel_labeled_image_accessible_class_init ( EelLabeledImageAccessibleClass *klass); static GType eel_labeled_image_accessible_get_type_once (void); static gpointer eel_labeled_image_accessible_parent_class = ((void*)0); static gint EelLabeledImageAccessible_private_offset ; static void eel_labeled_image_accessible_class_intern_init ( gpointer klass) { eel_labeled_image_accessible_parent_class = g_type_class_peek_parent (klass); if (EelLabeledImageAccessible_private_offset != 0) g_type_class_adjust_private_offset (klass, &EelLabeledImageAccessible_private_offset ); eel_labeled_image_accessible_class_init ((EelLabeledImageAccessibleClass *) klass); } __attribute__ ((__unused__)) static inline gpointer eel_labeled_image_accessible_get_instance_private (EelLabeledImageAccessible *self) { return (((gpointer) ((guint8*) (self) + (glong) (EelLabeledImageAccessible_private_offset )))); } GType eel_labeled_image_accessible_get_type (void) { static GType static_g_define_type_id = 0; if ((__extension__ ({ _Static_assert (sizeof *(&static_g_define_type_id) == sizeof (gpointer) , "Expression evaluates to false"); (void) (0 ? (gpointer) * ( &static_g_define_type_id) : ((void*)0)); (!(__extension__ ({ _Static_assert (sizeof *(&static_g_define_type_id) == sizeof (gpointer), "Expression evaluates to false"); __typeof__ (*(&static_g_define_type_id)) gapg_temp_newval; __typeof__ ((&static_g_define_type_id)) gapg_temp_atomic = (&static_g_define_type_id ); __atomic_load (gapg_temp_atomic, &gapg_temp_newval, 5) ; gapg_temp_newval; })) && g_once_init_enter_pointer ( &static_g_define_type_id)); })) ) { GType g_define_type_id = eel_labeled_image_accessible_get_type_once (); (__extension__ ({ _Static_assert (sizeof *(&static_g_define_type_id) == sizeof (gpointer), "Expression evaluates to false"); 0 ? (void ) (*(&static_g_define_type_id) = (g_define_type_id)) : (void ) 0; g_once_init_leave_pointer ((&static_g_define_type_id ), (gpointer) (guintptr) (g_define_type_id)); })) ; } return static_g_define_type_id ; } __attribute__ ((__noinline__)) static GType eel_labeled_image_accessible_get_type_once (void) { GType g_define_type_id = g_type_register_static_simple ((ctk_container_accessible_get_type ()), g_intern_static_string ("EelLabeledImageAccessible"), sizeof (EelLabeledImageAccessibleClass ), (GClassInitFunc)(void (*)(void)) eel_labeled_image_accessible_class_intern_init , sizeof (EelLabeledImageAccessible), (GInstanceInitFunc)(void (*)(void)) eel_labeled_image_accessible_init, (GTypeFlags) 0 ); { {{ const GInterfaceInfo g_implement_interface_info = { ( GInterfaceInitFunc)(void (*)(void)) eel_labeled_image_accessible_image_interface_init , ((void*)0), ((void*)0) }; g_type_add_interface_static (g_define_type_id , (atk_image_get_type ()), &g_implement_interface_info); } ;} } return g_define_type_id; } |
2271 | eel_labeled_image_accessible,static void eel_labeled_image_accessible_init (EelLabeledImageAccessible *self); static void eel_labeled_image_accessible_class_init ( EelLabeledImageAccessibleClass *klass); static GType eel_labeled_image_accessible_get_type_once (void); static gpointer eel_labeled_image_accessible_parent_class = ((void*)0); static gint EelLabeledImageAccessible_private_offset ; static void eel_labeled_image_accessible_class_intern_init ( gpointer klass) { eel_labeled_image_accessible_parent_class = g_type_class_peek_parent (klass); if (EelLabeledImageAccessible_private_offset != 0) g_type_class_adjust_private_offset (klass, &EelLabeledImageAccessible_private_offset ); eel_labeled_image_accessible_class_init ((EelLabeledImageAccessibleClass *) klass); } __attribute__ ((__unused__)) static inline gpointer eel_labeled_image_accessible_get_instance_private (EelLabeledImageAccessible *self) { return (((gpointer) ((guint8*) (self) + (glong) (EelLabeledImageAccessible_private_offset )))); } GType eel_labeled_image_accessible_get_type (void) { static GType static_g_define_type_id = 0; if ((__extension__ ({ _Static_assert (sizeof *(&static_g_define_type_id) == sizeof (gpointer) , "Expression evaluates to false"); (void) (0 ? (gpointer) * ( &static_g_define_type_id) : ((void*)0)); (!(__extension__ ({ _Static_assert (sizeof *(&static_g_define_type_id) == sizeof (gpointer), "Expression evaluates to false"); __typeof__ (*(&static_g_define_type_id)) gapg_temp_newval; __typeof__ ((&static_g_define_type_id)) gapg_temp_atomic = (&static_g_define_type_id ); __atomic_load (gapg_temp_atomic, &gapg_temp_newval, 5) ; gapg_temp_newval; })) && g_once_init_enter_pointer ( &static_g_define_type_id)); })) ) { GType g_define_type_id = eel_labeled_image_accessible_get_type_once (); (__extension__ ({ _Static_assert (sizeof *(&static_g_define_type_id) == sizeof (gpointer), "Expression evaluates to false"); 0 ? (void ) (*(&static_g_define_type_id) = (g_define_type_id)) : (void ) 0; g_once_init_leave_pointer ((&static_g_define_type_id ), (gpointer) (guintptr) (g_define_type_id)); })) ; } return static_g_define_type_id ; } __attribute__ ((__noinline__)) static GType eel_labeled_image_accessible_get_type_once (void) { GType g_define_type_id = g_type_register_static_simple ((ctk_container_accessible_get_type ()), g_intern_static_string ("EelLabeledImageAccessible"), sizeof (EelLabeledImageAccessibleClass ), (GClassInitFunc)(void (*)(void)) eel_labeled_image_accessible_class_intern_init , sizeof (EelLabeledImageAccessible), (GInstanceInitFunc)(void (*)(void)) eel_labeled_image_accessible_init, (GTypeFlags) 0 ); { {{ const GInterfaceInfo g_implement_interface_info = { ( GInterfaceInitFunc)(void (*)(void)) eel_labeled_image_accessible_image_interface_init , ((void*)0), ((void*)0) }; g_type_add_interface_static (g_define_type_id , (atk_image_get_type ()), &g_implement_interface_info); } ;} } return g_define_type_id; } |
2272 | CTK_TYPE_CONTAINER_ACCESSIBLE,static void eel_labeled_image_accessible_init (EelLabeledImageAccessible *self); static void eel_labeled_image_accessible_class_init ( EelLabeledImageAccessibleClass *klass); static GType eel_labeled_image_accessible_get_type_once (void); static gpointer eel_labeled_image_accessible_parent_class = ((void*)0); static gint EelLabeledImageAccessible_private_offset ; static void eel_labeled_image_accessible_class_intern_init ( gpointer klass) { eel_labeled_image_accessible_parent_class = g_type_class_peek_parent (klass); if (EelLabeledImageAccessible_private_offset != 0) g_type_class_adjust_private_offset (klass, &EelLabeledImageAccessible_private_offset ); eel_labeled_image_accessible_class_init ((EelLabeledImageAccessibleClass *) klass); } __attribute__ ((__unused__)) static inline gpointer eel_labeled_image_accessible_get_instance_private (EelLabeledImageAccessible *self) { return (((gpointer) ((guint8*) (self) + (glong) (EelLabeledImageAccessible_private_offset )))); } GType eel_labeled_image_accessible_get_type (void) { static GType static_g_define_type_id = 0; if ((__extension__ ({ _Static_assert (sizeof *(&static_g_define_type_id) == sizeof (gpointer) , "Expression evaluates to false"); (void) (0 ? (gpointer) * ( &static_g_define_type_id) : ((void*)0)); (!(__extension__ ({ _Static_assert (sizeof *(&static_g_define_type_id) == sizeof (gpointer), "Expression evaluates to false"); __typeof__ (*(&static_g_define_type_id)) gapg_temp_newval; __typeof__ ((&static_g_define_type_id)) gapg_temp_atomic = (&static_g_define_type_id ); __atomic_load (gapg_temp_atomic, &gapg_temp_newval, 5) ; gapg_temp_newval; })) && g_once_init_enter_pointer ( &static_g_define_type_id)); })) ) { GType g_define_type_id = eel_labeled_image_accessible_get_type_once (); (__extension__ ({ _Static_assert (sizeof *(&static_g_define_type_id) == sizeof (gpointer), "Expression evaluates to false"); 0 ? (void ) (*(&static_g_define_type_id) = (g_define_type_id)) : (void ) 0; g_once_init_leave_pointer ((&static_g_define_type_id ), (gpointer) (guintptr) (g_define_type_id)); })) ; } return static_g_define_type_id ; } __attribute__ ((__noinline__)) static GType eel_labeled_image_accessible_get_type_once (void) { GType g_define_type_id = g_type_register_static_simple ((ctk_container_accessible_get_type ()), g_intern_static_string ("EelLabeledImageAccessible"), sizeof (EelLabeledImageAccessibleClass ), (GClassInitFunc)(void (*)(void)) eel_labeled_image_accessible_class_intern_init , sizeof (EelLabeledImageAccessible), (GInstanceInitFunc)(void (*)(void)) eel_labeled_image_accessible_init, (GTypeFlags) 0 ); { {{ const GInterfaceInfo g_implement_interface_info = { ( GInterfaceInitFunc)(void (*)(void)) eel_labeled_image_accessible_image_interface_init , ((void*)0), ((void*)0) }; g_type_add_interface_static (g_define_type_id , (atk_image_get_type ()), &g_implement_interface_info); } ;} } return g_define_type_id; } |
2273 | G_IMPLEMENT_INTERFACE (ATK_TYPE_IMAGE,static void eel_labeled_image_accessible_init (EelLabeledImageAccessible *self); static void eel_labeled_image_accessible_class_init ( EelLabeledImageAccessibleClass *klass); static GType eel_labeled_image_accessible_get_type_once (void); static gpointer eel_labeled_image_accessible_parent_class = ((void*)0); static gint EelLabeledImageAccessible_private_offset ; static void eel_labeled_image_accessible_class_intern_init ( gpointer klass) { eel_labeled_image_accessible_parent_class = g_type_class_peek_parent (klass); if (EelLabeledImageAccessible_private_offset != 0) g_type_class_adjust_private_offset (klass, &EelLabeledImageAccessible_private_offset ); eel_labeled_image_accessible_class_init ((EelLabeledImageAccessibleClass *) klass); } __attribute__ ((__unused__)) static inline gpointer eel_labeled_image_accessible_get_instance_private (EelLabeledImageAccessible *self) { return (((gpointer) ((guint8*) (self) + (glong) (EelLabeledImageAccessible_private_offset )))); } GType eel_labeled_image_accessible_get_type (void) { static GType static_g_define_type_id = 0; if ((__extension__ ({ _Static_assert (sizeof *(&static_g_define_type_id) == sizeof (gpointer) , "Expression evaluates to false"); (void) (0 ? (gpointer) * ( &static_g_define_type_id) : ((void*)0)); (!(__extension__ ({ _Static_assert (sizeof *(&static_g_define_type_id) == sizeof (gpointer), "Expression evaluates to false"); __typeof__ (*(&static_g_define_type_id)) gapg_temp_newval; __typeof__ ((&static_g_define_type_id)) gapg_temp_atomic = (&static_g_define_type_id ); __atomic_load (gapg_temp_atomic, &gapg_temp_newval, 5) ; gapg_temp_newval; })) && g_once_init_enter_pointer ( &static_g_define_type_id)); })) ) { GType g_define_type_id = eel_labeled_image_accessible_get_type_once (); (__extension__ ({ _Static_assert (sizeof *(&static_g_define_type_id) == sizeof (gpointer), "Expression evaluates to false"); 0 ? (void ) (*(&static_g_define_type_id) = (g_define_type_id)) : (void ) 0; g_once_init_leave_pointer ((&static_g_define_type_id ), (gpointer) (guintptr) (g_define_type_id)); })) ; } return static_g_define_type_id ; } __attribute__ ((__noinline__)) static GType eel_labeled_image_accessible_get_type_once (void) { GType g_define_type_id = g_type_register_static_simple ((ctk_container_accessible_get_type ()), g_intern_static_string ("EelLabeledImageAccessible"), sizeof (EelLabeledImageAccessibleClass ), (GClassInitFunc)(void (*)(void)) eel_labeled_image_accessible_class_intern_init , sizeof (EelLabeledImageAccessible), (GInstanceInitFunc)(void (*)(void)) eel_labeled_image_accessible_init, (GTypeFlags) 0 ); { {{ const GInterfaceInfo g_implement_interface_info = { ( GInterfaceInitFunc)(void (*)(void)) eel_labeled_image_accessible_image_interface_init , ((void*)0), ((void*)0) }; g_type_add_interface_static (g_define_type_id , (atk_image_get_type ()), &g_implement_interface_info); } ;} } return g_define_type_id; } |
2274 | eel_labeled_image_accessible_image_interface_init))static void eel_labeled_image_accessible_init (EelLabeledImageAccessible *self); static void eel_labeled_image_accessible_class_init ( EelLabeledImageAccessibleClass *klass); static GType eel_labeled_image_accessible_get_type_once (void); static gpointer eel_labeled_image_accessible_parent_class = ((void*)0); static gint EelLabeledImageAccessible_private_offset ; static void eel_labeled_image_accessible_class_intern_init ( gpointer klass) { eel_labeled_image_accessible_parent_class = g_type_class_peek_parent (klass); if (EelLabeledImageAccessible_private_offset != 0) g_type_class_adjust_private_offset (klass, &EelLabeledImageAccessible_private_offset ); eel_labeled_image_accessible_class_init ((EelLabeledImageAccessibleClass *) klass); } __attribute__ ((__unused__)) static inline gpointer eel_labeled_image_accessible_get_instance_private (EelLabeledImageAccessible *self) { return (((gpointer) ((guint8*) (self) + (glong) (EelLabeledImageAccessible_private_offset )))); } GType eel_labeled_image_accessible_get_type (void) { static GType static_g_define_type_id = 0; if ((__extension__ ({ _Static_assert (sizeof *(&static_g_define_type_id) == sizeof (gpointer) , "Expression evaluates to false"); (void) (0 ? (gpointer) * ( &static_g_define_type_id) : ((void*)0)); (!(__extension__ ({ _Static_assert (sizeof *(&static_g_define_type_id) == sizeof (gpointer), "Expression evaluates to false"); __typeof__ (*(&static_g_define_type_id)) gapg_temp_newval; __typeof__ ((&static_g_define_type_id)) gapg_temp_atomic = (&static_g_define_type_id ); __atomic_load (gapg_temp_atomic, &gapg_temp_newval, 5) ; gapg_temp_newval; })) && g_once_init_enter_pointer ( &static_g_define_type_id)); })) ) { GType g_define_type_id = eel_labeled_image_accessible_get_type_once (); (__extension__ ({ _Static_assert (sizeof *(&static_g_define_type_id) == sizeof (gpointer), "Expression evaluates to false"); 0 ? (void ) (*(&static_g_define_type_id) = (g_define_type_id)) : (void ) 0; g_once_init_leave_pointer ((&static_g_define_type_id ), (gpointer) (guintptr) (g_define_type_id)); })) ; } return static_g_define_type_id ; } __attribute__ ((__noinline__)) static GType eel_labeled_image_accessible_get_type_once (void) { GType g_define_type_id = g_type_register_static_simple ((ctk_container_accessible_get_type ()), g_intern_static_string ("EelLabeledImageAccessible"), sizeof (EelLabeledImageAccessibleClass ), (GClassInitFunc)(void (*)(void)) eel_labeled_image_accessible_class_intern_init , sizeof (EelLabeledImageAccessible), (GInstanceInitFunc)(void (*)(void)) eel_labeled_image_accessible_init, (GTypeFlags) 0 ); { {{ const GInterfaceInfo g_implement_interface_info = { ( GInterfaceInitFunc)(void (*)(void)) eel_labeled_image_accessible_image_interface_init , ((void*)0), ((void*)0) }; g_type_add_interface_static (g_define_type_id , (atk_image_get_type ()), &g_implement_interface_info); } ;} } return g_define_type_id; }; |
2275 | static void |
2276 | eel_labeled_image_accessible_class_init (EelLabeledImageAccessibleClass *klass) |
2277 | { |
2278 | AtkObjectClass *atk_class = ATK_OBJECT_CLASS (klass)((((AtkObjectClass*) (void *) g_type_check_class_cast ((GTypeClass *) ((klass)), ((atk_object_get_type ())))))); |
2279 | a11y_parent_class = g_type_class_peek_parent (klass); |
2280 | |
2281 | atk_class->get_name = eel_labeled_image_accessible_get_name; |
2282 | atk_class->initialize = eel_labeled_image_accessible_initialize; |
2283 | } |
2284 | |
2285 | static void |
2286 | eel_labeled_image_accessible_init (EelLabeledImageAccessible *accessible G_GNUC_UNUSED__attribute__ ((__unused__))) |
2287 | { |
2288 | } |
2289 | |
2290 | static void |
2291 | eel_labeled_image_button_class_init (CtkWidgetClass *klass G_GNUC_UNUSED__attribute__ ((__unused__))) |
2292 | { |
2293 | } |
2294 | |
2295 | static GType |
2296 | eel_labeled_image_button_get_type (void) |
2297 | { |
2298 | static GType type = 0; |
2299 | |
2300 | if (!type) |
2301 | { |
2302 | GTypeInfo info = |
2303 | { |
2304 | sizeof (CtkButtonClass), |
2305 | (GBaseInitFunc) NULL((void*)0), |
2306 | (GBaseFinalizeFunc) NULL((void*)0), |
2307 | (GClassInitFunc) eel_labeled_image_button_class_init, |
2308 | NULL((void*)0), /* class_finalize */ |
2309 | NULL((void*)0), /* class_data */ |
2310 | sizeof (CtkButton), |
2311 | 0, /* n_preallocs */ |
2312 | (GInstanceInitFunc) NULL((void*)0) |
2313 | }; |
2314 | |
2315 | type = g_type_register_static |
2316 | (CTK_TYPE_BUTTON(ctk_button_get_type ()), |
2317 | "EelLabeledImageButton", &info, 0); |
2318 | } |
2319 | |
2320 | return type; |
2321 | } |
2322 | |
2323 | static GType |
2324 | eel_labeled_image_check_button_get_type (void) |
2325 | { |
2326 | static GType type = 0; |
2327 | |
2328 | if (!type) |
2329 | { |
2330 | GTypeInfo info = |
2331 | { |
2332 | sizeof (CtkCheckButtonClass), |
2333 | (GBaseInitFunc) NULL((void*)0), |
2334 | (GBaseFinalizeFunc) NULL((void*)0), |
2335 | (GClassInitFunc) eel_labeled_image_button_class_init, |
2336 | NULL((void*)0), /* class_finalize */ |
2337 | NULL((void*)0), /* class_data */ |
2338 | sizeof (CtkCheckButton), |
2339 | 0, /* n_preallocs */ |
2340 | (GInstanceInitFunc) NULL((void*)0) |
2341 | }; |
2342 | |
2343 | type = g_type_register_static |
2344 | (CTK_TYPE_CHECK_BUTTON(ctk_check_button_get_type ()), |
2345 | "EelLabeledImageCheckButton", &info, 0); |
2346 | } |
2347 | |
2348 | return type; |
2349 | } |
2350 | |
2351 | static GType |
2352 | eel_labeled_image_toggle_button_get_type (void) |
2353 | { |
2354 | static GType type = 0; |
2355 | |
2356 | if (!type) |
2357 | { |
2358 | GTypeInfo info = |
2359 | { |
2360 | sizeof (CtkToggleButtonClass), |
2361 | (GBaseInitFunc) NULL((void*)0), |
2362 | (GBaseFinalizeFunc) NULL((void*)0), |
2363 | (GClassInitFunc) eel_labeled_image_button_class_init, |
2364 | NULL((void*)0), /* class_finalize */ |
2365 | NULL((void*)0), /* class_data */ |
2366 | sizeof (CtkToggleButton), |
2367 | 0, /* n_preallocs */ |
2368 | (GInstanceInitFunc) NULL((void*)0) |
2369 | }; |
2370 | |
2371 | type = g_type_register_static |
2372 | (CTK_TYPE_TOGGLE_BUTTON(ctk_toggle_button_get_type ()), |
2373 | "EelLabeledImageToggleButton", &info, 0); |
2374 | } |
2375 | |
2376 | return type; |
2377 | } |
2378 | |
2379 | |
2380 | static GType |
2381 | eel_labeled_image_radio_button_get_type (void) |
2382 | { |
2383 | static GType type = 0; |
2384 | |
2385 | if (!type) |
2386 | { |
2387 | GTypeInfo info = |
2388 | { |
2389 | sizeof (CtkRadioButtonClass), |
2390 | (GBaseInitFunc) NULL((void*)0), |
2391 | (GBaseFinalizeFunc) NULL((void*)0), |
2392 | (GClassInitFunc) eel_labeled_image_button_class_init, |
2393 | NULL((void*)0), /* class_finalize */ |
2394 | NULL((void*)0), /* class_data */ |
2395 | sizeof (CtkRadioButton), |
2396 | 0, /* n_preallocs */ |
2397 | (GInstanceInitFunc) NULL((void*)0) |
2398 | }; |
2399 | |
2400 | type = g_type_register_static |
2401 | (CTK_TYPE_RADIO_BUTTON(ctk_radio_button_get_type ()), |
2402 | "EelLabeledImageRadioButton", &info, 0); |
2403 | } |
2404 | |
2405 | return type; |
2406 | } |