Bug Summary

File:tests/testctk.c
Warning:line 1437, column 7
Value stored to 'button' is never read

Annotated Source Code

Press '?' to see keyboard shortcuts

clang -cc1 -cc1 -triple x86_64-pc-linux-gnu -analyze -disable-free -clear-ast-before-backend -disable-llvm-verifier -discard-value-names -main-file-name testctk.c -analyzer-checker=core -analyzer-checker=apiModeling -analyzer-checker=unix -analyzer-checker=deadcode -analyzer-checker=security.insecureAPI.UncheckedReturn -analyzer-checker=security.insecureAPI.getpw -analyzer-checker=security.insecureAPI.gets -analyzer-checker=security.insecureAPI.mktemp -analyzer-checker=security.insecureAPI.mkstemp -analyzer-checker=security.insecureAPI.vfork -analyzer-checker=nullability.NullPassedToNonnull -analyzer-checker=nullability.NullReturnedFromNonnull -analyzer-output plist -w -setup-static-analyzer -mrelocation-model pic -pic-level 2 -pic-is-pie -mframe-pointer=all -fmath-errno -ffp-contract=on -fno-rounding-math -mconstructor-aliases -funwind-tables=2 -target-cpu x86-64 -tune-cpu generic -debugger-tuning=gdb -fdebug-compilation-dir=/rootdir/tests -fcoverage-compilation-dir=/rootdir/tests -resource-dir /usr/lib/llvm-19/lib/clang/19 -D HAVE_CONFIG_H -I . -I .. -I .. -I ../cdk -I ../cdk -D G_ENABLE_DEBUG -D G_ENABLE_CONSISTENCY_CHECKS -D GLIB_MIN_REQUIRED_VERSION=GLIB_VERSION_2_66 -D GLIB_MAX_ALLOWED_VERSION=GLIB_VERSION_2_66 -I /usr/include/pango-1.0 -I /usr/include/glib-2.0 -I /usr/lib/x86_64-linux-gnu/glib-2.0/include -I /usr/include/sysprof-6 -I /usr/include/harfbuzz -I /usr/include/freetype2 -I /usr/include/libpng16 -I /usr/include/libmount -I /usr/include/blkid -I /usr/include/fribidi -I /usr/include/cairo -I /usr/include/pixman-1 -I /usr/include/atk-1.0 -I /usr/include/gdk-pixbuf-2.0 -I /usr/include/x86_64-linux-gnu -I /usr/include/webp -I /usr/include/at-spi2-atk/2.0 -I /usr/include/at-spi-2.0 -I /usr/include/dbus-1.0 -I /usr/lib/x86_64-linux-gnu/dbus-1.0/include -I /usr/include/gio-unix-2.0 -I /usr/include/harfbuzz -I /usr/include/freetype2 -I /usr/include/libpng16 -I /usr/include/glib-2.0 -I /usr/lib/x86_64-linux-gnu/glib-2.0/include -I /usr/include/sysprof-6 -I /usr/include/pango-1.0 -I /usr/include/libmount -I /usr/include/blkid -I /usr/include/fribidi -I /usr/include/cairo -I /usr/include/pixman-1 -I /usr/include/pango-1.0 -I /usr/include/glib-2.0 -I /usr/lib/x86_64-linux-gnu/glib-2.0/include -I /usr/include/sysprof-6 -I /usr/include/harfbuzz -I /usr/include/freetype2 -I /usr/include/libpng16 -I /usr/include/libmount -I /usr/include/blkid -I /usr/include/fribidi -I /usr/include/cairo -I /usr/include/pixman-1 -I /usr/include/gdk-pixbuf-2.0 -I /usr/include/x86_64-linux-gnu -I /usr/include/webp -I /usr/include/gio-unix-2.0 -internal-isystem /usr/lib/llvm-19/lib/clang/19/include -internal-isystem /usr/local/include -internal-isystem /usr/lib/gcc/x86_64-linux-gnu/14/../../../../x86_64-linux-gnu/include -internal-externc-isystem /usr/include/x86_64-linux-gnu -internal-externc-isystem /include -internal-externc-isystem /usr/include -ferror-limit 19 -fgnuc-version=4.2.1 -fskip-odr-check-in-gmf -analyzer-checker deadcode.DeadStores -analyzer-checker alpha.deadcode.UnreachableCode -analyzer-checker alpha.core.CastSize -analyzer-checker alpha.core.CastToStruct -analyzer-checker alpha.core.IdenticalExpr -analyzer-checker alpha.security.ArrayBoundV2 -analyzer-checker alpha.security.MallocOverflow -analyzer-checker alpha.security.ReturnPtrRange -analyzer-checker alpha.unix.SimpleStream -analyzer-checker alpha.unix.cstring.BufferOverlap -analyzer-checker alpha.unix.cstring.NotNullTerminated -analyzer-checker alpha.unix.cstring.OutOfBounds -analyzer-checker alpha.core.FixedAddr -analyzer-output=html -faddrsig -D__GCC_HAVE_DWARF2_CFI_ASM=1 -o /rootdir/html-report/2024-12-22-120316-43637-1 -x c testctk.c
1/* CTK - The GIMP Toolkit
2 * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
3 *
4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Lesser General Public
6 * License as published by the Free Software Foundation; either
7 * version 2 of the License, or (at your option) any later version.
8 *
9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * Lesser General Public License for more details.
13 *
14 * You should have received a copy of the GNU Lesser General Public
15 * License along with this library. If not, see <http://www.gnu.org/licenses/>.
16 */
17
18/*
19 * Modified by the CTK+ Team and others 1997-2000. See the AUTHORS
20 * file for a list of people on the CTK+ Team. See the ChangeLog
21 * files for a list of changes. These files are distributed with
22 * CTK+ at ftp://ftp.ctk.org/pub/ctk/.
23 */
24
25
26#include "config.h"
27
28#undef G_LOG_DOMAIN((gchar*) 0)
29
30#include <stdio.h>
31#include <stdlib.h>
32#include <string.h>
33#include <sys/stat.h>
34#include <math.h>
35#include <time.h>
36#ifdef HAVE_UNISTD_H1
37#include <unistd.h>
38#endif
39
40#include "ctk/ctk.h"
41#include "cdk/cdk.h"
42#include "cdk/cdkkeysyms.h"
43
44#ifdef G_OS_WIN32
45#define sleep(n) _sleep(n)
46#endif
47
48#include "test.xpm"
49
50gboolean
51file_exists (const char *filename)
52{
53 struct stat statbuf;
54
55 return stat (filename, &statbuf) == 0;
56}
57
58CtkWidget *
59shape_create_icon (CdkScreen *screen,
60 char *xpm_file,
61 gint x,
62 gint y,
63 gint px,
64 gint py,
65 gint window_type);
66
67static CtkWidget *
68build_option_menu (gchar *items[],
69 gint num_items,
70 gint history,
71 void (*func) (CtkWidget *widget, gpointer data),
72 gpointer data);
73
74/* macro, structure and variables used by tree window demos */
75#define DEFAULT_NUMBER_OF_ITEM3 3
76#define DEFAULT_RECURSION_LEVEL3 3
77
78struct {
79 GSList* selection_mode_group;
80 CtkWidget* single_button;
81 CtkWidget* browse_button;
82 CtkWidget* multiple_button;
83 CtkWidget* draw_line_button;
84 CtkWidget* view_line_button;
85 CtkWidget* no_root_item_button;
86 CtkWidget* nb_item_spinner;
87 CtkWidget* recursion_spinner;
88} sTreeSampleSelection;
89
90typedef struct sTreeButtons {
91 guint nb_item_add;
92 CtkWidget* add_button;
93 CtkWidget* remove_button;
94 CtkWidget* subtree_button;
95} sTreeButtons;
96/* end of tree section */
97
98static CtkWidget *
99build_option_menu (gchar *items[],
100 gint num_items,
101 gint history,
102 void (*func)(CtkWidget *widget, gpointer data),
103 gpointer data)
104{
105 CtkWidget *omenu;
106 gint i;
107
108 omenu = ctk_combo_box_text_new ();
109 g_signal_connect (omenu, "changed",g_signal_connect_data ((omenu), ("changed"), (((GCallback) (func
))), (data), ((void*)0), (GConnectFlags) 0)
110 G_CALLBACK (func), data)g_signal_connect_data ((omenu), ("changed"), (((GCallback) (func
))), (data), ((void*)0), (GConnectFlags) 0)
;
111
112 for (i = 0; i < num_items; i++)
113 ctk_combo_box_text_append_text (CTK_COMBO_BOX_TEXT (omenu)((((CtkComboBoxText*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((omenu)), ((ctk_combo_box_text_get_type ()))))))
, items[i]);
114
115 ctk_combo_box_set_active (CTK_COMBO_BOX (omenu)((((CtkComboBox*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((omenu)), ((ctk_combo_box_get_type ()))))))
, history);
116
117 return omenu;
118}
119
120/*
121 * Windows with an alpha channel
122 */
123
124
125static gboolean
126on_alpha_window_draw (CtkWidget *widget,
127 cairo_t *cr)
128{
129 cairo_pattern_t *pattern;
130 int radius, width, height;
131
132 /* Get the child allocation to avoid painting over the borders */
133 CtkWidget *child = ctk_bin_get_child (CTK_BIN (widget)((((CtkBin*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((widget)), ((ctk_bin_get_type ()))))))
);
134 CtkAllocation child_allocation;
135 int border_width = ctk_container_get_border_width (CTK_CONTAINER (child)((((CtkContainer*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((child)), ((ctk_container_get_type ()))))))
);
136
137 ctk_widget_get_allocation (child, &child_allocation);
138 child_allocation.x -= border_width;
139 child_allocation.y -= border_width;
140 child_allocation.width += 2 * border_width;
141 child_allocation.height += 2 * border_width;
142
143 cairo_translate (cr, child_allocation.x, child_allocation.y);
144
145 cairo_rectangle (cr, 0, 0, child_allocation.width, child_allocation.height);
146 cairo_clip (cr);
147
148 width = ctk_widget_get_allocated_width (widget);
149 height = ctk_widget_get_allocated_height (widget);
150 radius = MIN (width, height)(((width) < (height)) ? (width) : (height)) / 2;
151 pattern = cairo_pattern_create_radial (width / 2,
152 height / 2,
153 0.0,
154 width / 2,
155 height / 2,
156 radius * 1.33);
157
158 if (cdk_screen_get_rgba_visual (ctk_widget_get_screen (widget)) &&
159 ctk_widget_is_composited (widget))
160 cairo_set_source_rgba (cr, 1.0, 1.0, 1.0, 0.0); /* transparent */
161 else
162 cairo_set_source_rgb (cr, 1.0, 1.0, 1.0); /* opaque white */
163
164 cairo_set_operator (cr, CAIRO_OPERATOR_SOURCE);
165 cairo_paint (cr);
166
167 cairo_pattern_add_color_stop_rgba (pattern, 0.0,
168 1.0, 0.75, 0.0, 1.0); /* solid orange */
169 cairo_pattern_add_color_stop_rgba (pattern, 1.0,
170 1.0, 0.75, 0.0, 0.0); /* transparent orange */
171
172 cairo_set_source (cr, pattern);
173 cairo_pattern_destroy (pattern);
174
175 cairo_set_operator (cr, CAIRO_OPERATOR_OVER);
176 cairo_paint (cr);
177
178 return FALSE(0);
179}
180
181static CtkWidget *
182build_alpha_widgets (void)
183{
184 CtkWidget *grid;
185 CtkWidget *radio_button;
186 CtkWidget *check_button;
187 CtkWidget *hbox;
188 CtkWidget *label;
189 CtkWidget *entry;
190
191 grid = ctk_grid_new ();
192
193 radio_button = ctk_radio_button_new_with_label (NULL((void*)0), "Red");
194 ctk_widget_set_hexpand (radio_button, TRUE(!(0)));
195 ctk_grid_attach (CTK_GRID (grid)((((CtkGrid*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((grid)), ((ctk_grid_get_type ()))))))
, radio_button, 0, 0, 1, 1);
196
197 radio_button = ctk_radio_button_new_with_label_from_widget (CTK_RADIO_BUTTON (radio_button)((((CtkRadioButton*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((radio_button)), ((ctk_radio_button_get_type ()))))))
, "Green");
198 ctk_widget_set_hexpand (radio_button, TRUE(!(0)));
199 ctk_grid_attach (CTK_GRID (grid)((((CtkGrid*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((grid)), ((ctk_grid_get_type ()))))))
, radio_button, 0, 1, 1, 1);
200
201 radio_button = ctk_radio_button_new_with_label_from_widget (CTK_RADIO_BUTTON (radio_button)((((CtkRadioButton*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((radio_button)), ((ctk_radio_button_get_type ()))))))
, "Blue"),
202 ctk_widget_set_hexpand (radio_button, TRUE(!(0)));
203 ctk_grid_attach (CTK_GRID (grid)((((CtkGrid*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((grid)), ((ctk_grid_get_type ()))))))
, radio_button, 0, 2, 1, 1);
204
205 check_button = ctk_check_button_new_with_label ("Sedentary"),
206 ctk_widget_set_hexpand (check_button, TRUE(!(0)));
207 ctk_grid_attach (CTK_GRID (grid)((((CtkGrid*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((grid)), ((ctk_grid_get_type ()))))))
, check_button, 1, 0, 1, 1);
208
209 check_button = ctk_check_button_new_with_label ("Nocturnal"),
210 ctk_widget_set_hexpand (check_button, TRUE(!(0)));
211 ctk_grid_attach (CTK_GRID (grid)((((CtkGrid*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((grid)), ((ctk_grid_get_type ()))))))
, check_button, 1, 1, 1, 1);
212
213 check_button = ctk_check_button_new_with_label ("Compulsive"),
214 ctk_widget_set_hexpand (check_button, TRUE(!(0)));
215 ctk_grid_attach (CTK_GRID (grid)((((CtkGrid*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((grid)), ((ctk_grid_get_type ()))))))
, check_button, 1, 2, 1, 1);
216
217 hbox = ctk_box_new (CTK_ORIENTATION_HORIZONTAL, 0);
218 label = ctk_label_new (NULL((void*)0));
219 ctk_label_set_markup (CTK_LABEL (label)((((CtkLabel*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((label)), ((ctk_label_get_type ()))))))
, "<i>Entry: </i>");
220 ctk_box_pack_start (CTK_BOX (hbox)((((CtkBox*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((hbox)), ((ctk_box_get_type ()))))))
, label, FALSE(0), FALSE(0), 0);
221 entry = ctk_entry_new ();
222 ctk_box_pack_start (CTK_BOX (hbox)((((CtkBox*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((hbox)), ((ctk_box_get_type ()))))))
, entry, TRUE(!(0)), TRUE(!(0)), 0);
223 ctk_widget_set_hexpand (hbox, TRUE(!(0)));
224 ctk_grid_attach (CTK_GRID (grid)((((CtkGrid*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((grid)), ((ctk_grid_get_type ()))))))
, hbox, 0, 3, 2, 1);
225
226 return grid;
227}
228
229static void
230on_alpha_screen_changed (CtkWindow *window,
231 CdkScreen *old_screen G_GNUC_UNUSED__attribute__ ((__unused__)),
232 CtkWidget *label)
233{
234 CdkScreen *screen = ctk_widget_get_screen (CTK_WIDGET (window)((((CtkWidget*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((window)), ((ctk_widget_get_type ()))))))
);
235 CdkVisual *visual = cdk_screen_get_rgba_visual (screen);
236
237 if (!visual)
238 {
239 visual = cdk_screen_get_system_visual (screen);
240 ctk_label_set_markup (CTK_LABEL (label)((((CtkLabel*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((label)), ((ctk_label_get_type ()))))))
, "<b>Screen doesn't support alpha</b>");
241 }
242 else
243 {
244 ctk_label_set_markup (CTK_LABEL (label)((((CtkLabel*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((label)), ((ctk_label_get_type ()))))))
, "<b>Screen supports alpha</b>");
245 }
246
247 ctk_widget_set_visual (CTK_WIDGET (window)((((CtkWidget*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((window)), ((ctk_widget_get_type ()))))))
, visual);
248}
249
250static void
251on_composited_changed (CtkWidget *window,
252 CtkLabel *label)
253{
254 gboolean is_composited = ctk_widget_is_composited (window);
255
256 if (is_composited)
257 ctk_label_set_text (label, "Composited");
258 else
259 ctk_label_set_text (label, "Not composited");
260}
261
262void
263create_alpha_window (CtkWidget *widget)
264{
265 static CtkWidget *window;
266
267 if (!window)
268 {
269 CtkWidget *content_area;
270 CtkWidget *vbox;
271 CtkWidget *label;
272
273 window = ctk_dialog_new_with_buttons ("Alpha Window",
274 CTK_WINDOW (ctk_widget_get_toplevel (widget))((((CtkWindow*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((ctk_widget_get_toplevel (widget))), ((ctk_window_get_type
()))))))
, 0,
275 "_Close", 0,
276 NULL((void*)0));
277
278 ctk_widget_set_app_paintable (window, TRUE(!(0)));
279 g_signal_connect (window, "draw",g_signal_connect_data ((window), ("draw"), (((GCallback) (on_alpha_window_draw
))), (((void*)0)), ((void*)0), (GConnectFlags) 0)
280 G_CALLBACK (on_alpha_window_draw), NULL)g_signal_connect_data ((window), ("draw"), (((GCallback) (on_alpha_window_draw
))), (((void*)0)), ((void*)0), (GConnectFlags) 0)
;
281
282 content_area = ctk_dialog_get_content_area (CTK_DIALOG (window)((((CtkDialog*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((window)), ((ctk_dialog_get_type ()))))))
);
283
284 vbox = ctk_box_new (CTK_ORIENTATION_VERTICAL, 8);
285 ctk_container_set_border_width (CTK_CONTAINER (vbox)((((CtkContainer*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((vbox)), ((ctk_container_get_type ()))))))
, 12);
286 ctk_box_pack_start (CTK_BOX (content_area)((((CtkBox*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((content_area)), ((ctk_box_get_type ()))))))
, vbox,
287 TRUE(!(0)), TRUE(!(0)), 0);
288
289 label = ctk_label_new (NULL((void*)0));
290 ctk_box_pack_start (CTK_BOX (vbox)((((CtkBox*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((vbox)), ((ctk_box_get_type ()))))))
, label, TRUE(!(0)), TRUE(!(0)), 0);
291 on_alpha_screen_changed (CTK_WINDOW (window)((((CtkWindow*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((window)), ((ctk_window_get_type ()))))))
, NULL((void*)0), label);
292 g_signal_connect (window, "screen-changed",g_signal_connect_data ((window), ("screen-changed"), (((GCallback
) (on_alpha_screen_changed))), (label), ((void*)0), (GConnectFlags
) 0)
293 G_CALLBACK (on_alpha_screen_changed), label)g_signal_connect_data ((window), ("screen-changed"), (((GCallback
) (on_alpha_screen_changed))), (label), ((void*)0), (GConnectFlags
) 0)
;
294
295 label = ctk_label_new (NULL((void*)0));
296 ctk_box_pack_start (CTK_BOX (vbox)((((CtkBox*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((vbox)), ((ctk_box_get_type ()))))))
, label, TRUE(!(0)), TRUE(!(0)), 0);
297 on_composited_changed (window, CTK_LABEL (label)((((CtkLabel*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((label)), ((ctk_label_get_type ()))))))
);
298 g_signal_connect (window, "composited_changed", G_CALLBACK (on_composited_changed), label)g_signal_connect_data ((window), ("composited_changed"), (((GCallback
) (on_composited_changed))), (label), ((void*)0), (GConnectFlags
) 0)
;
299
300 ctk_box_pack_start (CTK_BOX (vbox)((((CtkBox*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((vbox)), ((ctk_box_get_type ()))))))
, build_alpha_widgets (), TRUE(!(0)), TRUE(!(0)), 0);
301
302 g_signal_connect (window, "destroy",g_signal_connect_data ((window), ("destroy"), (((GCallback) (
ctk_widget_destroyed))), (&window), ((void*)0), (GConnectFlags
) 0)
303 G_CALLBACK (ctk_widget_destroyed),g_signal_connect_data ((window), ("destroy"), (((GCallback) (
ctk_widget_destroyed))), (&window), ((void*)0), (GConnectFlags
) 0)
304 &window)g_signal_connect_data ((window), ("destroy"), (((GCallback) (
ctk_widget_destroyed))), (&window), ((void*)0), (GConnectFlags
) 0)
;
305
306 g_signal_connect (window, "response",g_signal_connect_data ((window), ("response"), (((GCallback) (
ctk_widget_destroy))), (((void*)0)), ((void*)0), (GConnectFlags
) 0)
307 G_CALLBACK (ctk_widget_destroy),g_signal_connect_data ((window), ("response"), (((GCallback) (
ctk_widget_destroy))), (((void*)0)), ((void*)0), (GConnectFlags
) 0)
308 NULL)g_signal_connect_data ((window), ("response"), (((GCallback) (
ctk_widget_destroy))), (((void*)0)), ((void*)0), (GConnectFlags
) 0)
;
309 }
310
311 if (!ctk_widget_get_visible (window))
312 ctk_widget_show_all (window);
313 else
314 ctk_widget_destroy (window);
315}
316
317/*
318 * Composited non-toplevel window
319 */
320
321/* The draw event handler for the event box.
322 *
323 * This function simply draws a transparency onto a widget on the area
324 * for which it receives expose events. This is intended to give the
325 * event box a "transparent" background.
326 *
327 * In order for this to work properly, the widget must have an RGBA
328 * colourmap. The widget should also be set as app-paintable since it
329 * doesn't make sense for CTK to draw a background if we are drawing it
330 * (and because CTK might actually replace our transparency with its
331 * default background colour).
332 */
333static gboolean
334transparent_draw (CtkWidget *widget G_GNUC_UNUSED__attribute__ ((__unused__)),
335 cairo_t *cr)
336{
337 cairo_set_operator (cr, CAIRO_OPERATOR_CLEAR);
338 cairo_paint (cr);
339
340 return FALSE(0);
341}
342
343/* The expose event handler for the window.
344 *
345 * This function performs the actual compositing of the event box onto
346 * the already-existing background of the window at 50% normal opacity.
347 *
348 * In this case we do not want app-paintable to be set on the widget
349 * since we want it to draw its own (red) background. Because of this,
350 * however, we must ensure that we use g_signal_register_after so that
351 * this handler is called after the red has been drawn. If it was
352 * called before then CTK would just blindly paint over our work.
353 */
354static gboolean
355window_draw (CtkWidget *widget,
356 cairo_t *cr)
357{
358 CtkAllocation allocation;
359 CtkWidget *child;
360
361 /* put a red background on the window */
362 cairo_set_source_rgb (cr, 1, 0, 0);
363 cairo_paint (cr);
364
365 /* get our child (in this case, the event box) */
366 child = ctk_bin_get_child (CTK_BIN (widget)((((CtkBin*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((widget)), ((ctk_bin_get_type ()))))))
);
367
368 ctk_widget_get_allocation (child, &allocation);
369
370 /* the source data is the (composited) event box */
371 cdk_cairo_set_source_window (cr, ctk_widget_get_window (child),
372 allocation.x,
373 allocation.y);
374
375 /* composite, with a 50% opacity */
376 cairo_paint_with_alpha (cr, 0.5);
377
378 return FALSE(0);
379}
380
381void
382create_composited_window (CtkWidget *widget G_GNUC_UNUSED__attribute__ ((__unused__)))
383{
384 static CtkWidget *window;
385
386 if (!window)
387 {
388 CtkWidget *event, *button;
389
390 /* make the widgets */
391 button = ctk_button_new_with_label ("A Button");
392 event = ctk_event_box_new ();
393 window = ctk_window_new (CTK_WINDOW_TOPLEVEL);
394
395 g_signal_connect (window, "destroy",g_signal_connect_data ((window), ("destroy"), (((GCallback) (
ctk_widget_destroyed))), (&window), ((void*)0), (GConnectFlags
) 0)
396 G_CALLBACK (ctk_widget_destroyed),g_signal_connect_data ((window), ("destroy"), (((GCallback) (
ctk_widget_destroyed))), (&window), ((void*)0), (GConnectFlags
) 0)
397 &window)g_signal_connect_data ((window), ("destroy"), (((GCallback) (
ctk_widget_destroyed))), (&window), ((void*)0), (GConnectFlags
) 0)
;
398
399 /* set our event box to have a fully-transparent background
400 * drawn on it. currently there is no way to simply tell ctk
401 * that "transparency" is the background colour for a widget.
402 */
403 ctk_widget_set_app_paintable (CTK_WIDGET (event)((((CtkWidget*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((event)), ((ctk_widget_get_type ()))))))
, TRUE(!(0)));
404 g_signal_connect (event, "draw",g_signal_connect_data ((event), ("draw"), (((GCallback) (transparent_draw
))), (((void*)0)), ((void*)0), (GConnectFlags) 0)
405 G_CALLBACK (transparent_draw), NULL)g_signal_connect_data ((event), ("draw"), (((GCallback) (transparent_draw
))), (((void*)0)), ((void*)0), (GConnectFlags) 0)
;
406
407 /* put them inside one another */
408 ctk_container_set_border_width (CTK_CONTAINER (window)((((CtkContainer*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((window)), ((ctk_container_get_type ()))))))
, 10);
409 ctk_container_add (CTK_CONTAINER (window)((((CtkContainer*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((window)), ((ctk_container_get_type ()))))))
, event);
410 ctk_container_add (CTK_CONTAINER (event)((((CtkContainer*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((event)), ((ctk_container_get_type ()))))))
, button);
411
412 /* realise and show everything */
413 ctk_widget_realize (button);
414
415 /* set the event box CdkWindow to be composited.
416 * obviously must be performed after event box is realised.
417 */
418 cdk_window_set_composited (ctk_widget_get_window (event),
419 TRUE(!(0)));
420
421 /* set up the compositing handler.
422 * note that we do _after so that the normal (red) background is drawn
423 * by ctk before our compositing occurs.
424 */
425 g_signal_connect_after (window, "draw",g_signal_connect_data ((window), ("draw"), (((GCallback) (window_draw
))), (((void*)0)), ((void*)0), G_CONNECT_AFTER)
426 G_CALLBACK (window_draw), NULL)g_signal_connect_data ((window), ("draw"), (((GCallback) (window_draw
))), (((void*)0)), ((void*)0), G_CONNECT_AFTER)
;
427 }
428
429 if (!ctk_widget_get_visible (window))
430 ctk_widget_show_all (window);
431 else
432 ctk_widget_destroy (window);
433}
434
435/*
436 * Big windows and guffaw scrolling
437 */
438
439static void
440pattern_set_bg (CtkWidget *widget,
441 CdkWindow *child,
442 gint level)
443{
444 static CdkRGBA colors[] = {
445 { 0.27, 0.27, 1.0, 1.0 },
446 { 0.53, 0.53, 1.0, 1.0},
447 { 0.67, 0.67, 1.0, 1.0 }
448 };
449
450 cdk_window_set_user_data (child, widget);
451 cdk_window_set_background_rgba (child, &colors[level]);
452}
453
454static void
455create_pattern (CtkWidget *widget,
456 CdkWindow *parent,
457 gint level,
458 gint width,
459 gint height)
460{
461 gint h = 1;
462 gint i = 0;
463
464 CdkWindow *child;
465
466 while (2 * h <= height)
467 {
468 gint w = 1;
469 gint j = 0;
470
471 while (2 * w <= width)
472 {
473 if ((i + j) % 2 == 0)
474 {
475 gint x = w - 1;
476 gint y = h - 1;
477
478 CdkWindowAttr attributes;
479
480 attributes.window_type = CDK_WINDOW_CHILD;
481 attributes.x = x;
482 attributes.y = y;
483 attributes.width = w;
484 attributes.height = h;
485 attributes.wclass = CDK_INPUT_OUTPUT;
486 attributes.event_mask = CDK_EXPOSURE_MASK;
487 attributes.visual = ctk_widget_get_visual (widget);
488
489 child = cdk_window_new (parent, &attributes,
490 CDK_WA_X | CDK_WA_Y | CDK_WA_VISUAL);
491
492 pattern_set_bg (widget, child, level);
493
494 if (level < 2)
495 create_pattern (widget, child, level + 1, w, h);
496
497 cdk_window_show (child);
498 }
499 j++;
500 w *= 2;
501 }
502 i++;
503 h *= 2;
504 }
505}
506
507#define PATTERN_SIZE(1 << 18) (1 << 18)
508
509static void
510pattern_hadj_changed (CtkAdjustment *adjustment,
511 CtkWidget *darea)
512{
513 gint *old_value = g_object_get_data (G_OBJECT (adjustment)((((GObject*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((adjustment)), (((GType) ((20) << (2))))))))
, "old-value");
514 gint new_value = ctk_adjustment_get_value (adjustment);
515
516 if (ctk_widget_get_realized (darea))
517 {
518 cdk_window_scroll (ctk_widget_get_window (darea),
519 *old_value - new_value, 0);
520 *old_value = new_value;
521 }
522}
523
524static void
525pattern_vadj_changed (CtkAdjustment *adjustment,
526 CtkWidget *darea)
527{
528 gint *old_value = g_object_get_data (G_OBJECT (adjustment)((((GObject*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((adjustment)), (((GType) ((20) << (2))))))))
, "old-value");
529 gint new_value = ctk_adjustment_get_value (adjustment);
530
531 if (ctk_widget_get_realized (darea))
532 {
533 cdk_window_scroll (ctk_widget_get_window (darea),
534 0, *old_value - new_value);
535 *old_value = new_value;
536 }
537}
538
539static void
540pattern_realize (CtkWidget *widget,
541 gpointer data G_GNUC_UNUSED__attribute__ ((__unused__)))
542{
543 CdkWindow *window;
544
545 window = ctk_widget_get_window (widget);
546 pattern_set_bg (widget, window, 0);
547 create_pattern (widget, window, 1, PATTERN_SIZE(1 << 18), PATTERN_SIZE(1 << 18));
548}
549
550static void
551create_big_windows (CtkWidget *widget)
552{
553 static CtkWidget *window = NULL((void*)0);
554
555 if (!window)
556 {
557 CtkWidget *content_area;
558 CtkWidget *darea, *grid, *scrollbar;
559 CtkWidget *eventbox;
560 CtkAdjustment *hadjustment;
561 CtkAdjustment *vadjustment;
562 static gint current_x;
563 static gint current_y;
564
565 current_x = 0;
566 current_y = 0;
567
568 window = ctk_dialog_new_with_buttons ("Big Windows",
569 NULL((void*)0), 0,
570 "_Close",
571 CTK_RESPONSE_NONE,
572 NULL((void*)0));
573
574 ctk_window_set_screen (CTK_WINDOW (window)((((CtkWindow*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((window)), ((ctk_window_get_type ()))))))
,
575 ctk_widget_get_screen (widget));
576
577 ctk_window_set_default_size (CTK_WINDOW (window)((((CtkWindow*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((window)), ((ctk_window_get_type ()))))))
, 200, 300);
578
579 g_signal_connect (window, "destroy",g_signal_connect_data ((window), ("destroy"), (((GCallback) (
ctk_widget_destroyed))), (&window), ((void*)0), (GConnectFlags
) 0)
580 G_CALLBACK (ctk_widget_destroyed),g_signal_connect_data ((window), ("destroy"), (((GCallback) (
ctk_widget_destroyed))), (&window), ((void*)0), (GConnectFlags
) 0)
581 &window)g_signal_connect_data ((window), ("destroy"), (((GCallback) (
ctk_widget_destroyed))), (&window), ((void*)0), (GConnectFlags
) 0)
;
582
583 g_signal_connect (window, "response",g_signal_connect_data ((window), ("response"), (((GCallback) (
ctk_widget_destroy))), (((void*)0)), ((void*)0), (GConnectFlags
) 0)
584 G_CALLBACK (ctk_widget_destroy),g_signal_connect_data ((window), ("response"), (((GCallback) (
ctk_widget_destroy))), (((void*)0)), ((void*)0), (GConnectFlags
) 0)
585 NULL)g_signal_connect_data ((window), ("response"), (((GCallback) (
ctk_widget_destroy))), (((void*)0)), ((void*)0), (GConnectFlags
) 0)
;
586
587 content_area = ctk_dialog_get_content_area (CTK_DIALOG (window)((((CtkDialog*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((window)), ((ctk_dialog_get_type ()))))))
);
588
589 grid = ctk_grid_new ();
590 ctk_box_pack_start (CTK_BOX (content_area)((((CtkBox*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((content_area)), ((ctk_box_get_type ()))))))
, grid, TRUE(!(0)), TRUE(!(0)), 0);
591
592 darea = ctk_drawing_area_new ();
593
594 hadjustment = ctk_adjustment_new (0, 0, PATTERN_SIZE(1 << 18), 10, 100, 100);
595 g_signal_connect (hadjustment, "value_changed",g_signal_connect_data ((hadjustment), ("value_changed"), (((GCallback
) (pattern_hadj_changed))), (darea), ((void*)0), (GConnectFlags
) 0)
596 G_CALLBACK (pattern_hadj_changed), darea)g_signal_connect_data ((hadjustment), ("value_changed"), (((GCallback
) (pattern_hadj_changed))), (darea), ((void*)0), (GConnectFlags
) 0)
;
597 g_object_set_data (G_OBJECT (hadjustment)((((GObject*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((hadjustment)), (((GType) ((20) << (2))))))))
, "old-value", &current_x);
598
599 vadjustment = ctk_adjustment_new (0, 0, PATTERN_SIZE(1 << 18), 10, 100, 100);
600 g_signal_connect (vadjustment, "value_changed",g_signal_connect_data ((vadjustment), ("value_changed"), (((GCallback
) (pattern_vadj_changed))), (darea), ((void*)0), (GConnectFlags
) 0)
601 G_CALLBACK (pattern_vadj_changed), darea)g_signal_connect_data ((vadjustment), ("value_changed"), (((GCallback
) (pattern_vadj_changed))), (darea), ((void*)0), (GConnectFlags
) 0)
;
602 g_object_set_data (G_OBJECT (vadjustment)((((GObject*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((vadjustment)), (((GType) ((20) << (2))))))))
, "old-value", &current_y);
603
604 g_signal_connect (darea, "realize",g_signal_connect_data ((darea), ("realize"), (((GCallback) (pattern_realize
))), (((void*)0)), ((void*)0), (GConnectFlags) 0)
605 G_CALLBACK (pattern_realize),g_signal_connect_data ((darea), ("realize"), (((GCallback) (pattern_realize
))), (((void*)0)), ((void*)0), (GConnectFlags) 0)
606 NULL)g_signal_connect_data ((darea), ("realize"), (((GCallback) (pattern_realize
))), (((void*)0)), ((void*)0), (GConnectFlags) 0)
;
607
608 eventbox = ctk_event_box_new ();
609 ctk_widget_set_hexpand (eventbox, TRUE(!(0)));
610 ctk_widget_set_vexpand (eventbox, TRUE(!(0)));
611 ctk_grid_attach (CTK_GRID (grid)((((CtkGrid*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((grid)), ((ctk_grid_get_type ()))))))
, eventbox, 0, 0, 1, 1);
612
613 ctk_container_add (CTK_CONTAINER (eventbox)((((CtkContainer*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((eventbox)), ((ctk_container_get_type ()))))))
, darea);
614
615 scrollbar = ctk_scrollbar_new (CTK_ORIENTATION_HORIZONTAL, hadjustment);
616 ctk_widget_set_hexpand (scrollbar, TRUE(!(0)));
617 ctk_grid_attach (CTK_GRID (grid)((((CtkGrid*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((grid)), ((ctk_grid_get_type ()))))))
, scrollbar, 0, 1, 1, 1);
618
619 scrollbar = ctk_scrollbar_new (CTK_ORIENTATION_VERTICAL, vadjustment);
620 ctk_widget_set_vexpand (scrollbar, TRUE(!(0)));
621 ctk_grid_attach (CTK_GRID (grid)((((CtkGrid*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((grid)), ((ctk_grid_get_type ()))))))
, scrollbar, 1, 0, 1, 1);
622 }
623
624 if (!ctk_widget_get_visible (window))
625 ctk_widget_show_all (window);
626 else
627 ctk_widget_hide (window);
628}
629
630/*
631 * CtkButton
632 */
633
634static void
635button_window (CtkWidget *widget G_GNUC_UNUSED__attribute__ ((__unused__)),
636 CtkWidget *button)
637{
638 if (!ctk_widget_get_visible (button))
639 ctk_widget_show (button);
640 else
641 ctk_widget_hide (button);
642}
643
644static void
645create_buttons (CtkWidget *widget)
646{
647 static CtkWidget *window = NULL((void*)0);
648
649 if (!window)
650 {
651 CtkWidget *box1;
652 CtkWidget *box2;
653 CtkWidget *grid;
654 CtkWidget *separator;
655 CtkWidget *button[10];
656 int button_x[9] = { 0, 1, 2, 0, 2, 1, 1, 2, 0 };
657 int button_y[9] = { 0, 1, 2, 2, 0, 2, 0, 1, 1 };
658 guint i;
659
660 window = ctk_window_new (CTK_WINDOW_TOPLEVEL);
661 ctk_window_set_screen (CTK_WINDOW (window)((((CtkWindow*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((window)), ((ctk_window_get_type ()))))))
,
662 ctk_widget_get_screen (widget));
663
664 g_signal_connect (window, "destroy",g_signal_connect_data ((window), ("destroy"), (((GCallback) (
ctk_widget_destroyed))), (&window), ((void*)0), (GConnectFlags
) 0)
665 G_CALLBACK (ctk_widget_destroyed),g_signal_connect_data ((window), ("destroy"), (((GCallback) (
ctk_widget_destroyed))), (&window), ((void*)0), (GConnectFlags
) 0)
666 &window)g_signal_connect_data ((window), ("destroy"), (((GCallback) (
ctk_widget_destroyed))), (&window), ((void*)0), (GConnectFlags
) 0)
;
667
668 ctk_window_set_title (CTK_WINDOW (window)((((CtkWindow*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((window)), ((ctk_window_get_type ()))))))
, "CtkButton");
669 ctk_container_set_border_width (CTK_CONTAINER (window)((((CtkContainer*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((window)), ((ctk_container_get_type ()))))))
, 0);
670
671 box1 = ctk_box_new (CTK_ORIENTATION_VERTICAL, 0);
672 ctk_container_add (CTK_CONTAINER (window)((((CtkContainer*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((window)), ((ctk_container_get_type ()))))))
, box1);
673
674 grid = ctk_grid_new ();
675 ctk_grid_set_row_spacing (CTK_GRID (grid)((((CtkGrid*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((grid)), ((ctk_grid_get_type ()))))))
, 5);
676 ctk_grid_set_column_spacing (CTK_GRID (grid)((((CtkGrid*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((grid)), ((ctk_grid_get_type ()))))))
, 5);
677 ctk_container_set_border_width (CTK_CONTAINER (grid)((((CtkContainer*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((grid)), ((ctk_container_get_type ()))))))
, 10);
678 ctk_box_pack_start (CTK_BOX (box1)((((CtkBox*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((box1)), ((ctk_box_get_type ()))))))
, grid, TRUE(!(0)), TRUE(!(0)), 0);
679
680 button[0] = ctk_button_new_with_label ("button1");
681 button[1] = ctk_button_new_with_mnemonic ("_button2");
682 button[2] = ctk_button_new_with_mnemonic ("_button3");
683 button[3] = ctk_button_new_from_stock (CTK_STOCK_OK((CtkStock)"ctk-ok"));
684 button[4] = ctk_button_new_with_label ("button5");
685 button[5] = ctk_button_new_with_label ("button6");
686 button[6] = ctk_button_new_with_label ("button7");
687 button[7] = ctk_button_new_from_stock (CTK_STOCK_CLOSE((CtkStock)"ctk-close"));
688 button[8] = ctk_button_new_with_label ("button9");
689
690 for (i = 0; i < 9; i++)
691 {
692 g_signal_connect (button[i], "clicked",g_signal_connect_data ((button[i]), ("clicked"), (((GCallback
) (button_window))), (button[(i + 1) % 9]), ((void*)0), (GConnectFlags
) 0)
693 G_CALLBACK (button_window),g_signal_connect_data ((button[i]), ("clicked"), (((GCallback
) (button_window))), (button[(i + 1) % 9]), ((void*)0), (GConnectFlags
) 0)
694 button[(i + 1) % 9])g_signal_connect_data ((button[i]), ("clicked"), (((GCallback
) (button_window))), (button[(i + 1) % 9]), ((void*)0), (GConnectFlags
) 0)
;
695 ctk_widget_set_hexpand (button[i], TRUE(!(0)));
696 ctk_widget_set_vexpand (button[i], TRUE(!(0)));
697
698 ctk_grid_attach (CTK_GRID (grid)((((CtkGrid*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((grid)), ((ctk_grid_get_type ()))))))
, button[i],
699 button_x[i], button_y[i] + 1, 1, 1);
700 }
701
702 separator = ctk_separator_new (CTK_ORIENTATION_HORIZONTAL);
703 ctk_box_pack_start (CTK_BOX (box1)((((CtkBox*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((box1)), ((ctk_box_get_type ()))))))
, separator, FALSE(0), TRUE(!(0)), 0);
704
705 box2 = ctk_box_new (CTK_ORIENTATION_VERTICAL, 10);
706 ctk_container_set_border_width (CTK_CONTAINER (box2)((((CtkContainer*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((box2)), ((ctk_container_get_type ()))))))
, 10);
707 ctk_box_pack_start (CTK_BOX (box1)((((CtkBox*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((box1)), ((ctk_box_get_type ()))))))
, box2, FALSE(0), TRUE(!(0)), 0);
708
709 button[9] = ctk_button_new_with_label ("close");
710 g_signal_connect_swapped (button[9], "clicked",g_signal_connect_data ((button[9]), ("clicked"), (((GCallback
) (ctk_widget_destroy))), (window), ((void*)0), G_CONNECT_SWAPPED
)
711 G_CALLBACK (ctk_widget_destroy),g_signal_connect_data ((button[9]), ("clicked"), (((GCallback
) (ctk_widget_destroy))), (window), ((void*)0), G_CONNECT_SWAPPED
)
712 window)g_signal_connect_data ((button[9]), ("clicked"), (((GCallback
) (ctk_widget_destroy))), (window), ((void*)0), G_CONNECT_SWAPPED
)
;
713 ctk_box_pack_start (CTK_BOX (box2)((((CtkBox*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((box2)), ((ctk_box_get_type ()))))))
, button[9], TRUE(!(0)), TRUE(!(0)), 0);
714 ctk_widget_set_can_default (button[9], TRUE(!(0)));
715 ctk_widget_grab_default (button[9]);
716 }
717
718 if (!ctk_widget_get_visible (window))
719 ctk_widget_show_all (window);
720 else
721 ctk_widget_destroy (window);
722}
723
724/*
725 * CtkToggleButton
726 */
727
728static void
729create_toggle_buttons (CtkWidget *widget)
730{
731 static CtkWidget *window = NULL((void*)0);
732
733 if (!window)
734 {
735 CtkWidget *box1;
736 CtkWidget *box2;
737 CtkWidget *button;
738 CtkWidget *separator;
739
740 window = ctk_window_new (CTK_WINDOW_TOPLEVEL);
741 ctk_window_set_screen (CTK_WINDOW (window)((((CtkWindow*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((window)), ((ctk_window_get_type ()))))))
,
742 ctk_widget_get_screen (widget));
743
744 g_signal_connect (window, "destroy",g_signal_connect_data ((window), ("destroy"), (((GCallback) (
ctk_widget_destroyed))), (&window), ((void*)0), (GConnectFlags
) 0)
745 G_CALLBACK (ctk_widget_destroyed),g_signal_connect_data ((window), ("destroy"), (((GCallback) (
ctk_widget_destroyed))), (&window), ((void*)0), (GConnectFlags
) 0)
746 &window)g_signal_connect_data ((window), ("destroy"), (((GCallback) (
ctk_widget_destroyed))), (&window), ((void*)0), (GConnectFlags
) 0)
;
747
748 ctk_window_set_title (CTK_WINDOW (window)((((CtkWindow*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((window)), ((ctk_window_get_type ()))))))
, "CtkToggleButton");
749 ctk_container_set_border_width (CTK_CONTAINER (window)((((CtkContainer*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((window)), ((ctk_container_get_type ()))))))
, 0);
750
751 box1 = ctk_box_new (CTK_ORIENTATION_VERTICAL, 0);
752 ctk_container_add (CTK_CONTAINER (window)((((CtkContainer*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((window)), ((ctk_container_get_type ()))))))
, box1);
753
754 box2 = ctk_box_new (CTK_ORIENTATION_VERTICAL, 10);
755 ctk_container_set_border_width (CTK_CONTAINER (box2)((((CtkContainer*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((box2)), ((ctk_container_get_type ()))))))
, 10);
756 ctk_box_pack_start (CTK_BOX (box1)((((CtkBox*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((box1)), ((ctk_box_get_type ()))))))
, box2, TRUE(!(0)), TRUE(!(0)), 0);
757
758 button = ctk_toggle_button_new_with_label ("button1");
759 ctk_box_pack_start (CTK_BOX (box2)((((CtkBox*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((box2)), ((ctk_box_get_type ()))))))
, button, TRUE(!(0)), TRUE(!(0)), 0);
760
761 button = ctk_toggle_button_new_with_label ("button2");
762 ctk_box_pack_start (CTK_BOX (box2)((((CtkBox*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((box2)), ((ctk_box_get_type ()))))))
, button, TRUE(!(0)), TRUE(!(0)), 0);
763
764 button = ctk_toggle_button_new_with_label ("button3");
765 ctk_box_pack_start (CTK_BOX (box2)((((CtkBox*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((box2)), ((ctk_box_get_type ()))))))
, button, TRUE(!(0)), TRUE(!(0)), 0);
766
767 button = ctk_toggle_button_new_with_label ("inconsistent");
768 ctk_toggle_button_set_inconsistent (CTK_TOGGLE_BUTTON (button)((((CtkToggleButton*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((button)), ((ctk_toggle_button_get_type ()))))))
, TRUE(!(0)));
769 ctk_box_pack_start (CTK_BOX (box2)((((CtkBox*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((box2)), ((ctk_box_get_type ()))))))
, button, TRUE(!(0)), TRUE(!(0)), 0);
770
771 separator = ctk_separator_new (CTK_ORIENTATION_HORIZONTAL);
772 ctk_box_pack_start (CTK_BOX (box1)((((CtkBox*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((box1)), ((ctk_box_get_type ()))))))
, separator, FALSE(0), TRUE(!(0)), 0);
773
774 box2 = ctk_box_new (CTK_ORIENTATION_VERTICAL, 10);
775 ctk_container_set_border_width (CTK_CONTAINER (box2)((((CtkContainer*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((box2)), ((ctk_container_get_type ()))))))
, 10);
776 ctk_box_pack_start (CTK_BOX (box1)((((CtkBox*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((box1)), ((ctk_box_get_type ()))))))
, box2, FALSE(0), TRUE(!(0)), 0);
777
778 button = ctk_button_new_with_label ("close");
779 g_signal_connect_swapped (button, "clicked",g_signal_connect_data ((button), ("clicked"), (((GCallback) (
ctk_widget_destroy))), (window), ((void*)0), G_CONNECT_SWAPPED
)
780 G_CALLBACK (ctk_widget_destroy),g_signal_connect_data ((button), ("clicked"), (((GCallback) (
ctk_widget_destroy))), (window), ((void*)0), G_CONNECT_SWAPPED
)
781 window)g_signal_connect_data ((button), ("clicked"), (((GCallback) (
ctk_widget_destroy))), (window), ((void*)0), G_CONNECT_SWAPPED
)
;
782 ctk_box_pack_start (CTK_BOX (box2)((((CtkBox*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((box2)), ((ctk_box_get_type ()))))))
, button, TRUE(!(0)), TRUE(!(0)), 0);
783 ctk_widget_set_can_default (button, TRUE(!(0)));
784 ctk_widget_grab_default (button);
785 }
786
787 if (!ctk_widget_get_visible (window))
788 ctk_widget_show_all (window);
789 else
790 ctk_widget_destroy (window);
791}
792
793static CtkWidget *
794create_widget_grid (GType widget_type)
795{
796 CtkWidget *grid;
797 CtkWidget *group_widget = NULL((void*)0);
798 gint i, j;
799
800 grid = ctk_grid_new ();
801
802 for (i = 0; i < 5; i++)
803 {
804 for (j = 0; j < 5; j++)
805 {
806 CtkWidget *widget;
807 char *tmp;
808
809 if (i == 0 && j == 0)
810 {
811 widget = NULL((void*)0);
812 }
813 else if (i == 0)
814 {
815 tmp = g_strdup_printf ("%d", j);
816 widget = ctk_label_new (tmp);
817 g_free (tmp);
818 }
819 else if (j == 0)
820 {
821 tmp = g_strdup_printf ("%c", 'A' + i - 1);
822 widget = ctk_label_new (tmp);
823 g_free (tmp);
824 }
825 else
826 {
827 widget = g_object_new (widget_type, NULL((void*)0));
828
829 if (g_type_is_a (widget_type, CTK_TYPE_RADIO_BUTTON)((widget_type) == ((ctk_radio_button_get_type ())) || (g_type_is_a
) ((widget_type), ((ctk_radio_button_get_type ()))))
)
830 {
831 if (!group_widget)
832 group_widget = widget;
833 else
834 g_object_set (widget, "group", group_widget, NULL((void*)0));
835 }
836 }
837
838 if (widget)
839 ctk_grid_attach (CTK_GRID (grid)((((CtkGrid*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((grid)), ((ctk_grid_get_type ()))))))
, widget, i, j, 1, 1);
840 }
841 }
842
843 return grid;
844}
845
846/*
847 * CtkCheckButton
848 */
849
850static void
851create_check_buttons (CtkWidget *widget)
852{
853 static CtkWidget *window = NULL((void*)0);
854
855 if (!window)
856 {
857 CtkWidget *box1;
858 CtkWidget *box2;
859 CtkWidget *button;
860 CtkWidget *separator;
861 CtkWidget *table;
862
863 window = ctk_dialog_new_with_buttons ("Check Buttons",
864 NULL((void*)0), 0,
865 "_Close",
866 CTK_RESPONSE_NONE,
867 NULL((void*)0));
868
869 ctk_window_set_screen (CTK_WINDOW (window)((((CtkWindow*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((window)), ((ctk_window_get_type ()))))))
,
870 ctk_widget_get_screen (widget));
871
872 g_signal_connect (window, "destroy",g_signal_connect_data ((window), ("destroy"), (((GCallback) (
ctk_widget_destroyed))), (&window), ((void*)0), (GConnectFlags
) 0)
873 G_CALLBACK (ctk_widget_destroyed),g_signal_connect_data ((window), ("destroy"), (((GCallback) (
ctk_widget_destroyed))), (&window), ((void*)0), (GConnectFlags
) 0)
874 &window)g_signal_connect_data ((window), ("destroy"), (((GCallback) (
ctk_widget_destroyed))), (&window), ((void*)0), (GConnectFlags
) 0)
;
875 g_signal_connect (window, "response",g_signal_connect_data ((window), ("response"), (((GCallback) (
ctk_widget_destroy))), (((void*)0)), ((void*)0), (GConnectFlags
) 0)
876 G_CALLBACK (ctk_widget_destroy),g_signal_connect_data ((window), ("response"), (((GCallback) (
ctk_widget_destroy))), (((void*)0)), ((void*)0), (GConnectFlags
) 0)
877 NULL)g_signal_connect_data ((window), ("response"), (((GCallback) (
ctk_widget_destroy))), (((void*)0)), ((void*)0), (GConnectFlags
) 0)
;
878
879 box1 = ctk_dialog_get_content_area (CTK_DIALOG (window)((((CtkDialog*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((window)), ((ctk_dialog_get_type ()))))))
);
880
881 box2 = ctk_box_new (CTK_ORIENTATION_VERTICAL, 10);
882 ctk_container_set_border_width (CTK_CONTAINER (box2)((((CtkContainer*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((box2)), ((ctk_container_get_type ()))))))
, 10);
883 ctk_box_pack_start (CTK_BOX (box1)((((CtkBox*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((box1)), ((ctk_box_get_type ()))))))
, box2, TRUE(!(0)), TRUE(!(0)), 0);
884
885 button = ctk_check_button_new_with_mnemonic ("_button1");
886 ctk_box_pack_start (CTK_BOX (box2)((((CtkBox*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((box2)), ((ctk_box_get_type ()))))))
, button, TRUE(!(0)), TRUE(!(0)), 0);
887
888 button = ctk_check_button_new_with_label ("button2");
889 ctk_box_pack_start (CTK_BOX (box2)((((CtkBox*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((box2)), ((ctk_box_get_type ()))))))
, button, TRUE(!(0)), TRUE(!(0)), 0);
890
891 button = ctk_check_button_new_with_label ("button3");
892 ctk_box_pack_start (CTK_BOX (box2)((((CtkBox*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((box2)), ((ctk_box_get_type ()))))))
, button, TRUE(!(0)), TRUE(!(0)), 0);
893
894 button = ctk_check_button_new_with_label ("inconsistent");
895 ctk_toggle_button_set_inconsistent (CTK_TOGGLE_BUTTON (button)((((CtkToggleButton*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((button)), ((ctk_toggle_button_get_type ()))))))
, TRUE(!(0)));
896 ctk_box_pack_start (CTK_BOX (box2)((((CtkBox*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((box2)), ((ctk_box_get_type ()))))))
, button, TRUE(!(0)), TRUE(!(0)), 0);
897
898 separator = ctk_separator_new (CTK_ORIENTATION_HORIZONTAL);
899 ctk_box_pack_start (CTK_BOX (box1)((((CtkBox*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((box1)), ((ctk_box_get_type ()))))))
, separator, FALSE(0), TRUE(!(0)), 0);
900
901 table = create_widget_grid (CTK_TYPE_CHECK_BUTTON(ctk_check_button_get_type ()));
902 ctk_container_set_border_width (CTK_CONTAINER (table)((((CtkContainer*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((table)), ((ctk_container_get_type ()))))))
, 10);
903 ctk_box_pack_start (CTK_BOX (box1)((((CtkBox*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((box1)), ((ctk_box_get_type ()))))))
, table, TRUE(!(0)), TRUE(!(0)), 0);
904 }
905
906 if (!ctk_widget_get_visible (window))
907 ctk_widget_show_all (window);
908 else
909 ctk_widget_destroy (window);
910}
911
912/*
913 * CtkRadioButton
914 */
915
916static void
917create_radio_buttons (CtkWidget *widget)
918{
919 static CtkWidget *window = NULL((void*)0);
920
921 if (!window)
922 {
923 CtkWidget *box1;
924 CtkWidget *box2;
925 CtkWidget *button;
926 CtkWidget *separator;
927 CtkWidget *table;
928
929 window = ctk_dialog_new_with_buttons ("Radio Buttons",
930 NULL((void*)0), 0,
931 "_Close",
932 CTK_RESPONSE_NONE,
933 NULL((void*)0));
934
935 ctk_window_set_screen (CTK_WINDOW (window)((((CtkWindow*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((window)), ((ctk_window_get_type ()))))))
,
936 ctk_widget_get_screen (widget));
937
938 g_signal_connect (window, "destroy",g_signal_connect_data ((window), ("destroy"), (((GCallback) (
ctk_widget_destroyed))), (&window), ((void*)0), (GConnectFlags
) 0)
939 G_CALLBACK (ctk_widget_destroyed),g_signal_connect_data ((window), ("destroy"), (((GCallback) (
ctk_widget_destroyed))), (&window), ((void*)0), (GConnectFlags
) 0)
940 &window)g_signal_connect_data ((window), ("destroy"), (((GCallback) (
ctk_widget_destroyed))), (&window), ((void*)0), (GConnectFlags
) 0)
;
941 g_signal_connect (window, "response",g_signal_connect_data ((window), ("response"), (((GCallback) (
ctk_widget_destroy))), (((void*)0)), ((void*)0), (GConnectFlags
) 0)
942 G_CALLBACK (ctk_widget_destroy),g_signal_connect_data ((window), ("response"), (((GCallback) (
ctk_widget_destroy))), (((void*)0)), ((void*)0), (GConnectFlags
) 0)
943 NULL)g_signal_connect_data ((window), ("response"), (((GCallback) (
ctk_widget_destroy))), (((void*)0)), ((void*)0), (GConnectFlags
) 0)
;
944
945 box1 = ctk_dialog_get_content_area (CTK_DIALOG (window)((((CtkDialog*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((window)), ((ctk_dialog_get_type ()))))))
);
946
947 box2 = ctk_box_new (CTK_ORIENTATION_VERTICAL, 10);
948 ctk_container_set_border_width (CTK_CONTAINER (box2)((((CtkContainer*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((box2)), ((ctk_container_get_type ()))))))
, 10);
949 ctk_box_pack_start (CTK_BOX (box1)((((CtkBox*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((box1)), ((ctk_box_get_type ()))))))
, box2, TRUE(!(0)), TRUE(!(0)), 0);
950
951 button = ctk_radio_button_new_with_label (NULL((void*)0), "button1");
952 ctk_box_pack_start (CTK_BOX (box2)((((CtkBox*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((box2)), ((ctk_box_get_type ()))))))
, button, TRUE(!(0)), TRUE(!(0)), 0);
953
954 button = ctk_radio_button_new_with_label (
955 ctk_radio_button_get_group (CTK_RADIO_BUTTON (button)((((CtkRadioButton*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((button)), ((ctk_radio_button_get_type ()))))))
),
956 "button2");
957 ctk_toggle_button_set_active (CTK_TOGGLE_BUTTON (button)((((CtkToggleButton*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((button)), ((ctk_toggle_button_get_type ()))))))
, TRUE(!(0)));
958 ctk_box_pack_start (CTK_BOX (box2)((((CtkBox*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((box2)), ((ctk_box_get_type ()))))))
, button, TRUE(!(0)), TRUE(!(0)), 0);
959
960 button = ctk_radio_button_new_with_label (
961 ctk_radio_button_get_group (CTK_RADIO_BUTTON (button)((((CtkRadioButton*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((button)), ((ctk_radio_button_get_type ()))))))
),
962 "button3");
963 ctk_box_pack_start (CTK_BOX (box2)((((CtkBox*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((box2)), ((ctk_box_get_type ()))))))
, button, TRUE(!(0)), TRUE(!(0)), 0);
964
965 button = ctk_radio_button_new_with_label (
966 ctk_radio_button_get_group (CTK_RADIO_BUTTON (button)((((CtkRadioButton*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((button)), ((ctk_radio_button_get_type ()))))))
),
967 "inconsistent");
968 ctk_toggle_button_set_inconsistent (CTK_TOGGLE_BUTTON (button)((((CtkToggleButton*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((button)), ((ctk_toggle_button_get_type ()))))))
, TRUE(!(0)));
969 ctk_box_pack_start (CTK_BOX (box2)((((CtkBox*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((box2)), ((ctk_box_get_type ()))))))
, button, TRUE(!(0)), TRUE(!(0)), 0);
970
971 separator = ctk_separator_new (CTK_ORIENTATION_HORIZONTAL);
972 ctk_box_pack_start (CTK_BOX (box1)((((CtkBox*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((box1)), ((ctk_box_get_type ()))))))
, separator, FALSE(0), TRUE(!(0)), 0);
973
974 box2 = ctk_box_new (CTK_ORIENTATION_VERTICAL, 10);
975 ctk_container_set_border_width (CTK_CONTAINER (box2)((((CtkContainer*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((box2)), ((ctk_container_get_type ()))))))
, 10);
976 ctk_box_pack_start (CTK_BOX (box1)((((CtkBox*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((box1)), ((ctk_box_get_type ()))))))
, box2, TRUE(!(0)), TRUE(!(0)), 0);
977
978 button = ctk_radio_button_new_with_label (NULL((void*)0), "button4");
979 ctk_toggle_button_set_mode (CTK_TOGGLE_BUTTON (button)((((CtkToggleButton*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((button)), ((ctk_toggle_button_get_type ()))))))
, FALSE(0));
980 ctk_box_pack_start (CTK_BOX (box2)((((CtkBox*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((box2)), ((ctk_box_get_type ()))))))
, button, TRUE(!(0)), TRUE(!(0)), 0);
981
982 button = ctk_radio_button_new_with_label (
983 ctk_radio_button_get_group (CTK_RADIO_BUTTON (button)((((CtkRadioButton*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((button)), ((ctk_radio_button_get_type ()))))))
),
984 "button5");
985 ctk_toggle_button_set_active (CTK_TOGGLE_BUTTON (button)((((CtkToggleButton*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((button)), ((ctk_toggle_button_get_type ()))))))
, TRUE(!(0)));
986 ctk_toggle_button_set_mode (CTK_TOGGLE_BUTTON (button)((((CtkToggleButton*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((button)), ((ctk_toggle_button_get_type ()))))))
, FALSE(0));
987 ctk_box_pack_start (CTK_BOX (box2)((((CtkBox*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((box2)), ((ctk_box_get_type ()))))))
, button, TRUE(!(0)), TRUE(!(0)), 0);
988
989 button = ctk_radio_button_new_with_label (
990 ctk_radio_button_get_group (CTK_RADIO_BUTTON (button)((((CtkRadioButton*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((button)), ((ctk_radio_button_get_type ()))))))
),
991 "button6");
992 ctk_toggle_button_set_mode (CTK_TOGGLE_BUTTON (button)((((CtkToggleButton*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((button)), ((ctk_toggle_button_get_type ()))))))
, FALSE(0));
993 ctk_box_pack_start (CTK_BOX (box2)((((CtkBox*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((box2)), ((ctk_box_get_type ()))))))
, button, TRUE(!(0)), TRUE(!(0)), 0);
994
995 separator = ctk_separator_new (CTK_ORIENTATION_HORIZONTAL);
996 ctk_box_pack_start (CTK_BOX (box1)((((CtkBox*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((box1)), ((ctk_box_get_type ()))))))
, separator, FALSE(0), TRUE(!(0)), 0);
997
998 table = create_widget_grid (CTK_TYPE_RADIO_BUTTON(ctk_radio_button_get_type ()));
999 ctk_container_set_border_width (CTK_CONTAINER (table)((((CtkContainer*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((table)), ((ctk_container_get_type ()))))))
, 10);
1000 ctk_box_pack_start (CTK_BOX (box1)((((CtkBox*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((box1)), ((ctk_box_get_type ()))))))
, table, TRUE(!(0)), TRUE(!(0)), 0);
1001 }
1002
1003 if (!ctk_widget_get_visible (window))
1004 ctk_widget_show_all (window);
1005 else
1006 ctk_widget_destroy (window);
1007}
1008
1009/*
1010 * CtkButtonBox
1011 */
1012
1013static CtkWidget *
1014create_bbox (gint horizontal,
1015 char* title,
1016 gint spacing,
1017 gint child_w G_GNUC_UNUSED__attribute__ ((__unused__)),
1018 gint child_h G_GNUC_UNUSED__attribute__ ((__unused__)),
1019 gint layout)
1020{
1021 CtkWidget *frame;
1022 CtkWidget *bbox;
1023 CtkWidget *button;
1024
1025 frame = ctk_frame_new (title);
1026
1027 if (horizontal)
1028 bbox = ctk_button_box_new (CTK_ORIENTATION_HORIZONTAL);
1029 else
1030 bbox = ctk_button_box_new (CTK_ORIENTATION_VERTICAL);
1031
1032 ctk_container_set_border_width (CTK_CONTAINER (bbox)((((CtkContainer*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((bbox)), ((ctk_container_get_type ()))))))
, 5);
1033 ctk_container_add (CTK_CONTAINER (frame)((((CtkContainer*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((frame)), ((ctk_container_get_type ()))))))
, bbox);
1034
1035 ctk_button_box_set_layout (CTK_BUTTON_BOX (bbox)((((CtkButtonBox*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((bbox)), ((ctk_button_box_get_type ()))))))
, layout);
1036 ctk_box_set_spacing (CTK_BOX (bbox)((((CtkBox*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((bbox)), ((ctk_box_get_type ()))))))
, spacing);
1037
1038 button = ctk_button_new_with_label ("OK");
1039 ctk_container_add (CTK_CONTAINER (bbox)((((CtkContainer*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((bbox)), ((ctk_container_get_type ()))))))
, button);
1040
1041 button = ctk_button_new_with_label ("Cancel");
1042 ctk_container_add (CTK_CONTAINER (bbox)((((CtkContainer*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((bbox)), ((ctk_container_get_type ()))))))
, button);
1043
1044 button = ctk_button_new_with_label ("Help");
1045 ctk_container_add (CTK_CONTAINER (bbox)((((CtkContainer*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((bbox)), ((ctk_container_get_type ()))))))
, button);
1046
1047 return frame;
1048}
1049
1050static void
1051create_button_box (CtkWidget *widget)
1052{
1053 static CtkWidget* window = NULL((void*)0);
1054
1055 if (!window)
1056 {
1057 CtkWidget *main_vbox;
1058 CtkWidget *vbox;
1059 CtkWidget *hbox;
1060 CtkWidget *frame_horz;
1061 CtkWidget *frame_vert;
1062
1063 window = ctk_window_new (CTK_WINDOW_TOPLEVEL);
1064 ctk_window_set_screen (CTK_WINDOW (window)((((CtkWindow*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((window)), ((ctk_window_get_type ()))))))
, ctk_widget_get_screen (widget));
1065 ctk_window_set_title (CTK_WINDOW (window)((((CtkWindow*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((window)), ((ctk_window_get_type ()))))))
, "Button Boxes");
1066
1067 g_signal_connect (window, "destroy",g_signal_connect_data ((window), ("destroy"), (((GCallback) (
ctk_widget_destroyed))), (&window), ((void*)0), (GConnectFlags
) 0)
1068 G_CALLBACK (ctk_widget_destroyed),g_signal_connect_data ((window), ("destroy"), (((GCallback) (
ctk_widget_destroyed))), (&window), ((void*)0), (GConnectFlags
) 0)
1069 &window)g_signal_connect_data ((window), ("destroy"), (((GCallback) (
ctk_widget_destroyed))), (&window), ((void*)0), (GConnectFlags
) 0)
;
1070
1071 ctk_container_set_border_width (CTK_CONTAINER (window)((((CtkContainer*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((window)), ((ctk_container_get_type ()))))))
, 10);
1072
1073 main_vbox = ctk_box_new (CTK_ORIENTATION_VERTICAL, 0);
1074 ctk_container_add (CTK_CONTAINER (window)((((CtkContainer*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((window)), ((ctk_container_get_type ()))))))
, main_vbox);
1075
1076 frame_horz = ctk_frame_new ("Horizontal Button Boxes");
1077 ctk_box_pack_start (CTK_BOX (main_vbox)((((CtkBox*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((main_vbox)), ((ctk_box_get_type ()))))))
, frame_horz, TRUE(!(0)), TRUE(!(0)), 10);
1078
1079 vbox = ctk_box_new (CTK_ORIENTATION_VERTICAL, 0);
1080 ctk_container_set_border_width (CTK_CONTAINER (vbox)((((CtkContainer*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((vbox)), ((ctk_container_get_type ()))))))
, 10);
1081 ctk_container_add (CTK_CONTAINER (frame_horz)((((CtkContainer*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((frame_horz)), ((ctk_container_get_type ()))))))
, vbox);
1082
1083 ctk_box_pack_start (CTK_BOX (vbox)((((CtkBox*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((vbox)), ((ctk_box_get_type ()))))))
,
1084 create_bbox (TRUE(!(0)), "Spread", 40, 85, 20, CTK_BUTTONBOX_SPREAD),
1085 TRUE(!(0)), TRUE(!(0)), 0);
1086
1087 ctk_box_pack_start (CTK_BOX (vbox)((((CtkBox*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((vbox)), ((ctk_box_get_type ()))))))
,
1088 create_bbox (TRUE(!(0)), "Edge", 40, 85, 20, CTK_BUTTONBOX_EDGE),
1089 TRUE(!(0)), TRUE(!(0)), 5);
1090
1091 ctk_box_pack_start (CTK_BOX (vbox)((((CtkBox*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((vbox)), ((ctk_box_get_type ()))))))
,
1092 create_bbox (TRUE(!(0)), "Start", 40, 85, 20, CTK_BUTTONBOX_START),
1093 TRUE(!(0)), TRUE(!(0)), 5);
1094
1095 ctk_box_pack_start (CTK_BOX (vbox)((((CtkBox*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((vbox)), ((ctk_box_get_type ()))))))
,
1096 create_bbox (TRUE(!(0)), "End", 40, 85, 20, CTK_BUTTONBOX_END),
1097 TRUE(!(0)), TRUE(!(0)), 5);
1098
1099 ctk_box_pack_start (CTK_BOX (vbox)((((CtkBox*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((vbox)), ((ctk_box_get_type ()))))))
,
1100 create_bbox (TRUE(!(0)), "Center", 40, 85, 20, CTK_BUTTONBOX_CENTER),
1101 TRUE(!(0)), TRUE(!(0)), 5);
1102
1103 frame_vert = ctk_frame_new ("Vertical Button Boxes");
1104 ctk_box_pack_start (CTK_BOX (main_vbox)((((CtkBox*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((main_vbox)), ((ctk_box_get_type ()))))))
, frame_vert, TRUE(!(0)), TRUE(!(0)), 10);
1105
1106 hbox = ctk_box_new (CTK_ORIENTATION_HORIZONTAL, 0);
1107 ctk_container_set_border_width (CTK_CONTAINER (hbox)((((CtkContainer*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((hbox)), ((ctk_container_get_type ()))))))
, 10);
1108 ctk_container_add (CTK_CONTAINER (frame_vert)((((CtkContainer*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((frame_vert)), ((ctk_container_get_type ()))))))
, hbox);
1109
1110 ctk_box_pack_start (CTK_BOX (hbox)((((CtkBox*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((hbox)), ((ctk_box_get_type ()))))))
,
1111 create_bbox (FALSE(0), "Spread", 30, 85, 20, CTK_BUTTONBOX_SPREAD),
1112 TRUE(!(0)), TRUE(!(0)), 0);
1113
1114 ctk_box_pack_start (CTK_BOX (hbox)((((CtkBox*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((hbox)), ((ctk_box_get_type ()))))))
,
1115 create_bbox (FALSE(0), "Edge", 30, 85, 20, CTK_BUTTONBOX_EDGE),
1116 TRUE(!(0)), TRUE(!(0)), 5);
1117
1118 ctk_box_pack_start (CTK_BOX (hbox)((((CtkBox*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((hbox)), ((ctk_box_get_type ()))))))
,
1119 create_bbox (FALSE(0), "Start", 30, 85, 20, CTK_BUTTONBOX_START),
1120 TRUE(!(0)), TRUE(!(0)), 5);
1121
1122 ctk_box_pack_start (CTK_BOX (hbox)((((CtkBox*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((hbox)), ((ctk_box_get_type ()))))))
,
1123 create_bbox (FALSE(0), "End", 30, 85, 20, CTK_BUTTONBOX_END),
1124 TRUE(!(0)), TRUE(!(0)), 5);
1125
1126 ctk_box_pack_start (CTK_BOX (hbox)((((CtkBox*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((hbox)), ((ctk_box_get_type ()))))))
,
1127 create_bbox (FALSE(0), "Center", 30, 85, 20, CTK_BUTTONBOX_CENTER),
1128 TRUE(!(0)), TRUE(!(0)), 5);
1129 }
1130
1131 if (!ctk_widget_get_visible (window))
1132 ctk_widget_show_all (window);
1133 else
1134 ctk_widget_destroy (window);
1135}
1136
1137/*
1138 * CtkToolBar
1139 */
1140
1141static CtkWidget*
1142new_pixbuf (char *filename,
1143 CdkWindow *window G_GNUC_UNUSED__attribute__ ((__unused__)))
1144{
1145 CtkWidget *widget;
1146 GdkPixbuf *pixbuf;
1147
1148 if (strcmp (filename, "test.xpm") == 0)
1149 pixbuf = NULL((void*)0);
1150 else
1151 pixbuf = gdk_pixbuf_new_from_file (filename, NULL((void*)0));
1152
1153 if (pixbuf == NULL((void*)0))
1154 pixbuf = gdk_pixbuf_new_from_xpm_data ((const char **) openfile);
1155
1156 widget = ctk_image_new_from_pixbuf (pixbuf);
1157
1158 g_object_unref (pixbuf);
1159
1160 return widget;
1161}
1162
1163
1164static void
1165set_toolbar_small_stock (CtkWidget *widget G_GNUC_UNUSED__attribute__ ((__unused__)),
1166 gpointer data)
1167{
1168 ctk_toolbar_set_icon_size (CTK_TOOLBAR (data)((((CtkToolbar*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((data)), ((ctk_toolbar_get_type ()))))))
, CTK_ICON_SIZE_SMALL_TOOLBAR);
1169}
1170
1171static void
1172set_toolbar_large_stock (CtkWidget *widget G_GNUC_UNUSED__attribute__ ((__unused__)),
1173 gpointer data)
1174{
1175 ctk_toolbar_set_icon_size (CTK_TOOLBAR (data)((((CtkToolbar*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((data)), ((ctk_toolbar_get_type ()))))))
, CTK_ICON_SIZE_LARGE_TOOLBAR);
1176}
1177
1178static void
1179set_toolbar_horizontal (CtkWidget *widget G_GNUC_UNUSED__attribute__ ((__unused__)),
1180 gpointer data)
1181{
1182 ctk_orientable_set_orientation (CTK_ORIENTABLE (data)((((CtkOrientable*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((data)), ((ctk_orientable_get_type ()))))))
, CTK_ORIENTATION_HORIZONTAL);
1183}
1184
1185static void
1186set_toolbar_vertical (CtkWidget *widget G_GNUC_UNUSED__attribute__ ((__unused__)),
1187 gpointer data)
1188{
1189 ctk_orientable_set_orientation (CTK_ORIENTABLE (data)((((CtkOrientable*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((data)), ((ctk_orientable_get_type ()))))))
, CTK_ORIENTATION_VERTICAL);
1190}
1191
1192static void
1193set_toolbar_icons (CtkWidget *widget G_GNUC_UNUSED__attribute__ ((__unused__)),
1194 gpointer data)
1195{
1196 ctk_toolbar_set_style (CTK_TOOLBAR (data)((((CtkToolbar*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((data)), ((ctk_toolbar_get_type ()))))))
, CTK_TOOLBAR_ICONS);
1197}
1198
1199static void
1200set_toolbar_text (CtkWidget *widget G_GNUC_UNUSED__attribute__ ((__unused__)),
1201 gpointer data)
1202{
1203 ctk_toolbar_set_style (CTK_TOOLBAR (data)((((CtkToolbar*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((data)), ((ctk_toolbar_get_type ()))))))
, CTK_TOOLBAR_TEXT);
1204}
1205
1206static void
1207set_toolbar_both (CtkWidget *widget G_GNUC_UNUSED__attribute__ ((__unused__)),
1208 gpointer data)
1209{
1210 ctk_toolbar_set_style (CTK_TOOLBAR (data)((((CtkToolbar*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((data)), ((ctk_toolbar_get_type ()))))))
, CTK_TOOLBAR_BOTH);
1211}
1212
1213static void
1214set_toolbar_both_horiz (CtkWidget *widget G_GNUC_UNUSED__attribute__ ((__unused__)),
1215 gpointer data)
1216{
1217 ctk_toolbar_set_style (CTK_TOOLBAR (data)((((CtkToolbar*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((data)), ((ctk_toolbar_get_type ()))))))
, CTK_TOOLBAR_BOTH_HORIZ);
1218}
1219
1220static CtkActionEntry create_toolbar_items[] = {
1221 { .stock_id = CTK_STOCK_NEW((CtkStock)"ctk-new"), .tooltip = "Stock icon: New", .callback = G_CALLBACK (set_toolbar_small_stock)((GCallback) (set_toolbar_small_stock)) },
1222 { .stock_id = CTK_STOCK_OPEN((CtkStock)"ctk-open"), .tooltip = "Stock icon: Open", .callback = G_CALLBACK (set_toolbar_large_stock)((GCallback) (set_toolbar_large_stock)) },
1223 { .label = "Horizontal", .tooltip = "Horizontal toolbar layout", .callback = G_CALLBACK (set_toolbar_horizontal)((GCallback) (set_toolbar_horizontal)) },
1224 { .label = "Vertical", .tooltip = "Vertical toolbar layout", .callback = G_CALLBACK (set_toolbar_vertical)((GCallback) (set_toolbar_vertical)) },
1225 { NULL((void*)0) },
1226 { .label = "Icons", .tooltip = "Only show toolbar icons", .callback = G_CALLBACK (set_toolbar_icons)((GCallback) (set_toolbar_icons)) },
1227 { .label = "Text", .tooltip = "Only show toolbar text", .callback = G_CALLBACK (set_toolbar_text)((GCallback) (set_toolbar_text)) },
1228 { .label = "Both", .tooltip = "Show toolbar icons and text", .callback = G_CALLBACK (set_toolbar_both)((GCallback) (set_toolbar_both)) },
1229 { .label = "Both (horizontal)", .tooltip = "Show toolbar icons and text in a horizontal fashion", .callback = G_CALLBACK (set_toolbar_both_horiz)((GCallback) (set_toolbar_both_horiz)) },
1230 { NULL((void*)0) },
1231 { .label = "entry", .tooltip = "This is an unusable CtkEntry ;)" },
1232 { NULL((void*)0) },
1233 { NULL((void*)0) },
1234 { .label = "Frobate", .tooltip = "Frobate tooltip" },
1235 { .label = "Baz", .tooltip = "Baz tooltip" },
1236 { NULL((void*)0) },
1237 { .label = "Blah", .tooltip = "Blash tooltip" },
1238 { .label = "Bar", .tooltip = "Bar tooltip" },
1239};
1240
1241static void
1242create_toolbar (CtkWidget *widget)
1243{
1244 static CtkWidget *window = NULL((void*)0);
1245
1246 if (!window)
1247 {
1248 CtkWidget *toolbar;
1249 guint i;
1250
1251 window = ctk_window_new (CTK_WINDOW_TOPLEVEL);
1252 ctk_window_set_screen (CTK_WINDOW (window)((((CtkWindow*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((window)), ((ctk_window_get_type ()))))))
,
1253 ctk_widget_get_screen (widget));
1254
1255 ctk_window_set_title (CTK_WINDOW (window)((((CtkWindow*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((window)), ((ctk_window_get_type ()))))))
, "Toolbar test");
1256
1257 g_signal_connect (window, "destroy",g_signal_connect_data ((window), ("destroy"), (((GCallback) (
ctk_widget_destroyed))), (&window), ((void*)0), (GConnectFlags
) 0)
1258 G_CALLBACK (ctk_widget_destroyed),g_signal_connect_data ((window), ("destroy"), (((GCallback) (
ctk_widget_destroyed))), (&window), ((void*)0), (GConnectFlags
) 0)
1259 &window)g_signal_connect_data ((window), ("destroy"), (((GCallback) (
ctk_widget_destroyed))), (&window), ((void*)0), (GConnectFlags
) 0)
;
1260
1261 ctk_container_set_border_width (CTK_CONTAINER (window)((((CtkContainer*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((window)), ((ctk_container_get_type ()))))))
, 0);
1262 ctk_widget_realize (window);
1263
1264 toolbar = ctk_toolbar_new ();
1265 for (i = 0; i < G_N_ELEMENTS (create_toolbar_items)(sizeof (create_toolbar_items) / sizeof ((create_toolbar_items
)[0]))
; i++)
1266 {
1267 CtkToolItem *toolitem;
1268
1269 if (create_toolbar_items[i].tooltip == NULL((void*)0))
1270 toolitem = ctk_separator_tool_item_new ();
1271 else if (g_strcmp0 (create_toolbar_items[i].name, "entry") == 0)
1272 {
1273 CtkWidget *entry;
1274
1275 toolitem = ctk_tool_item_new ();
1276 entry = ctk_entry_new ();
1277 ctk_container_add (CTK_CONTAINER (toolitem)((((CtkContainer*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((toolitem)), ((ctk_container_get_type ()))))))
, entry);
1278 }
1279 else if (create_toolbar_items[i].stock_id)
1280 {
1281 toolitem = ctk_tool_button_new_from_stock (create_toolbar_items[i].stock_id);
1282 }
1283 else
1284 {
1285 CtkWidget *icon;
1286
1287 icon = new_pixbuf ("test.xpm", ctk_widget_get_window (window));
1288 toolitem = ctk_tool_button_new (icon, create_toolbar_items[i].label);
1289 }
1290 if (create_toolbar_items[i].callback)
1291 g_signal_connect (toolitem, "clicked",g_signal_connect_data ((toolitem), ("clicked"), (create_toolbar_items
[i].callback), (toolbar), ((void*)0), (GConnectFlags) 0)
1292 create_toolbar_items[i].callback, toolbar)g_signal_connect_data ((toolitem), ("clicked"), (create_toolbar_items
[i].callback), (toolbar), ((void*)0), (GConnectFlags) 0)
;
1293 ctk_tool_item_set_tooltip_text (toolitem, create_toolbar_items[i].tooltip);
1294 ctk_toolbar_insert (CTK_TOOLBAR (toolbar)((((CtkToolbar*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((toolbar)), ((ctk_toolbar_get_type ()))))))
, toolitem, -1);
1295 }
1296
1297 ctk_container_add (CTK_CONTAINER (window)((((CtkContainer*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((window)), ((ctk_container_get_type ()))))))
, toolbar);
1298
1299 ctk_widget_set_size_request (toolbar, 200, -1);
1300 }
1301
1302 if (!ctk_widget_get_visible (window))
1303 ctk_widget_show_all (window);
1304 else
1305 ctk_widget_destroy (window);
1306}
1307
1308/*
1309 * CtkStatusBar
1310 */
1311
1312static guint statusbar_counter = 1;
1313
1314static void
1315statusbar_push (CtkWidget *button G_GNUC_UNUSED__attribute__ ((__unused__)),
1316 CtkStatusbar *statusbar)
1317{
1318 gchar text[1024];
1319
1320 sprintf (text, "something %d", statusbar_counter++);
1321
1322 ctk_statusbar_push (statusbar, 1, text);
1323}
1324
1325static void
1326statusbar_push_long (CtkWidget *button G_GNUC_UNUSED__attribute__ ((__unused__)),
1327 CtkStatusbar *statusbar)
1328{
1329 gchar text[1024];
1330
1331 sprintf (text, "Just because a system has menu choices written with English words, phrases or sentences, that is no guarantee, that it is comprehensible. Individual words may not be familiar to some users (for example, \"repaginate\"), and two menu items may appear to satisfy the users's needs, whereas only one does (for example, \"put away\" or \"eject\").");
1332
1333 ctk_statusbar_push (statusbar, 1, text);
1334}
1335
1336static void
1337statusbar_pop (CtkWidget *button G_GNUC_UNUSED__attribute__ ((__unused__)),
1338 CtkStatusbar *statusbar)
1339{
1340 ctk_statusbar_pop (statusbar, 1);
1341}
1342
1343static void
1344statusbar_steal (CtkWidget *button G_GNUC_UNUSED__attribute__ ((__unused__)),
1345 CtkStatusbar *statusbar)
1346{
1347 ctk_statusbar_remove (statusbar, 1, 4);
1348}
1349
1350static void
1351statusbar_popped (CtkStatusbar *statusbar G_GNUC_UNUSED__attribute__ ((__unused__)),
1352 guint context_id G_GNUC_UNUSED__attribute__ ((__unused__)),
1353 const gchar *text)
1354{
1355 if (!text)
1356 statusbar_counter = 1;
1357}
1358
1359static void
1360statusbar_contexts (CtkStatusbar *statusbar)
1361{
1362 gchar *string;
1363
1364 string = "any context";
1365 g_print ("CtkStatusBar: context=\"%s\", context_id=%d\n",
1366 string,
1367 ctk_statusbar_get_context_id (statusbar, string));
1368
1369 string = "idle messages";
1370 g_print ("CtkStatusBar: context=\"%s\", context_id=%d\n",
1371 string,
1372 ctk_statusbar_get_context_id (statusbar, string));
1373
1374 string = "some text";
1375 g_print ("CtkStatusBar: context=\"%s\", context_id=%d\n",
1376 string,
1377 ctk_statusbar_get_context_id (statusbar, string));
1378
1379 string = "hit the mouse";
1380 g_print ("CtkStatusBar: context=\"%s\", context_id=%d\n",
1381 string,
1382 ctk_statusbar_get_context_id (statusbar, string));
1383
1384 string = "hit the mouse2";
1385 g_print ("CtkStatusBar: context=\"%s\", context_id=%d\n",
1386 string,
1387 ctk_statusbar_get_context_id (statusbar, string));
1388}
1389
1390static void
1391create_statusbar (CtkWidget *widget)
1392{
1393 static CtkWidget *window = NULL((void*)0);
1394
1395 if (!window)
1396 {
1397 CtkWidget *box1;
1398 CtkWidget *box2;
1399 CtkWidget *button;
1400 CtkWidget *separator;
1401 CtkWidget *statusbar;
1402
1403 window = ctk_window_new (CTK_WINDOW_TOPLEVEL);
1404 ctk_window_set_screen (CTK_WINDOW (window)((((CtkWindow*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((window)), ((ctk_window_get_type ()))))))
,
1405 ctk_widget_get_screen (widget));
1406
1407 g_signal_connect (window, "destroy",g_signal_connect_data ((window), ("destroy"), (((GCallback) (
ctk_widget_destroyed))), (&window), ((void*)0), (GConnectFlags
) 0)
1408 G_CALLBACK (ctk_widget_destroyed),g_signal_connect_data ((window), ("destroy"), (((GCallback) (
ctk_widget_destroyed))), (&window), ((void*)0), (GConnectFlags
) 0)
1409 &window)g_signal_connect_data ((window), ("destroy"), (((GCallback) (
ctk_widget_destroyed))), (&window), ((void*)0), (GConnectFlags
) 0)
;
1410
1411 ctk_window_set_title (CTK_WINDOW (window)((((CtkWindow*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((window)), ((ctk_window_get_type ()))))))
, "statusbar");
1412 ctk_container_set_border_width (CTK_CONTAINER (window)((((CtkContainer*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((window)), ((ctk_container_get_type ()))))))
, 0);
1413
1414 box1 = ctk_box_new (CTK_ORIENTATION_VERTICAL, 0);
1415 ctk_container_add (CTK_CONTAINER (window)((((CtkContainer*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((window)), ((ctk_container_get_type ()))))))
, box1);
1416
1417 box2 = ctk_box_new (CTK_ORIENTATION_VERTICAL, 10);
1418 ctk_container_set_border_width (CTK_CONTAINER (box2)((((CtkContainer*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((box2)), ((ctk_container_get_type ()))))))
, 10);
1419 ctk_box_pack_start (CTK_BOX (box1)((((CtkBox*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((box1)), ((ctk_box_get_type ()))))))
, box2, TRUE(!(0)), TRUE(!(0)), 0);
1420
1421 statusbar = ctk_statusbar_new ();
1422 ctk_box_pack_end (CTK_BOX (box1)((((CtkBox*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((box1)), ((ctk_box_get_type ()))))))
, statusbar, TRUE(!(0)), TRUE(!(0)), 0);
1423 g_signal_connect (statusbar,g_signal_connect_data ((statusbar), ("text_popped"), (((GCallback
) (statusbar_popped))), (((void*)0)), ((void*)0), (GConnectFlags
) 0)
1424 "text_popped",g_signal_connect_data ((statusbar), ("text_popped"), (((GCallback
) (statusbar_popped))), (((void*)0)), ((void*)0), (GConnectFlags
) 0)
1425 G_CALLBACK (statusbar_popped),g_signal_connect_data ((statusbar), ("text_popped"), (((GCallback
) (statusbar_popped))), (((void*)0)), ((void*)0), (GConnectFlags
) 0)
1426 NULL)g_signal_connect_data ((statusbar), ("text_popped"), (((GCallback
) (statusbar_popped))), (((void*)0)), ((void*)0), (GConnectFlags
) 0)
;
1427
1428 button = g_object_new (ctk_button_get_type (),
1429 "label", "push something",
1430 "visible", TRUE(!(0)),
1431 "parent", box2,
1432 NULL((void*)0));
1433 g_object_connect (button,
1434 "signal::clicked", statusbar_push, statusbar,
1435 NULL((void*)0));
1436
1437 button = g_object_connect (g_object_new (ctk_button_get_type (),
Value stored to 'button' is never read
1438 "label", "pop",
1439 "visible", TRUE(!(0)),
1440 "parent", box2,
1441 NULL((void*)0)),
1442 "signal_after::clicked", statusbar_pop, statusbar,
1443 NULL((void*)0));
1444
1445 button = g_object_connect (g_object_new (ctk_button_get_type (),
1446 "label", "steal #4",
1447 "visible", TRUE(!(0)),
1448 "parent", box2,
1449 NULL((void*)0)),
1450 "signal_after::clicked", statusbar_steal, statusbar,
1451 NULL((void*)0));
1452
1453 button = g_object_connect (g_object_new (ctk_button_get_type (),
1454 "label", "test contexts",
1455 "visible", TRUE(!(0)),
1456 "parent", box2,
1457 NULL((void*)0)),
1458 "swapped_signal_after::clicked", statusbar_contexts, statusbar,
1459 NULL((void*)0));
1460
1461 button = g_object_connect (g_object_new (ctk_button_get_type (),
1462 "label", "push something long",
1463 "visible", TRUE(!(0)),
1464 "parent", box2,
1465 NULL((void*)0)),
1466 "signal_after::clicked", statusbar_push_long, statusbar,
1467 NULL((void*)0));
1468
1469 separator = ctk_separator_new (CTK_ORIENTATION_HORIZONTAL);
1470 ctk_box_pack_start (CTK_BOX (box1)((((CtkBox*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((box1)), ((ctk_box_get_type ()))))))
, separator, FALSE(0), TRUE(!(0)), 0);
1471
1472 box2 = ctk_box_new (CTK_ORIENTATION_VERTICAL, 10);
1473 ctk_container_set_border_width (CTK_CONTAINER (box2)((((CtkContainer*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((box2)), ((ctk_container_get_type ()))))))
, 10);
1474 ctk_box_pack_start (CTK_BOX (box1)((((CtkBox*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((box1)), ((ctk_box_get_type ()))))))
, box2, FALSE(0), TRUE(!(0)), 0);
1475
1476 button = ctk_button_new_with_label ("close");
1477 g_signal_connect_swapped (button, "clicked",g_signal_connect_data ((button), ("clicked"), (((GCallback) (
ctk_widget_destroy))), (window), ((void*)0), G_CONNECT_SWAPPED
)
1478 G_CALLBACK (ctk_widget_destroy),g_signal_connect_data ((button), ("clicked"), (((GCallback) (
ctk_widget_destroy))), (window), ((void*)0), G_CONNECT_SWAPPED
)
1479 window)g_signal_connect_data ((button), ("clicked"), (((GCallback) (
ctk_widget_destroy))), (window), ((void*)0), G_CONNECT_SWAPPED
)
;
1480 ctk_box_pack_start (CTK_BOX (box2)((((CtkBox*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((box2)), ((ctk_box_get_type ()))))))
, button, TRUE(!(0)), TRUE(!(0)), 0);
1481 ctk_widget_set_can_default (button, TRUE(!(0)));
1482 ctk_widget_grab_default (button);
1483 }
1484
1485 if (!ctk_widget_get_visible (window))
1486 ctk_widget_show_all (window);
1487 else
1488 ctk_widget_destroy (window);
1489}
1490
1491/* Alpha demo */
1492
1493static void
1494alpha_changed (CtkRange *range, CtkWidget *widget)
1495{
1496 gdouble alpha;
1497
1498 alpha = ctk_range_get_value (range);
1499
1500 ctk_widget_set_opacity (widget, alpha / 100.0);
1501}
1502
1503
1504void
1505create_alpha_widgets (CtkWidget *widget)
1506{
1507 static CtkWidget *window = NULL((void*)0);
1508
1509 if (!window)
1510 {
1511 CtkWidget *vbox2, *vbox, *main_hbox;
1512 CtkWidget *button, *event_box, *label, *scale;
1513 CtkWidget *alpha1, *alpha2, *alpha3;
1514
1515 window = ctk_window_new (CTK_WINDOW_TOPLEVEL);
1516 ctk_window_set_screen (CTK_WINDOW (window)((((CtkWindow*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((window)), ((ctk_window_get_type ()))))))
,
1517 ctk_widget_get_screen (widget));
1518 ctk_window_set_default_size (CTK_WINDOW (window)((((CtkWindow*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((window)), ((ctk_window_get_type ()))))))
,
1519 450, 450);
1520
1521 g_signal_connect (window, "destroy",g_signal_connect_data ((window), ("destroy"), (((GCallback) (
ctk_widget_destroyed))), (&window), ((void*)0), (GConnectFlags
) 0)
1522 G_CALLBACK (ctk_widget_destroyed), &window)g_signal_connect_data ((window), ("destroy"), (((GCallback) (
ctk_widget_destroyed))), (&window), ((void*)0), (GConnectFlags
) 0)
;
1523
1524 ctk_window_set_title (CTK_WINDOW (window)((((CtkWindow*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((window)), ((ctk_window_get_type ()))))))
, "Alpha");
1525 ctk_container_set_border_width (CTK_CONTAINER (window)((((CtkContainer*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((window)), ((ctk_container_get_type ()))))))
, 0);
1526
1527 main_hbox = ctk_box_new (CTK_ORIENTATION_HORIZONTAL, 0);
1528 ctk_container_add (CTK_CONTAINER (window)((((CtkContainer*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((window)), ((ctk_container_get_type ()))))))
, main_hbox);
1529
1530 vbox = ctk_box_new (CTK_ORIENTATION_VERTICAL, 0);
1531
1532 ctk_box_pack_start (CTK_BOX (main_hbox)((((CtkBox*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((main_hbox)), ((ctk_box_get_type ()))))))
, vbox, FALSE(0), FALSE(0), 0);
1533
1534 /* Plain button (no cdkwindows */
1535
1536 label = ctk_label_new ("non-window widget");
1537 ctk_box_pack_start (CTK_BOX (vbox)((((CtkBox*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((vbox)), ((ctk_box_get_type ()))))))
, label, FALSE(0), FALSE(0), 0);
1538
1539 alpha1 = button = ctk_button_new_with_label ("A Button");
1540 ctk_box_pack_start (CTK_BOX (vbox)((((CtkBox*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((vbox)), ((ctk_box_get_type ()))))))
, button, FALSE(0), FALSE(0), 0);
1541
1542 /* windowed container with both windowed and normal button */
1543 label = ctk_label_new ("\nwindow widget");
1544 ctk_box_pack_start (CTK_BOX (vbox)((((CtkBox*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((vbox)), ((ctk_box_get_type ()))))))
, label, FALSE(0), FALSE(0), 0);
1545
1546 alpha2 = event_box = ctk_event_box_new ();
1547 ctk_box_pack_start (CTK_BOX (vbox)((((CtkBox*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((vbox)), ((ctk_box_get_type ()))))))
, event_box, FALSE(0), FALSE(0), 0);
1548
1549 vbox2 = ctk_box_new (CTK_ORIENTATION_VERTICAL, 0);
1550 ctk_container_add (CTK_CONTAINER (event_box)((((CtkContainer*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((event_box)), ((ctk_container_get_type ()))))))
, vbox2);
1551
1552 button = ctk_button_new_with_label ("A Button");
1553 ctk_box_pack_start (CTK_BOX (vbox2)((((CtkBox*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((vbox2)), ((ctk_box_get_type ()))))))
, button, FALSE(0), FALSE(0), 0);
1554
1555 event_box = ctk_event_box_new ();
1556 button = ctk_button_new_with_label ("A Button (in window)");
1557 ctk_container_add (CTK_CONTAINER (event_box)((((CtkContainer*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((event_box)), ((ctk_container_get_type ()))))))
, button);
1558 ctk_box_pack_start (CTK_BOX (vbox2)((((CtkBox*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((vbox2)), ((ctk_box_get_type ()))))))
, event_box, FALSE(0), FALSE(0), 0);
1559
1560 /* non-windowed container with both windowed and normal button */
1561 label = ctk_label_new ("\nnon-window widget with widget child");
1562 ctk_box_pack_start (CTK_BOX (vbox)((((CtkBox*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((vbox)), ((ctk_box_get_type ()))))))
, label, FALSE(0), FALSE(0), 0);
1563
1564 alpha3 = vbox2 = ctk_box_new (CTK_ORIENTATION_VERTICAL, 0);
1565 ctk_box_pack_start (CTK_BOX (vbox)((((CtkBox*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((vbox)), ((ctk_box_get_type ()))))))
, vbox2, FALSE(0), FALSE(0), 0);
1566
1567 button = ctk_button_new_with_label ("A Button");
1568 ctk_box_pack_start (CTK_BOX (vbox2)((((CtkBox*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((vbox2)), ((ctk_box_get_type ()))))))
, button, FALSE(0), FALSE(0), 0);
1569
1570 event_box = ctk_event_box_new ();
1571 button = ctk_button_new_with_label ("A Button (in window)");
1572 ctk_container_add (CTK_CONTAINER (event_box)((((CtkContainer*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((event_box)), ((ctk_container_get_type ()))))))
, button);
1573 ctk_box_pack_start (CTK_BOX (vbox2)((((CtkBox*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((vbox2)), ((ctk_box_get_type ()))))))
, event_box, FALSE(0), FALSE(0), 0);
1574
1575 scale = ctk_scale_new_with_range (CTK_ORIENTATION_VERTICAL,
1576 0, 100, 1);
1577 ctk_box_pack_start (CTK_BOX (main_hbox)((((CtkBox*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((main_hbox)), ((ctk_box_get_type ()))))))
, scale, FALSE(0), FALSE(0), 0);
1578 g_signal_connect (scale, "value_changed", G_CALLBACK (alpha_changed), alpha1)g_signal_connect_data ((scale), ("value_changed"), (((GCallback
) (alpha_changed))), (alpha1), ((void*)0), (GConnectFlags) 0)
;
1579 ctk_range_set_value (CTK_RANGE (scale)((((CtkRange*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((scale)), ((ctk_range_get_type ()))))))
, 50);
1580
1581 scale = ctk_scale_new_with_range (CTK_ORIENTATION_VERTICAL,
1582 0, 100, 1);
1583 ctk_box_pack_start (CTK_BOX (main_hbox)((((CtkBox*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((main_hbox)), ((ctk_box_get_type ()))))))
, scale, FALSE(0), FALSE(0), 0);
1584 g_signal_connect (scale, "value_changed", G_CALLBACK (alpha_changed), alpha2)g_signal_connect_data ((scale), ("value_changed"), (((GCallback
) (alpha_changed))), (alpha2), ((void*)0), (GConnectFlags) 0)
;
1585 ctk_range_set_value (CTK_RANGE (scale)((((CtkRange*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((scale)), ((ctk_range_get_type ()))))))
, 50);
1586
1587 scale = ctk_scale_new_with_range (CTK_ORIENTATION_VERTICAL,
1588 0, 100, 1);
1589 ctk_box_pack_start (CTK_BOX (main_hbox)((((CtkBox*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((main_hbox)), ((ctk_box_get_type ()))))))
, scale, FALSE(0), FALSE(0), 0);
1590 g_signal_connect (scale, "value_changed", G_CALLBACK (alpha_changed), alpha3)g_signal_connect_data ((scale), ("value_changed"), (((GCallback
) (alpha_changed))), (alpha3), ((void*)0), (GConnectFlags) 0)
;
1591 ctk_range_set_value (CTK_RANGE (scale)((((CtkRange*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((scale)), ((ctk_range_get_type ()))))))
, 50);
1592
1593 ctk_widget_show_all (main_hbox);
1594 }
1595
1596 if (!ctk_widget_get_visible (window))
1597 ctk_widget_show (window);
1598 else
1599 ctk_widget_destroy (window);
1600}
1601
1602
1603/*
1604 * Label Demo
1605 */
1606static void
1607sensitivity_toggled (CtkWidget *toggle,
1608 CtkWidget *widget)
1609{
1610 ctk_widget_set_sensitive (widget,
1611 ctk_toggle_button_get_active (CTK_TOGGLE_BUTTON (toggle)((((CtkToggleButton*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((toggle)), ((ctk_toggle_button_get_type ()))))))
));
1612}
1613
1614static CtkWidget*
1615create_sensitivity_control (CtkWidget *widget)
1616{
1617 CtkWidget *button;
1618
1619 button = ctk_toggle_button_new_with_label ("Sensitive");
1620
1621 ctk_toggle_button_set_active (CTK_TOGGLE_BUTTON (button)((((CtkToggleButton*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((button)), ((ctk_toggle_button_get_type ()))))))
,
1622 ctk_widget_is_sensitive (widget));
1623
1624 g_signal_connect (button,g_signal_connect_data ((button), ("toggled"), (((GCallback) (
sensitivity_toggled))), (widget), ((void*)0), (GConnectFlags)
0)
1625 "toggled",g_signal_connect_data ((button), ("toggled"), (((GCallback) (
sensitivity_toggled))), (widget), ((void*)0), (GConnectFlags)
0)
1626 G_CALLBACK (sensitivity_toggled),g_signal_connect_data ((button), ("toggled"), (((GCallback) (
sensitivity_toggled))), (widget), ((void*)0), (GConnectFlags)
0)
1627 widget)g_signal_connect_data ((button), ("toggled"), (((GCallback) (
sensitivity_toggled))), (widget), ((void*)0), (GConnectFlags)
0)
;
1628
1629 ctk_widget_show_all (button);
1630
1631 return button;
1632}
1633
1634static void
1635set_selectable_recursive (CtkWidget *widget,
1636 gboolean setting)
1637{
1638 if (CTK_IS_CONTAINER (widget)(((__extension__ ({ GTypeInstance *__inst = (GTypeInstance*) (
(widget)); GType __t = ((ctk_container_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; }))))
)
1639 {
1640 GList *children;
1641 GList *tmp;
1642
1643 children = ctk_container_get_children (CTK_CONTAINER (widget)((((CtkContainer*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((widget)), ((ctk_container_get_type ()))))))
);
1644 tmp = children;
1645 while (tmp)
1646 {
1647 set_selectable_recursive (tmp->data, setting);
1648
1649 tmp = tmp->next;
1650 }
1651 g_list_free (children);
1652 }
1653 else if (CTK_IS_LABEL (widget)(((__extension__ ({ GTypeInstance *__inst = (GTypeInstance*) (
(widget)); 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; }))))
)
1654 {
1655 ctk_label_set_selectable (CTK_LABEL (widget)((((CtkLabel*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((widget)), ((ctk_label_get_type ()))))))
, setting);
1656 }
1657}
1658
1659static void
1660selectable_toggled (CtkWidget *toggle,
1661 CtkWidget *widget)
1662{
1663 set_selectable_recursive (widget,
1664 ctk_toggle_button_get_active (CTK_TOGGLE_BUTTON (toggle)((((CtkToggleButton*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((toggle)), ((ctk_toggle_button_get_type ()))))))
));
1665}
1666
1667static CtkWidget*
1668create_selectable_control (CtkWidget *widget)
1669{
1670 CtkWidget *button;
1671
1672 button = ctk_toggle_button_new_with_label ("Selectable");
1673
1674 ctk_toggle_button_set_active (CTK_TOGGLE_BUTTON (button)((((CtkToggleButton*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((button)), ((ctk_toggle_button_get_type ()))))))
,
1675 FALSE(0));
1676
1677 g_signal_connect (button,g_signal_connect_data ((button), ("toggled"), (((GCallback) (
selectable_toggled))), (widget), ((void*)0), (GConnectFlags) 0
)
1678 "toggled",g_signal_connect_data ((button), ("toggled"), (((GCallback) (
selectable_toggled))), (widget), ((void*)0), (GConnectFlags) 0
)
1679 G_CALLBACK (selectable_toggled),g_signal_connect_data ((button), ("toggled"), (((GCallback) (
selectable_toggled))), (widget), ((void*)0), (GConnectFlags) 0
)
1680 widget)g_signal_connect_data ((button), ("toggled"), (((GCallback) (
selectable_toggled))), (widget), ((void*)0), (GConnectFlags) 0
)
;
1681
1682 ctk_widget_show_all (button);
1683
1684 return button;
1685}
1686
1687static void
1688dialog_response (CtkWidget *dialog,
1689 gint response_id G_GNUC_UNUSED__attribute__ ((__unused__)),
1690 CtkLabel *label)
1691{
1692 const gchar *text;
1693
1694 ctk_widget_destroy (dialog);
1695
1696 text = "Some <a href=\"http://en.wikipedia.org/wiki/Text\" title=\"plain text\">text</a> may be marked up\n"
1697 "as hyperlinks, which can be clicked\n"
1698 "or activated via <a href=\"keynav\">keynav</a>.\n"
1699 "The links remain the same.";
1700 ctk_label_set_markup (label, text);
1701}
1702
1703static gboolean
1704activate_link (CtkWidget *label,
1705 const gchar *uri,
1706 gpointer data G_GNUC_UNUSED__attribute__ ((__unused__)))
1707{
1708 if (g_strcmp0 (uri, "keynav") == 0)
1709 {
1710 CtkWidget *dialog;
1711
1712 dialog = ctk_message_dialog_new_with_markup (CTK_WINDOW (ctk_widget_get_toplevel (label))((((CtkWindow*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((ctk_widget_get_toplevel (label))), ((ctk_window_get_type
()))))))
,
1713 CTK_DIALOG_DESTROY_WITH_PARENT,
1714 CTK_MESSAGE_INFO,
1715 CTK_BUTTONS_OK,
1716 "The term <i>keynav</i> is a shorthand for "
1717 "keyboard navigation and refers to the process of using a program "
1718 "(exclusively) via keyboard input.");
1719
1720 ctk_window_present (CTK_WINDOW (dialog)((((CtkWindow*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((dialog)), ((ctk_window_get_type ()))))))
);
1721
1722 g_signal_connect (dialog, "response", G_CALLBACK (dialog_response), label)g_signal_connect_data ((dialog), ("response"), (((GCallback) (
dialog_response))), (label), ((void*)0), (GConnectFlags) 0)
;
1723
1724 return TRUE(!(0));
1725 }
1726
1727 return FALSE(0);
1728}
1729
1730void create_labels (CtkWidget *widget)
1731{
1732 static CtkWidget *window = NULL((void*)0);
1733
1734 if (!window)
1735 {
1736 CtkWidget *hbox;
1737 CtkWidget *vbox;
1738 CtkWidget *frame;
1739 CtkWidget *label;
1740 CtkWidget *button;
1741
1742 window = ctk_window_new (CTK_WINDOW_TOPLEVEL);
1743
1744 ctk_window_set_screen (CTK_WINDOW (window)((((CtkWindow*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((window)), ((ctk_window_get_type ()))))))
,
1745 ctk_widget_get_screen (widget));
1746
1747 g_signal_connect (window, "destroy",g_signal_connect_data ((window), ("destroy"), (((GCallback) (
ctk_widget_destroyed))), (&window), ((void*)0), (GConnectFlags
) 0)
1748 G_CALLBACK (ctk_widget_destroyed),g_signal_connect_data ((window), ("destroy"), (((GCallback) (
ctk_widget_destroyed))), (&window), ((void*)0), (GConnectFlags
) 0)
1749 &window)g_signal_connect_data ((window), ("destroy"), (((GCallback) (
ctk_widget_destroyed))), (&window), ((void*)0), (GConnectFlags
) 0)
;
1750
1751 ctk_window_set_title (CTK_WINDOW (window)((((CtkWindow*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((window)), ((ctk_window_get_type ()))))))
, "Label");
1752
1753 vbox = ctk_box_new (CTK_ORIENTATION_VERTICAL, 5);
1754
1755 hbox = ctk_box_new (CTK_ORIENTATION_HORIZONTAL, 5);
1756 ctk_container_add (CTK_CONTAINER (window)((((CtkContainer*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((window)), ((ctk_container_get_type ()))))))
, vbox);
1757
1758 ctk_box_pack_end (CTK_BOX (vbox)((((CtkBox*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((vbox)), ((ctk_box_get_type ()))))))
, hbox, FALSE(0), FALSE(0), 0);
1759
1760 button = create_sensitivity_control (hbox);
1761
1762 ctk_box_pack_start (CTK_BOX (vbox)((((CtkBox*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((vbox)), ((ctk_box_get_type ()))))))
, button, FALSE(0), FALSE(0), 0);
1763
1764 button = create_selectable_control (hbox);
1765
1766 ctk_box_pack_start (CTK_BOX (vbox)((((CtkBox*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((vbox)), ((ctk_box_get_type ()))))))
, button, FALSE(0), FALSE(0), 0);
1767
1768 vbox = ctk_box_new (CTK_ORIENTATION_VERTICAL, 5);
1769
1770 ctk_box_pack_start (CTK_BOX (hbox)((((CtkBox*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((hbox)), ((ctk_box_get_type ()))))))
, vbox, FALSE(0), FALSE(0), 0);
1771 ctk_container_set_border_width (CTK_CONTAINER (window)((((CtkContainer*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((window)), ((ctk_container_get_type ()))))))
, 5);
1772
1773 frame = ctk_frame_new ("Normal Label");
1774 label = ctk_label_new ("This is a Normal label");
1775 ctk_label_set_ellipsize (CTK_LABEL (label)((((CtkLabel*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((label)), ((ctk_label_get_type ()))))))
, PANGO_ELLIPSIZE_START);
1776 ctk_container_add (CTK_CONTAINER (frame)((((CtkContainer*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((frame)), ((ctk_container_get_type ()))))))
, label);
1777 ctk_box_pack_start (CTK_BOX (vbox)((((CtkBox*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((vbox)), ((ctk_box_get_type ()))))))
, frame, FALSE(0), FALSE(0), 0);
1778
1779 frame = ctk_frame_new ("Multi-line Label");
1780 label = ctk_label_new ("This is a Multi-line label.\nSecond line\nThird line");
1781 ctk_label_set_ellipsize (CTK_LABEL (label)((((CtkLabel*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((label)), ((ctk_label_get_type ()))))))
, PANGO_ELLIPSIZE_END);
1782 ctk_container_add (CTK_CONTAINER (frame)((((CtkContainer*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((frame)), ((ctk_container_get_type ()))))))
, label);
1783 ctk_box_pack_start (CTK_BOX (vbox)((((CtkBox*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((vbox)), ((ctk_box_get_type ()))))))
, frame, FALSE(0), FALSE(0), 0);
1784
1785 frame = ctk_frame_new ("Left Justified Label");
1786 label = ctk_label_new ("This is a Left-Justified\nMulti-line label.\nThird line");
1787 ctk_label_set_ellipsize (CTK_LABEL (label)((((CtkLabel*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((label)), ((ctk_label_get_type ()))))))
, PANGO_ELLIPSIZE_MIDDLE);
1788 ctk_label_set_justify (CTK_LABEL (label)((((CtkLabel*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((label)), ((ctk_label_get_type ()))))))
, CTK_JUSTIFY_LEFT);
1789 ctk_container_add (CTK_CONTAINER (frame)((((CtkContainer*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((frame)), ((ctk_container_get_type ()))))))
, label);
1790 ctk_box_pack_start (CTK_BOX (vbox)((((CtkBox*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((vbox)), ((ctk_box_get_type ()))))))
, frame, FALSE(0), FALSE(0), 0);
1791
1792 frame = ctk_frame_new ("Right Justified Label");
1793 ctk_label_set_ellipsize (CTK_LABEL (label)((((CtkLabel*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((label)), ((ctk_label_get_type ()))))))
, PANGO_ELLIPSIZE_START);
1794 label = ctk_label_new ("This is a Right-Justified\nMulti-line label.\nFourth line, (j/k)");
1795 ctk_label_set_justify (CTK_LABEL (label)((((CtkLabel*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((label)), ((ctk_label_get_type ()))))))
, CTK_JUSTIFY_RIGHT);
1796 ctk_container_add (CTK_CONTAINER (frame)((((CtkContainer*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((frame)), ((ctk_container_get_type ()))))))
, label);
1797 ctk_box_pack_start (CTK_BOX (vbox)((((CtkBox*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((vbox)), ((ctk_box_get_type ()))))))
, frame, FALSE(0), FALSE(0), 0);
1798
1799 frame = ctk_frame_new ("Internationalized Label");
1800 label = ctk_label_new (NULL((void*)0));
1801 ctk_label_set_markup (CTK_LABEL (label)((((CtkLabel*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((label)), ((ctk_label_get_type ()))))))
,
1802 "French (Fran\303\247ais) Bonjour, Salut\n"
1803 "Korean (\355\225\234\352\270\200) \354\225\210\353\205\225\355\225\230\354\204\270\354\232\224, \354\225\210\353\205\225\355\225\230\354\213\255\353\213\210\352\271\214\n"
1804 "Russian (\320\240\321\203\321\201\321\201\320\272\320\270\320\271) \320\227\320\264\321\200\320\260\320\262\321\201\321\202\320\262\321\203\320\271\321\202\320\265!\n"
1805 "Chinese (Simplified) <span lang=\"zh-cn\">\345\205\203\346\260\224 \345\274\200\345\217\221</span>\n"
1806 "Chinese (Traditional) <span lang=\"zh-tw\">\345\205\203\346\260\243 \351\226\213\347\231\274</span>\n"
1807 "Japanese <span lang=\"ja\">\345\205\203\346\260\227 \351\226\213\347\231\272</span>");
1808 ctk_label_set_justify (CTK_LABEL (label)((((CtkLabel*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((label)), ((ctk_label_get_type ()))))))
, CTK_JUSTIFY_LEFT);
1809 ctk_container_add (CTK_CONTAINER (frame)((((CtkContainer*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((frame)), ((ctk_container_get_type ()))))))
, label);
1810 ctk_box_pack_start (CTK_BOX (vbox)((((CtkBox*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((vbox)), ((ctk_box_get_type ()))))))
, frame, FALSE(0), FALSE(0), 0);
1811
1812 frame = ctk_frame_new ("Bidirection Label");
1813 label = ctk_label_new ("\342\200\217Arabic \330\247\331\204\330\263\331\204\330\247\331\205 \330\271\331\204\331\212\331\203\331\205\n"
1814 "\342\200\217Hebrew \327\251\327\234\327\225\327\235");
1815 ctk_container_add (CTK_CONTAINER (frame)((((CtkContainer*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((frame)), ((ctk_container_get_type ()))))))
, label);
1816 ctk_box_pack_start (CTK_BOX (vbox)((((CtkBox*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((vbox)), ((ctk_box_get_type ()))))))
, frame, FALSE(0), FALSE(0), 0);
1817
1818 frame = ctk_frame_new ("Links in a label");
1819 label = ctk_label_new ("Some <a href=\"http://en.wikipedia.org/wiki/Text\" title=\"plain text\">text</a> may be marked up\n"
1820 "as hyperlinks, which can be clicked\n"
1821 "or activated via <a href=\"keynav\">keynav</a>");
1822 ctk_label_set_use_markup (CTK_LABEL (label)((((CtkLabel*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((label)), ((ctk_label_get_type ()))))))
, TRUE(!(0)));
1823 ctk_container_add (CTK_CONTAINER (frame)((((CtkContainer*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((frame)), ((ctk_container_get_type ()))))))
, label);
1824 ctk_box_pack_start (CTK_BOX (vbox)((((CtkBox*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((vbox)), ((ctk_box_get_type ()))))))
, frame, FALSE(0), FALSE(0), 0);
1825 g_signal_connect (label, "activate-link", G_CALLBACK (activate_link), NULL)g_signal_connect_data ((label), ("activate-link"), (((GCallback
) (activate_link))), (((void*)0)), ((void*)0), (GConnectFlags
) 0)
;
1826
1827 vbox = ctk_box_new (CTK_ORIENTATION_VERTICAL, 5);
1828 ctk_box_pack_start (CTK_BOX (hbox)((((CtkBox*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((hbox)), ((ctk_box_get_type ()))))))
, vbox, FALSE(0), FALSE(0), 0);
1829 frame = ctk_frame_new ("Line wrapped label");
1830 label = ctk_label_new ("This is an example of a line-wrapped label. It should not be taking "\
1831 "up the entire "/* big space to test spacing */\
1832 "width allocated to it, but automatically wraps the words to fit. "\
1833 "The time has come, for all good men, to come to the aid of their party. "\
1834 "The sixth sheik's six sheep's sick.\n"\
1835 " It supports multiple paragraphs correctly, and correctly adds "\
1836 "many extra spaces. ");
1837
1838 ctk_label_set_line_wrap (CTK_LABEL (label)((((CtkLabel*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((label)), ((ctk_label_get_type ()))))))
, TRUE(!(0)));
1839 ctk_container_add (CTK_CONTAINER (frame)((((CtkContainer*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((frame)), ((ctk_container_get_type ()))))))
, label);
1840 ctk_box_pack_start (CTK_BOX (vbox)((((CtkBox*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((vbox)), ((ctk_box_get_type ()))))))
, frame, FALSE(0), FALSE(0), 0);
1841
1842 frame = ctk_frame_new ("Filled, wrapped label");
1843 label = ctk_label_new ("This is an example of a line-wrapped, filled label. It should be taking "\
1844 "up the entire width allocated to it. Here is a seneance to prove "\
1845 "my point. Here is another sentence. "\
1846 "Here comes the sun, do de do de do.\n"\
1847 " This is a new paragraph.\n"\
1848 " This is another newer, longer, better paragraph. It is coming to an end, "\
1849 "unfortunately.");
1850 ctk_label_set_justify (CTK_LABEL (label)((((CtkLabel*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((label)), ((ctk_label_get_type ()))))))
, CTK_JUSTIFY_FILL);
1851 ctk_label_set_line_wrap (CTK_LABEL (label)((((CtkLabel*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((label)), ((ctk_label_get_type ()))))))
, TRUE(!(0)));
1852 ctk_container_add (CTK_CONTAINER (frame)((((CtkContainer*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((frame)), ((ctk_container_get_type ()))))))
, label);
1853 ctk_box_pack_start (CTK_BOX (vbox)((((CtkBox*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((vbox)), ((ctk_box_get_type ()))))))
, frame, FALSE(0), FALSE(0), 0);
1854
1855 frame = ctk_frame_new ("Underlined label");
1856 label = ctk_label_new ("This label is underlined!\n"
1857 "This one is underlined (\343\201\223\343\202\223\343\201\253\343\201\241\343\201\257) in quite a funky fashion");
1858 ctk_label_set_justify (CTK_LABEL (label)((((CtkLabel*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((label)), ((ctk_label_get_type ()))))))
, CTK_JUSTIFY_LEFT);
1859 ctk_label_set_pattern (CTK_LABEL (label)((((CtkLabel*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((label)), ((ctk_label_get_type ()))))))
, "_________________________ _ _________ _ _____ _ __ __ ___ ____ _____");
1860 ctk_container_add (CTK_CONTAINER (frame)((((CtkContainer*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((frame)), ((ctk_container_get_type ()))))))
, label);
1861 ctk_box_pack_start (CTK_BOX (vbox)((((CtkBox*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((vbox)), ((ctk_box_get_type ()))))))
, frame, FALSE(0), FALSE(0), 0);
1862
1863 frame = ctk_frame_new ("Markup label");
1864 label = ctk_label_new (NULL((void*)0));
1865
1866 /* There's also a ctk_label_set_markup() without accel if you
1867 * don't have an accelerator key
1868 */
1869 ctk_label_set_markup_with_mnemonic (CTK_LABEL (label)((((CtkLabel*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((label)), ((ctk_label_get_type ()))))))
,
1870 "This <span foreground=\"blue\" background=\"orange\">label</span> has "
1871 "<b>markup</b> _such as "
1872 "<big><i>Big Italics</i></big>\n"
1873 "<tt>Monospace font</tt>\n"
1874 "<u>Underline!</u>\n"
1875 "foo\n"
1876 "<span foreground=\"green\" background=\"red\">Ugly colors</span>\n"
1877 "and nothing on this line,\n"
1878 "or this.\n"
1879 "or this either\n"
1880 "or even on this one\n"
1881 "la <big>la <big>la <big>la <big>la</big></big></big></big>\n"
1882 "but this _word is <span foreground=\"purple\"><big>purple</big></span>\n"
1883 "<span underline=\"double\">We like <sup>superscript</sup> and <sub>subscript</sub> too</span>");
1884
1885 g_assert (ctk_label_get_mnemonic_keyval (CTK_LABEL (label)) == CDK_KEY_s)do { if (ctk_label_get_mnemonic_keyval (((((CtkLabel*) (void *
) g_type_check_instance_cast ((GTypeInstance*) ((label)), ((ctk_label_get_type
()))))))) == 0x073) ; else g_assertion_message_expr (((gchar
*) 0), "testctk.c", 1885, ((const char*) (__func__)), "ctk_label_get_mnemonic_keyval (CTK_LABEL (label)) == CDK_KEY_s"
); } while (0)
;
1886
1887 ctk_container_add (CTK_CONTAINER (frame)((((CtkContainer*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((frame)), ((ctk_container_get_type ()))))))
, label);
1888 ctk_box_pack_start (CTK_BOX (vbox)((((CtkBox*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((vbox)), ((ctk_box_get_type ()))))))
, frame, FALSE(0), FALSE(0), 0);
1889 }
1890
1891 if (!ctk_widget_get_visible (window))
1892 ctk_widget_show_all (window);
1893 else
1894 ctk_widget_destroy (window);
1895}
1896
1897static void
1898on_angle_scale_changed (CtkRange *range,
1899 CtkLabel *label)
1900{
1901 ctk_label_set_angle (CTK_LABEL (label)((((CtkLabel*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((label)), ((ctk_label_get_type ()))))))
, ctk_range_get_value (range));
1902}
1903
1904static void
1905create_rotated_label (CtkWidget *widget)
1906{
1907 static CtkWidget *window = NULL((void*)0);
1908
1909 if (!window)
1910 {
1911 CtkWidget *content_area;
1912 CtkWidget *vbox;
1913 CtkWidget *hscale;
1914 CtkWidget *label;
1915 CtkWidget *scale_label;
1916 CtkWidget *scale_hbox;
1917
1918 window = ctk_dialog_new_with_buttons ("Rotated Label",
1919 CTK_WINDOW (ctk_widget_get_toplevel (widget))((((CtkWindow*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((ctk_widget_get_toplevel (widget))), ((ctk_window_get_type
()))))))
, 0,
1920 "_Close", CTK_RESPONSE_CLOSE,
1921 NULL((void*)0));
1922
1923 ctk_window_set_resizable (CTK_WINDOW (window)((((CtkWindow*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((window)), ((ctk_window_get_type ()))))))
, TRUE(!(0)));
1924
1925 ctk_window_set_screen (CTK_WINDOW (window)((((CtkWindow*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((window)), ((ctk_window_get_type ()))))))
,
1926 ctk_widget_get_screen (widget));
1927
1928 g_signal_connect (window, "response",g_signal_connect_data ((window), ("response"), (((GCallback) (
ctk_widget_destroy))), (((void*)0)), ((void*)0), (GConnectFlags
) 0)
1929 G_CALLBACK (ctk_widget_destroy), NULL)g_signal_connect_data ((window), ("response"), (((GCallback) (
ctk_widget_destroy))), (((void*)0)), ((void*)0), (GConnectFlags
) 0)
;
1930 g_signal_connect (window, "destroy",g_signal_connect_data ((window), ("destroy"), (((GCallback) (
ctk_widget_destroyed))), (&window), ((void*)0), (GConnectFlags
) 0)
1931 G_CALLBACK (ctk_widget_destroyed), &window)g_signal_connect_data ((window), ("destroy"), (((GCallback) (
ctk_widget_destroyed))), (&window), ((void*)0), (GConnectFlags
) 0)
;
1932
1933 content_area = ctk_dialog_get_content_area (CTK_DIALOG (window)((((CtkDialog*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((window)), ((ctk_dialog_get_type ()))))))
);
1934
1935 vbox = ctk_box_new (CTK_ORIENTATION_VERTICAL, 5);
1936 ctk_box_pack_start (CTK_BOX (content_area)((((CtkBox*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((content_area)), ((ctk_box_get_type ()))))))
, vbox, TRUE(!(0)), TRUE(!(0)), 0);
1937 ctk_container_set_border_width (CTK_CONTAINER (vbox)((((CtkContainer*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((vbox)), ((ctk_container_get_type ()))))))
, 10);
1938
1939 label = ctk_label_new (NULL((void*)0));
1940 ctk_label_set_markup (CTK_LABEL (label)((((CtkLabel*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((label)), ((ctk_label_get_type ()))))))
, "Hello World\n<i>Rotate</i> <span underline='single' foreground='blue'>me</span>");
1941 ctk_box_pack_start (CTK_BOX (vbox)((((CtkBox*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((vbox)), ((ctk_box_get_type ()))))))
, label, TRUE(!(0)), TRUE(!(0)), 0);
1942
1943 scale_hbox = ctk_box_new (CTK_ORIENTATION_HORIZONTAL, 0);
1944 ctk_box_pack_start (CTK_BOX (vbox)((((CtkBox*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((vbox)), ((ctk_box_get_type ()))))))
, scale_hbox, FALSE(0), FALSE(0), 0);
1945
1946 scale_label = ctk_label_new (NULL((void*)0));
1947 ctk_label_set_markup (CTK_LABEL (scale_label)((((CtkLabel*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((scale_label)), ((ctk_label_get_type ()))))))
, "<i>Angle: </i>");
1948 ctk_box_pack_start (CTK_BOX (scale_hbox)((((CtkBox*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((scale_hbox)), ((ctk_box_get_type ()))))))
, scale_label, FALSE(0), FALSE(0), 0);
1949
1950 hscale = ctk_scale_new_with_range (CTK_ORIENTATION_HORIZONTAL,
1951 0, 360, 5);
1952 g_signal_connect (hscale, "value-changed",g_signal_connect_data ((hscale), ("value-changed"), (((GCallback
) (on_angle_scale_changed))), (label), ((void*)0), (GConnectFlags
) 0)
1953 G_CALLBACK (on_angle_scale_changed), label)g_signal_connect_data ((hscale), ("value-changed"), (((GCallback
) (on_angle_scale_changed))), (label), ((void*)0), (GConnectFlags
) 0)
;
1954
1955 ctk_range_set_value (CTK_RANGE (hscale)((((CtkRange*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((hscale)), ((ctk_range_get_type ()))))))
, 45);
1956 ctk_widget_set_size_request (hscale, 200, -1);
1957 ctk_box_pack_start (CTK_BOX (scale_hbox)((((CtkBox*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((scale_hbox)), ((ctk_box_get_type ()))))))
, hscale, TRUE(!(0)), TRUE(!(0)), 0);
1958 }
1959
1960 if (!ctk_widget_get_visible (window))
1961 ctk_widget_show_all (window);
1962 else
1963 ctk_widget_destroy (window);
1964}
1965
1966#define DEFAULT_TEXT_RADIUS200 200
1967
1968static void
1969on_rotated_text_unrealize (CtkWidget *widget)
1970{
1971 g_object_set_data (G_OBJECT (widget)((((GObject*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((widget)), (((GType) ((20) << (2))))))))
, "text-gc", NULL((void*)0));
1972}
1973
1974static gboolean
1975on_rotated_text_draw (CtkWidget *widget,
1976 cairo_t *cr,
1977 GdkPixbuf *tile_pixbuf)
1978{
1979 static const gchar *words[] = { "The", "grand", "old", "Duke", "of", "York",
1980 "had", "10,000", "men" };
1981 int n_words;
1982 int i;
1983 int width, height;
1984 double radius;
1985 PangoLayout *layout;
1986 PangoContext *context;
1987 PangoFontDescription *desc;
1988
1989 cairo_set_source_rgb (cr, 1, 1, 1);
1990 cairo_paint (cr);
1991
1992 if (tile_pixbuf)
1993 {
1994 cdk_cairo_set_source_pixbuf (cr, tile_pixbuf, 0, 0);
1995 cairo_pattern_set_extend (cairo_get_source (cr), CAIRO_EXTEND_REPEAT);
1996 }
1997 else
1998 cairo_set_source_rgb (cr, 0, 0, 0);
1999
2000 width = ctk_widget_get_allocated_width (widget);
2001 height = ctk_widget_get_allocated_height (widget);
2002 radius = MIN (width, height)(((width) < (height)) ? (width) : (height)) / 2.;
2003
2004 cairo_translate (cr,
2005 radius + (width - 2 * radius) / 2,
2006 radius + (height - 2 * radius) / 2);
2007 cairo_scale (cr, radius / DEFAULT_TEXT_RADIUS200, radius / DEFAULT_TEXT_RADIUS200);
2008
2009 context = ctk_widget_get_pango_context (widget);
2010 layout = pango_layout_new (context);
2011 desc = pango_font_description_from_string ("Sans Bold 30");
2012 pango_layout_set_font_description (layout, desc);
2013 pango_font_description_free (desc);
2014
2015 n_words = G_N_ELEMENTS (words)(sizeof (words) / sizeof ((words)[0]));
2016 for (i = 0; i < n_words; i++)
2017 {
2018 int width, height;
2019
2020 cairo_save (cr);
2021
2022 cairo_rotate (cr, 2 * G_PI3.1415926535897932384626433832795028841971693993751 * i / n_words);
2023 pango_cairo_update_layout (cr, layout);
2024
2025 pango_layout_set_text (layout, words[i], -1);
2026 pango_layout_get_size (layout, &width, &height);
2027
2028 cairo_move_to (cr, - width / 2 / PANGO_SCALE1024, - DEFAULT_TEXT_RADIUS200);
2029 pango_cairo_show_layout (cr, layout);
2030
2031 cairo_restore (cr);
2032 }
2033
2034 g_object_unref (layout);
2035
2036 return FALSE(0);
2037}
2038
2039static void
2040create_rotated_text (CtkWidget *widget)
2041{
2042 static CtkWidget *window = NULL((void*)0);
2043
2044 if (!window)
2045 {
2046 CtkRequisition requisition;
2047 CtkWidget *content_area;
2048 CtkWidget *drawing_area;
2049 GdkPixbuf *tile_pixbuf;
2050
2051 window = ctk_dialog_new_with_buttons ("Rotated Text",
2052 CTK_WINDOW (ctk_widget_get_toplevel (widget))((((CtkWindow*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((ctk_widget_get_toplevel (widget))), ((ctk_window_get_type
()))))))
, 0,
2053 "_Close", CTK_RESPONSE_CLOSE,
2054 NULL((void*)0));
2055
2056 ctk_window_set_resizable (CTK_WINDOW (window)((((CtkWindow*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((window)), ((ctk_window_get_type ()))))))
, TRUE(!(0)));
2057
2058 ctk_window_set_screen (CTK_WINDOW (window)((((CtkWindow*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((window)), ((ctk_window_get_type ()))))))
,
2059 ctk_widget_get_screen (widget));
2060
2061 g_signal_connect (window, "response",g_signal_connect_data ((window), ("response"), (((GCallback) (
ctk_widget_destroy))), (((void*)0)), ((void*)0), (GConnectFlags
) 0)
2062 G_CALLBACK (ctk_widget_destroy), NULL)g_signal_connect_data ((window), ("response"), (((GCallback) (
ctk_widget_destroy))), (((void*)0)), ((void*)0), (GConnectFlags
) 0)
;
2063 g_signal_connect (window, "destroy",g_signal_connect_data ((window), ("destroy"), (((GCallback) (
ctk_widget_destroyed))), (&window), ((void*)0), (GConnectFlags
) 0)
2064 G_CALLBACK (ctk_widget_destroyed), &window)g_signal_connect_data ((window), ("destroy"), (((GCallback) (
ctk_widget_destroyed))), (&window), ((void*)0), (GConnectFlags
) 0)
;
2065
2066 content_area = ctk_dialog_get_content_area (CTK_DIALOG (window)((((CtkDialog*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((window)), ((ctk_dialog_get_type ()))))))
);
2067
2068 drawing_area = ctk_drawing_area_new ();
2069 ctk_box_pack_start (CTK_BOX (content_area)((((CtkBox*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((content_area)), ((ctk_box_get_type ()))))))
, drawing_area, TRUE(!(0)), TRUE(!(0)), 0);
2070
2071 tile_pixbuf = gdk_pixbuf_new_from_file ("marble.xpm", NULL((void*)0));
2072
2073 g_signal_connect (drawing_area, "draw",g_signal_connect_data ((drawing_area), ("draw"), (((GCallback
) (on_rotated_text_draw))), (tile_pixbuf), ((void*)0), (GConnectFlags
) 0)
2074 G_CALLBACK (on_rotated_text_draw), tile_pixbuf)g_signal_connect_data ((drawing_area), ("draw"), (((GCallback
) (on_rotated_text_draw))), (tile_pixbuf), ((void*)0), (GConnectFlags
) 0)
;
2075 g_signal_connect (drawing_area, "unrealize",g_signal_connect_data ((drawing_area), ("unrealize"), (((GCallback
) (on_rotated_text_unrealize))), (((void*)0)), ((void*)0), (GConnectFlags
) 0)
2076 G_CALLBACK (on_rotated_text_unrealize), NULL)g_signal_connect_data ((drawing_area), ("unrealize"), (((GCallback
) (on_rotated_text_unrealize))), (((void*)0)), ((void*)0), (GConnectFlags
) 0)
;
2077
2078 ctk_widget_show_all (ctk_bin_get_child (CTK_BIN (window)((((CtkBin*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((window)), ((ctk_bin_get_type ()))))))
));
2079
2080 ctk_widget_set_size_request (drawing_area, DEFAULT_TEXT_RADIUS200 * 2, DEFAULT_TEXT_RADIUS200 * 2);
2081 ctk_widget_get_preferred_size ( (window),
2082 &requisition, NULL((void*)0));
2083 ctk_widget_set_size_request (drawing_area, -1, -1);
2084 ctk_window_resize (CTK_WINDOW (window)((((CtkWindow*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((window)), ((ctk_window_get_type ()))))))
, requisition.width, requisition.height);
2085 }
2086
2087 if (!ctk_widget_get_visible (window))
2088 ctk_widget_show (window);
2089 else
2090 ctk_widget_destroy (window);
2091}
2092
2093/*
2094 * Reparent demo
2095 */
2096
2097static void
2098reparent_label (CtkWidget *widget,
2099 CtkWidget *new_parent)
2100{
2101 CtkWidget *label;
2102
2103 label = g_object_get_data (G_OBJECT (widget)((((GObject*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((widget)), (((GType) ((20) << (2))))))))
, "user_data");
2104
2105 ctk_widget_reparent (label, new_parent);
2106}
2107
2108static void
2109set_parent_signal (CtkWidget *child,
2110 CtkWidget *old_parent,
2111 gpointer func_data)
2112{
2113 CtkWidget *parent;
2114
2115 parent = ctk_widget_get_parent (child);
2116 g_message ("set_parent for \"%s\": new parent: \"%s\", old parent: \"%s\", data: %d\n",
2117 g_type_name (G_OBJECT_TYPE (child)(((((GTypeClass*) (((GTypeInstance*) (child))->g_class))->
g_type)))
),
2118 parent ? g_type_name (G_OBJECT_TYPE (parent)(((((GTypeClass*) (((GTypeInstance*) (parent))->g_class))->
g_type)))
) : "NULL",
2119 old_parent ? g_type_name (G_OBJECT_TYPE (old_parent)(((((GTypeClass*) (((GTypeInstance*) (old_parent))->g_class
))->g_type)))
) : "NULL",
2120 GPOINTER_TO_INT (func_data)((gint) (glong) (func_data)));
2121}
2122
2123static void
2124create_reparent (CtkWidget *widget)
2125{
2126 static CtkWidget *window = NULL((void*)0);
2127
2128 if (!window)
2129 {
2130 CtkWidget *box1;
2131 CtkWidget *box2;
2132 CtkWidget *box3;
2133 CtkWidget *frame;
2134 CtkWidget *button;
2135 CtkWidget *label;
2136 CtkWidget *separator;
2137 CtkWidget *event_box;
2138
2139 window = ctk_window_new (CTK_WINDOW_TOPLEVEL);
2140
2141 ctk_window_set_screen (CTK_WINDOW (window)((((CtkWindow*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((window)), ((ctk_window_get_type ()))))))
,
2142 ctk_widget_get_screen (widget));
2143
2144 g_signal_connect (window, "destroy",g_signal_connect_data ((window), ("destroy"), (((GCallback) (
ctk_widget_destroyed))), (&window), ((void*)0), (GConnectFlags
) 0)
2145 G_CALLBACK (ctk_widget_destroyed),g_signal_connect_data ((window), ("destroy"), (((GCallback) (
ctk_widget_destroyed))), (&window), ((void*)0), (GConnectFlags
) 0)
2146 &window)g_signal_connect_data ((window), ("destroy"), (((GCallback) (
ctk_widget_destroyed))), (&window), ((void*)0), (GConnectFlags
) 0)
;
2147
2148 ctk_window_set_title (CTK_WINDOW (window)((((CtkWindow*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((window)), ((ctk_window_get_type ()))))))
, "reparent");
2149 ctk_container_set_border_width (CTK_CONTAINER (window)((((CtkContainer*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((window)), ((ctk_container_get_type ()))))))
, 0);
2150
2151 box1 = ctk_box_new (CTK_ORIENTATION_VERTICAL, 0);
2152 ctk_container_add (CTK_CONTAINER (window)((((CtkContainer*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((window)), ((ctk_container_get_type ()))))))
, box1);
2153
2154 box2 = ctk_box_new (CTK_ORIENTATION_HORIZONTAL, 5);
2155 ctk_container_set_border_width (CTK_CONTAINER (box2)((((CtkContainer*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((box2)), ((ctk_container_get_type ()))))))
, 10);
2156 ctk_box_pack_start (CTK_BOX (box1)((((CtkBox*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((box1)), ((ctk_box_get_type ()))))))
, box2, TRUE(!(0)), TRUE(!(0)), 0);
2157
2158 label = ctk_label_new ("Hello World");
2159
2160 frame = ctk_frame_new ("Frame 1");
2161 ctk_box_pack_start (CTK_BOX (box2)((((CtkBox*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((box2)), ((ctk_box_get_type ()))))))
, frame, TRUE(!(0)), TRUE(!(0)), 0);
2162
2163 box3 = ctk_box_new (CTK_ORIENTATION_VERTICAL, 5);
2164 ctk_container_set_border_width (CTK_CONTAINER (box3)((((CtkContainer*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((box3)), ((ctk_container_get_type ()))))))
, 5);
2165 ctk_container_add (CTK_CONTAINER (frame)((((CtkContainer*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((frame)), ((ctk_container_get_type ()))))))
, box3);
2166
2167 button = ctk_button_new_with_label ("switch");
2168 g_object_set_data (G_OBJECT (button)((((GObject*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((button)), (((GType) ((20) << (2))))))))
, "user_data", label);
2169 ctk_box_pack_start (CTK_BOX (box3)((((CtkBox*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((box3)), ((ctk_box_get_type ()))))))
, button, FALSE(0), TRUE(!(0)), 0);
2170
2171 event_box = ctk_event_box_new ();
2172 ctk_box_pack_start (CTK_BOX (box3)((((CtkBox*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((box3)), ((ctk_box_get_type ()))))))
, event_box, FALSE(0), TRUE(!(0)), 0);
2173 ctk_container_add (CTK_CONTAINER (event_box)((((CtkContainer*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((event_box)), ((ctk_container_get_type ()))))))
, label);
2174
2175 g_signal_connect (button, "clicked",g_signal_connect_data ((button), ("clicked"), (((GCallback) (
reparent_label))), (event_box), ((void*)0), (GConnectFlags) 0
)
2176 G_CALLBACK (reparent_label),g_signal_connect_data ((button), ("clicked"), (((GCallback) (
reparent_label))), (event_box), ((void*)0), (GConnectFlags) 0
)
2177 event_box)g_signal_connect_data ((button), ("clicked"), (((GCallback) (
reparent_label))), (event_box), ((void*)0), (GConnectFlags) 0
)
;
2178
2179 g_signal_connect (label, "parent_set",g_signal_connect_data ((label), ("parent_set"), (((GCallback)
(set_parent_signal))), (((gpointer) (glong) (42))), ((void*)
0), (GConnectFlags) 0)
2180 G_CALLBACK (set_parent_signal),g_signal_connect_data ((label), ("parent_set"), (((GCallback)
(set_parent_signal))), (((gpointer) (glong) (42))), ((void*)
0), (GConnectFlags) 0)
2181 GINT_TO_POINTER (42))g_signal_connect_data ((label), ("parent_set"), (((GCallback)
(set_parent_signal))), (((gpointer) (glong) (42))), ((void*)
0), (GConnectFlags) 0)
;
2182
2183 frame = ctk_frame_new ("Frame 2");
2184 ctk_box_pack_start (CTK_BOX (box2)((((CtkBox*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((box2)), ((ctk_box_get_type ()))))))
, frame, TRUE(!(0)), TRUE(!(0)), 0);
2185
2186 box3 = ctk_box_new (CTK_ORIENTATION_VERTICAL, 5);
2187 ctk_container_set_border_width (CTK_CONTAINER (box3)((((CtkContainer*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((box3)), ((ctk_container_get_type ()))))))
, 5);
2188 ctk_container_add (CTK_CONTAINER (frame)((((CtkContainer*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((frame)), ((ctk_container_get_type ()))))))
, box3);
2189
2190 button = ctk_button_new_with_label ("switch");
2191 g_object_set_data (G_OBJECT (button)((((GObject*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((button)), (((GType) ((20) << (2))))))))
, "user_data", label);
2192 ctk_box_pack_start (CTK_BOX (box3)((((CtkBox*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((box3)), ((ctk_box_get_type ()))))))
, button, FALSE(0), TRUE(!(0)), 0);
2193
2194 event_box = ctk_event_box_new ();
2195 ctk_box_pack_start (CTK_BOX (box3)((((CtkBox*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((box3)), ((ctk_box_get_type ()))))))
, event_box, FALSE(0), TRUE(!(0)), 0);
2196
2197 g_signal_connect (button, "clicked",g_signal_connect_data ((button), ("clicked"), (((GCallback) (
reparent_label))), (event_box), ((void*)0), (GConnectFlags) 0
)
2198 G_CALLBACK (reparent_label),g_signal_connect_data ((button), ("clicked"), (((GCallback) (
reparent_label))), (event_box), ((void*)0), (GConnectFlags) 0
)
2199 event_box)g_signal_connect_data ((button), ("clicked"), (((GCallback) (
reparent_label))), (event_box), ((void*)0), (GConnectFlags) 0
)
;
2200
2201 separator = ctk_separator_new (CTK_ORIENTATION_HORIZONTAL);
2202 ctk_box_pack_start (CTK_BOX (box1)((((CtkBox*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((box1)), ((ctk_box_get_type ()))))))
, separator, FALSE(0), TRUE(!(0)), 0);
2203
2204 box2 = ctk_box_new (CTK_ORIENTATION_VERTICAL, 10);
2205 ctk_container_set_border_width (CTK_CONTAINER (box2)((((CtkContainer*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((box2)), ((ctk_container_get_type ()))))))
, 10);
2206 ctk_box_pack_start (CTK_BOX (box1)((((CtkBox*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((box1)), ((ctk_box_get_type ()))))))
, box2, FALSE(0), TRUE(!(0)), 0);
2207
2208 button = ctk_button_new_with_label ("close");
2209 g_signal_connect_swapped (button, "clicked",g_signal_connect_data ((button), ("clicked"), (((GCallback) (
ctk_widget_destroy))), (window), ((void*)0), G_CONNECT_SWAPPED
)
2210 G_CALLBACK (ctk_widget_destroy), window)g_signal_connect_data ((button), ("clicked"), (((GCallback) (
ctk_widget_destroy))), (window), ((void*)0), G_CONNECT_SWAPPED
)
;
2211 ctk_box_pack_start (CTK_BOX (box2)((((CtkBox*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((box2)), ((ctk_box_get_type ()))))))
, button, TRUE(!(0)), TRUE(!(0)), 0);
2212 ctk_widget_set_can_default (button, TRUE(!(0)));
2213 ctk_widget_grab_default (button);
2214 }
2215
2216 if (!ctk_widget_get_visible (window))
2217 ctk_widget_show_all (window);
2218 else
2219 ctk_widget_destroy (window);
2220}
2221
2222/*
2223 * Resize Grips
2224 */
2225static gboolean
2226grippy_button_press (CtkWidget *area, CdkEventButton *event, CdkWindowEdge edge)
2227{
2228 if (event->type == CDK_BUTTON_PRESS)
2229 {
2230 if (event->button == CDK_BUTTON_PRIMARY(1))
2231 ctk_window_begin_resize_drag (CTK_WINDOW (ctk_widget_get_toplevel (area))((((CtkWindow*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((ctk_widget_get_toplevel (area))), ((ctk_window_get_type (
)))))))
, edge,
2232 event->button, event->x_root, event->y_root,
2233 event->time);
2234 else if (event->button == CDK_BUTTON_MIDDLE(2))
2235 ctk_window_begin_move_drag (CTK_WINDOW (ctk_widget_get_toplevel (area))((((CtkWindow*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((ctk_widget_get_toplevel (area))), ((ctk_window_get_type (
)))))))
,
2236 event->button, event->x_root, event->y_root,
2237 event->time);
2238 }
2239 return TRUE(!(0));
2240}
2241
2242static gboolean
2243grippy_draw (CtkWidget *area, cairo_t *cr, CdkWindowEdge edge)
2244{
2245 CtkStyleContext *context;
2246 CtkJunctionSides sides;
2247
2248 switch (edge)
2249 {
2250 case CDK_WINDOW_EDGE_NORTH_WEST:
2251 sides = CTK_JUNCTION_CORNER_TOPLEFT;
2252 break;
2253 case CDK_WINDOW_EDGE_NORTH:
2254 sides = CTK_JUNCTION_TOP;
2255 break;
2256 case CDK_WINDOW_EDGE_NORTH_EAST:
2257 sides = CTK_JUNCTION_CORNER_TOPRIGHT;
2258 break;
2259 case CDK_WINDOW_EDGE_WEST:
2260 sides = CTK_JUNCTION_LEFT;
2261 break;
2262 case CDK_WINDOW_EDGE_EAST:
2263 sides = CTK_JUNCTION_RIGHT;
2264 break;
2265 case CDK_WINDOW_EDGE_SOUTH_WEST:
2266 sides = CTK_JUNCTION_CORNER_BOTTOMLEFT;
2267 break;
2268 case CDK_WINDOW_EDGE_SOUTH:
2269 sides = CTK_JUNCTION_BOTTOM;
2270 break;
2271 case CDK_WINDOW_EDGE_SOUTH_EAST:
2272 sides = CTK_JUNCTION_CORNER_BOTTOMRIGHT;
2273 break;
2274 default:
2275 g_assert_not_reached()do { g_assertion_message_expr (((gchar*) 0), "testctk.c", 2275
, ((const char*) (__func__)), ((void*)0)); } while (0)
;
2276 }
2277
2278 context = ctk_widget_get_style_context (area);
2279 ctk_style_context_save (context);
2280 ctk_style_context_add_class (context, "grip");
2281 ctk_style_context_set_junction_sides (context, sides);
2282 ctk_render_handle (context, cr,
2283 0, 0,
2284 ctk_widget_get_allocated_width (area),
2285 ctk_widget_get_allocated_height (area));
2286
2287 ctk_style_context_restore (context);
2288
2289 return TRUE(!(0));
2290}
2291
2292static void
2293create_resize_grips (CtkWidget *widget)
2294{
2295 static CtkWidget *window = NULL((void*)0);
2296
2297 if (!window)
2298 {
2299 CtkWidget *area;
2300 CtkWidget *hbox, *vbox;
2301
2302 window = ctk_window_new (CTK_WINDOW_TOPLEVEL);
2303
2304 ctk_window_set_screen (CTK_WINDOW (window)((((CtkWindow*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((window)), ((ctk_window_get_type ()))))))
,
2305 ctk_widget_get_screen (widget));
2306
2307 ctk_window_set_title (CTK_WINDOW (window)((((CtkWindow*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((window)), ((ctk_window_get_type ()))))))
, "resize grips");
2308
2309 g_signal_connect (window, "destroy",g_signal_connect_data ((window), ("destroy"), (((GCallback) (
ctk_widget_destroyed))), (&window), ((void*)0), (GConnectFlags
) 0)
2310 G_CALLBACK (ctk_widget_destroyed),g_signal_connect_data ((window), ("destroy"), (((GCallback) (
ctk_widget_destroyed))), (&window), ((void*)0), (GConnectFlags
) 0)
2311 &window)g_signal_connect_data ((window), ("destroy"), (((GCallback) (
ctk_widget_destroyed))), (&window), ((void*)0), (GConnectFlags
) 0)
;
2312
2313 vbox = ctk_box_new (CTK_ORIENTATION_VERTICAL, 0);
2314 ctk_container_add (CTK_CONTAINER (window)((((CtkContainer*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((window)), ((ctk_container_get_type ()))))))
, vbox);
2315
2316 hbox = ctk_box_new (CTK_ORIENTATION_HORIZONTAL, 0);
2317 ctk_box_pack_start (CTK_BOX (vbox)((((CtkBox*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((vbox)), ((ctk_box_get_type ()))))))
, hbox, TRUE(!(0)), TRUE(!(0)), 0);
2318
2319 /* North west */
2320 area = ctk_drawing_area_new ();
2321 ctk_widget_add_events (area, CDK_BUTTON_PRESS_MASK);
2322 ctk_box_pack_start (CTK_BOX (hbox)((((CtkBox*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((hbox)), ((ctk_box_get_type ()))))))
, area, TRUE(!(0)), TRUE(!(0)), 0);
2323 g_signal_connect (area, "draw", G_CALLBACK (grippy_draw),g_signal_connect_data ((area), ("draw"), (((GCallback) (grippy_draw
))), (((gpointer) (glong) (CDK_WINDOW_EDGE_NORTH_WEST))), ((void
*)0), (GConnectFlags) 0)
2324 GINT_TO_POINTER (CDK_WINDOW_EDGE_NORTH_WEST))g_signal_connect_data ((area), ("draw"), (((GCallback) (grippy_draw
))), (((gpointer) (glong) (CDK_WINDOW_EDGE_NORTH_WEST))), ((void
*)0), (GConnectFlags) 0)
;
2325 g_signal_connect (area, "button_press_event", G_CALLBACK (grippy_button_press),g_signal_connect_data ((area), ("button_press_event"), (((GCallback
) (grippy_button_press))), (((gpointer) (glong) (CDK_WINDOW_EDGE_NORTH_WEST
))), ((void*)0), (GConnectFlags) 0)
2326 GINT_TO_POINTER (CDK_WINDOW_EDGE_NORTH_WEST))g_signal_connect_data ((area), ("button_press_event"), (((GCallback
) (grippy_button_press))), (((gpointer) (glong) (CDK_WINDOW_EDGE_NORTH_WEST
))), ((void*)0), (GConnectFlags) 0)
;
2327
2328 /* North */
2329 area = ctk_drawing_area_new ();
2330 ctk_widget_add_events (area, CDK_BUTTON_PRESS_MASK);
2331 ctk_box_pack_start (CTK_BOX (hbox)((((CtkBox*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((hbox)), ((ctk_box_get_type ()))))))
, area, TRUE(!(0)), TRUE(!(0)), 0);
2332 g_signal_connect (area, "draw", G_CALLBACK (grippy_draw),g_signal_connect_data ((area), ("draw"), (((GCallback) (grippy_draw
))), (((gpointer) (glong) (CDK_WINDOW_EDGE_NORTH))), ((void*)
0), (GConnectFlags) 0)
2333 GINT_TO_POINTER (CDK_WINDOW_EDGE_NORTH))g_signal_connect_data ((area), ("draw"), (((GCallback) (grippy_draw
))), (((gpointer) (glong) (CDK_WINDOW_EDGE_NORTH))), ((void*)
0), (GConnectFlags) 0)
;
2334 g_signal_connect (area, "button_press_event", G_CALLBACK (grippy_button_press),g_signal_connect_data ((area), ("button_press_event"), (((GCallback
) (grippy_button_press))), (((gpointer) (glong) (CDK_WINDOW_EDGE_NORTH
))), ((void*)0), (GConnectFlags) 0)
2335 GINT_TO_POINTER (CDK_WINDOW_EDGE_NORTH))g_signal_connect_data ((area), ("button_press_event"), (((GCallback
) (grippy_button_press))), (((gpointer) (glong) (CDK_WINDOW_EDGE_NORTH
))), ((void*)0), (GConnectFlags) 0)
;
2336
2337 /* North east */
2338 area = ctk_drawing_area_new ();
2339 ctk_widget_add_events (area, CDK_BUTTON_PRESS_MASK);
2340 ctk_box_pack_start (CTK_BOX (hbox)((((CtkBox*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((hbox)), ((ctk_box_get_type ()))))))
, area, TRUE(!(0)), TRUE(!(0)), 0);
2341 g_signal_connect (area, "draw", G_CALLBACK (grippy_draw),g_signal_connect_data ((area), ("draw"), (((GCallback) (grippy_draw
))), (((gpointer) (glong) (CDK_WINDOW_EDGE_NORTH_EAST))), ((void
*)0), (GConnectFlags) 0)
2342 GINT_TO_POINTER (CDK_WINDOW_EDGE_NORTH_EAST))g_signal_connect_data ((area), ("draw"), (((GCallback) (grippy_draw
))), (((gpointer) (glong) (CDK_WINDOW_EDGE_NORTH_EAST))), ((void
*)0), (GConnectFlags) 0)
;
2343 g_signal_connect (area, "button_press_event", G_CALLBACK (grippy_button_press),g_signal_connect_data ((area), ("button_press_event"), (((GCallback
) (grippy_button_press))), (((gpointer) (glong) (CDK_WINDOW_EDGE_NORTH_EAST
))), ((void*)0), (GConnectFlags) 0)
2344 GINT_TO_POINTER (CDK_WINDOW_EDGE_NORTH_EAST))g_signal_connect_data ((area), ("button_press_event"), (((GCallback
) (grippy_button_press))), (((gpointer) (glong) (CDK_WINDOW_EDGE_NORTH_EAST
))), ((void*)0), (GConnectFlags) 0)
;
2345
2346 hbox = ctk_box_new (CTK_ORIENTATION_HORIZONTAL, 0);
2347 ctk_box_pack_start (CTK_BOX (vbox)((((CtkBox*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((vbox)), ((ctk_box_get_type ()))))))
, hbox, TRUE(!(0)), TRUE(!(0)), 0);
2348
2349 /* West */
2350 area = ctk_drawing_area_new ();
2351 ctk_widget_add_events (area, CDK_BUTTON_PRESS_MASK);
2352 ctk_box_pack_start (CTK_BOX (hbox)((((CtkBox*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((hbox)), ((ctk_box_get_type ()))))))
, area, TRUE(!(0)), TRUE(!(0)), 0);
2353 g_signal_connect (area, "draw", G_CALLBACK (grippy_draw),g_signal_connect_data ((area), ("draw"), (((GCallback) (grippy_draw
))), (((gpointer) (glong) (CDK_WINDOW_EDGE_WEST))), ((void*)0
), (GConnectFlags) 0)
2354 GINT_TO_POINTER (CDK_WINDOW_EDGE_WEST))g_signal_connect_data ((area), ("draw"), (((GCallback) (grippy_draw
))), (((gpointer) (glong) (CDK_WINDOW_EDGE_WEST))), ((void*)0
), (GConnectFlags) 0)
;
2355 g_signal_connect (area, "button_press_event", G_CALLBACK (grippy_button_press),g_signal_connect_data ((area), ("button_press_event"), (((GCallback
) (grippy_button_press))), (((gpointer) (glong) (CDK_WINDOW_EDGE_WEST
))), ((void*)0), (GConnectFlags) 0)
2356 GINT_TO_POINTER (CDK_WINDOW_EDGE_WEST))g_signal_connect_data ((area), ("button_press_event"), (((GCallback
) (grippy_button_press))), (((gpointer) (glong) (CDK_WINDOW_EDGE_WEST
))), ((void*)0), (GConnectFlags) 0)
;
2357
2358 /* Middle */
2359 area = ctk_drawing_area_new ();
2360 ctk_box_pack_start (CTK_BOX (hbox)((((CtkBox*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((hbox)), ((ctk_box_get_type ()))))))
, area, TRUE(!(0)), TRUE(!(0)), 0);
2361
2362 /* East */
2363 area = ctk_drawing_area_new ();
2364 ctk_widget_add_events (area, CDK_BUTTON_PRESS_MASK);
2365 ctk_box_pack_start (CTK_BOX (hbox)((((CtkBox*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((hbox)), ((ctk_box_get_type ()))))))
, area, TRUE(!(0)), TRUE(!(0)), 0);
2366 g_signal_connect (area, "draw", G_CALLBACK (grippy_draw),g_signal_connect_data ((area), ("draw"), (((GCallback) (grippy_draw
))), (((gpointer) (glong) (CDK_WINDOW_EDGE_EAST))), ((void*)0
), (GConnectFlags) 0)
2367 GINT_TO_POINTER (CDK_WINDOW_EDGE_EAST))g_signal_connect_data ((area), ("draw"), (((GCallback) (grippy_draw
))), (((gpointer) (glong) (CDK_WINDOW_EDGE_EAST))), ((void*)0
), (GConnectFlags) 0)
;
2368 g_signal_connect (area, "button_press_event", G_CALLBACK (grippy_button_press),g_signal_connect_data ((area), ("button_press_event"), (((GCallback
) (grippy_button_press))), (((gpointer) (glong) (CDK_WINDOW_EDGE_EAST
))), ((void*)0), (GConnectFlags) 0)
2369 GINT_TO_POINTER (CDK_WINDOW_EDGE_EAST))g_signal_connect_data ((area), ("button_press_event"), (((GCallback
) (grippy_button_press))), (((gpointer) (glong) (CDK_WINDOW_EDGE_EAST
))), ((void*)0), (GConnectFlags) 0)
;
2370
2371
2372 hbox = ctk_box_new (CTK_ORIENTATION_HORIZONTAL, 0);
2373 ctk_box_pack_start (CTK_BOX (vbox)((((CtkBox*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((vbox)), ((ctk_box_get_type ()))))))
, hbox, TRUE(!(0)), TRUE(!(0)), 0);
2374
2375 /* South west */
2376 area = ctk_drawing_area_new ();
2377 ctk_widget_add_events (area, CDK_BUTTON_PRESS_MASK);
2378 ctk_box_pack_start (CTK_BOX (hbox)((((CtkBox*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((hbox)), ((ctk_box_get_type ()))))))
, area, TRUE(!(0)), TRUE(!(0)), 0);
2379 g_signal_connect (area, "draw", G_CALLBACK (grippy_draw),g_signal_connect_data ((area), ("draw"), (((GCallback) (grippy_draw
))), (((gpointer) (glong) (CDK_WINDOW_EDGE_SOUTH_WEST))), ((void
*)0), (GConnectFlags) 0)
2380 GINT_TO_POINTER (CDK_WINDOW_EDGE_SOUTH_WEST))g_signal_connect_data ((area), ("draw"), (((GCallback) (grippy_draw
))), (((gpointer) (glong) (CDK_WINDOW_EDGE_SOUTH_WEST))), ((void
*)0), (GConnectFlags) 0)
;
2381 g_signal_connect (area, "button_press_event", G_CALLBACK (grippy_button_press),g_signal_connect_data ((area), ("button_press_event"), (((GCallback
) (grippy_button_press))), (((gpointer) (glong) (CDK_WINDOW_EDGE_SOUTH_WEST
))), ((void*)0), (GConnectFlags) 0)
2382 GINT_TO_POINTER (CDK_WINDOW_EDGE_SOUTH_WEST))g_signal_connect_data ((area), ("button_press_event"), (((GCallback
) (grippy_button_press))), (((gpointer) (glong) (CDK_WINDOW_EDGE_SOUTH_WEST
))), ((void*)0), (GConnectFlags) 0)
;
2383 /* South */
2384 area = ctk_drawing_area_new ();
2385 ctk_widget_add_events (area, CDK_BUTTON_PRESS_MASK);
2386 ctk_box_pack_start (CTK_BOX (hbox)((((CtkBox*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((hbox)), ((ctk_box_get_type ()))))))
, area, TRUE(!(0)), TRUE(!(0)), 0);
2387 g_signal_connect (area, "draw", G_CALLBACK (grippy_draw),g_signal_connect_data ((area), ("draw"), (((GCallback) (grippy_draw
))), (((gpointer) (glong) (CDK_WINDOW_EDGE_SOUTH))), ((void*)
0), (GConnectFlags) 0)
2388 GINT_TO_POINTER (CDK_WINDOW_EDGE_SOUTH))g_signal_connect_data ((area), ("draw"), (((GCallback) (grippy_draw
))), (((gpointer) (glong) (CDK_WINDOW_EDGE_SOUTH))), ((void*)
0), (GConnectFlags) 0)
;
2389 g_signal_connect (area, "button_press_event", G_CALLBACK (grippy_button_press),g_signal_connect_data ((area), ("button_press_event"), (((GCallback
) (grippy_button_press))), (((gpointer) (glong) (CDK_WINDOW_EDGE_SOUTH
))), ((void*)0), (GConnectFlags) 0)
2390 GINT_TO_POINTER (CDK_WINDOW_EDGE_SOUTH))g_signal_connect_data ((area), ("button_press_event"), (((GCallback
) (grippy_button_press))), (((gpointer) (glong) (CDK_WINDOW_EDGE_SOUTH
))), ((void*)0), (GConnectFlags) 0)
;
2391
2392 /* South east */
2393 area = ctk_drawing_area_new ();
2394 ctk_widget_add_events (area, CDK_BUTTON_PRESS_MASK);
2395 ctk_box_pack_start (CTK_BOX (hbox)((((CtkBox*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((hbox)), ((ctk_box_get_type ()))))))
, area, TRUE(!(0)), TRUE(!(0)), 0);
2396 g_signal_connect (area, "draw", G_CALLBACK (grippy_draw),g_signal_connect_data ((area), ("draw"), (((GCallback) (grippy_draw
))), (((gpointer) (glong) (CDK_WINDOW_EDGE_SOUTH_EAST))), ((void
*)0), (GConnectFlags) 0)
2397 GINT_TO_POINTER (CDK_WINDOW_EDGE_SOUTH_EAST))g_signal_connect_data ((area), ("draw"), (((GCallback) (grippy_draw
))), (((gpointer) (glong) (CDK_WINDOW_EDGE_SOUTH_EAST))), ((void
*)0), (GConnectFlags) 0)
;
2398 g_signal_connect (area, "button_press_event", G_CALLBACK (grippy_button_press),g_signal_connect_data ((area), ("button_press_event"), (((GCallback
) (grippy_button_press))), (((gpointer) (glong) (CDK_WINDOW_EDGE_SOUTH_EAST
))), ((void*)0), (GConnectFlags) 0)
2399 GINT_TO_POINTER (CDK_WINDOW_EDGE_SOUTH_EAST))g_signal_connect_data ((area), ("button_press_event"), (((GCallback
) (grippy_button_press))), (((gpointer) (glong) (CDK_WINDOW_EDGE_SOUTH_EAST
))), ((void*)0), (GConnectFlags) 0)
;
2400 }
2401
2402 if (!ctk_widget_get_visible (window))
2403 ctk_widget_show_all (window);
2404 else
2405 ctk_widget_destroy (window);
2406}
2407
2408/*
2409 * Saved Position
2410 */
2411gint upositionx = 0;
2412gint upositiony = 0;
2413
2414static gint
2415uposition_configure (CtkWidget *window)
2416{
2417 CtkLabel *lx;
2418 CtkLabel *ly;
2419 gchar buffer[64];
2420
2421 lx = g_object_get_data (G_OBJECT (window)((((GObject*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((window)), (((GType) ((20) << (2))))))))
, "x");
2422 ly = g_object_get_data (G_OBJECT (window)((((GObject*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((window)), (((GType) ((20) << (2))))))))
, "y");
2423
2424 cdk_window_get_root_origin (ctk_widget_get_window (window),
2425 &upositionx, &upositiony);
2426 sprintf (buffer, "%d", upositionx);
2427 ctk_label_set_text (lx, buffer);
2428 sprintf (buffer, "%d", upositiony);
2429 ctk_label_set_text (ly, buffer);
2430
2431 return FALSE(0);
2432}
2433
2434static void
2435uposition_stop_configure (CtkToggleButton *toggle,
2436 GObject *window)
2437{
2438 if (ctk_toggle_button_get_active (toggle))
2439 g_signal_handlers_block_by_func (window, G_CALLBACK (uposition_configure), NULL)g_signal_handlers_block_matched ((window), (GSignalMatchType)
(G_SIGNAL_MATCH_FUNC | G_SIGNAL_MATCH_DATA), 0, 0, ((void*)0
), (((GCallback) (uposition_configure))), (((void*)0)))
;
2440 else
2441 g_signal_handlers_unblock_by_func (window, G_CALLBACK (uposition_configure), NULL)g_signal_handlers_unblock_matched ((window), (GSignalMatchType
) (G_SIGNAL_MATCH_FUNC | G_SIGNAL_MATCH_DATA), 0, 0, ((void*)
0), (((GCallback) (uposition_configure))), (((void*)0)))
;
2442}
2443
2444static void
2445create_saved_position (CtkWidget *widget)
2446{
2447 static CtkWidget *window = NULL((void*)0);
2448
2449 if (!window)
2450 {
2451 CtkWidget *hbox;
2452 CtkWidget *main_vbox;
2453 CtkWidget *vbox;
2454 CtkWidget *x_label;
2455 CtkWidget *y_label;
2456 CtkWidget *button;
2457 CtkWidget *label;
2458 CtkWidget *any;
2459
2460 window = g_object_connect (g_object_new (CTK_TYPE_WINDOW(ctk_window_get_type ()),
2461 "type", CTK_WINDOW_TOPLEVEL,
2462 "title", "Saved Position",
2463 NULL((void*)0)),
2464 "signal::configure_event", uposition_configure, NULL((void*)0),
2465 NULL((void*)0));
2466
2467 ctk_window_move (CTK_WINDOW (window)((((CtkWindow*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((window)), ((ctk_window_get_type ()))))))
, upositionx, upositiony);
2468
2469 ctk_window_set_screen (CTK_WINDOW (window)((((CtkWindow*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((window)), ((ctk_window_get_type ()))))))
,
2470 ctk_widget_get_screen (widget));
2471
2472
2473 g_signal_connect (window, "destroy",g_signal_connect_data ((window), ("destroy"), (((GCallback) (
ctk_widget_destroyed))), (&window), ((void*)0), (GConnectFlags
) 0)
2474 G_CALLBACK (ctk_widget_destroyed),g_signal_connect_data ((window), ("destroy"), (((GCallback) (
ctk_widget_destroyed))), (&window), ((void*)0), (GConnectFlags
) 0)
2475 &window)g_signal_connect_data ((window), ("destroy"), (((GCallback) (
ctk_widget_destroyed))), (&window), ((void*)0), (GConnectFlags
) 0)
;
2476
2477 main_vbox = ctk_box_new (CTK_ORIENTATION_VERTICAL, 5);
2478 ctk_container_set_border_width (CTK_CONTAINER (main_vbox)((((CtkContainer*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((main_vbox)), ((ctk_container_get_type ()))))))
, 0);
2479 ctk_container_add (CTK_CONTAINER (window)((((CtkContainer*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((window)), ((ctk_container_get_type ()))))))
, main_vbox);
2480
2481 vbox =
2482 g_object_new (CTK_TYPE_BOX(ctk_box_get_type ()),
2483 "orientation", CTK_ORIENTATION_VERTICAL,
2484 "CtkBox::homogeneous", FALSE(0),
2485 "CtkBox::spacing", 5,
2486 "CtkContainer::border_width", 10,
2487 "CtkWidget::parent", main_vbox,
2488 "CtkWidget::visible", TRUE(!(0)),
2489 "child", g_object_connect (g_object_new (CTK_TYPE_TOGGLE_BUTTON(ctk_toggle_button_get_type ()),
2490 "label", "Stop Events",
2491 "active", FALSE(0),
2492 "visible", TRUE(!(0)),
2493 NULL((void*)0)),
2494 "signal::clicked", uposition_stop_configure, window,
2495 NULL((void*)0)),
2496 NULL((void*)0));
2497
2498 hbox = ctk_box_new (CTK_ORIENTATION_HORIZONTAL, 0);
2499 ctk_container_set_border_width (CTK_CONTAINER (hbox)((((CtkContainer*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((hbox)), ((ctk_container_get_type ()))))))
, 5);
2500 ctk_box_pack_start (CTK_BOX (vbox)((((CtkBox*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((vbox)), ((ctk_box_get_type ()))))))
, hbox, FALSE(0), TRUE(!(0)), 0);
2501
2502 label = ctk_label_new ("X Origin : ");
2503 ctk_widget_set_halign (label, CTK_ALIGN_START);
2504 ctk_widget_set_valign (label, CTK_ALIGN_CENTER);
2505 ctk_box_pack_start (CTK_BOX (hbox)((((CtkBox*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((hbox)), ((ctk_box_get_type ()))))))
, label, FALSE(0), TRUE(!(0)), 0);
2506
2507 x_label = ctk_label_new ("");
2508 ctk_box_pack_start (CTK_BOX (hbox)((((CtkBox*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((hbox)), ((ctk_box_get_type ()))))))
, x_label, TRUE(!(0)), TRUE(!(0)), 0);
2509 g_object_set_data (G_OBJECT (window)((((GObject*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((window)), (((GType) ((20) << (2))))))))
, "x", x_label);
2510
2511 hbox = ctk_box_new (CTK_ORIENTATION_HORIZONTAL, 0);
2512 ctk_container_set_border_width (CTK_CONTAINER (hbox)((((CtkContainer*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((hbox)), ((ctk_container_get_type ()))))))
, 5);
2513 ctk_box_pack_start (CTK_BOX (vbox)((((CtkBox*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((vbox)), ((ctk_box_get_type ()))))))
, hbox, FALSE(0), TRUE(!(0)), 0);
2514
2515 label = ctk_label_new ("Y Origin : ");
2516 ctk_widget_set_halign (label, CTK_ALIGN_START);
2517 ctk_widget_set_valign (label, CTK_ALIGN_CENTER);
2518 ctk_box_pack_start (CTK_BOX (hbox)((((CtkBox*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((hbox)), ((ctk_box_get_type ()))))))
, label, FALSE(0), TRUE(!(0)), 0);
2519
2520 y_label = ctk_label_new ("");
2521 ctk_box_pack_start (CTK_BOX (hbox)((((CtkBox*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((hbox)), ((ctk_box_get_type ()))))))
, y_label, TRUE(!(0)), TRUE(!(0)), 0);
2522 g_object_set_data (G_OBJECT (window)((((GObject*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((window)), (((GType) ((20) << (2))))))))
, "y", y_label);
2523
2524 any =
2525 g_object_new (ctk_separator_get_type (),
2526 "CtkWidget::visible", TRUE(!(0)),
2527 NULL((void*)0));
2528 ctk_box_pack_start (CTK_BOX (main_vbox)((((CtkBox*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((main_vbox)), ((ctk_box_get_type ()))))))
, any, FALSE(0), TRUE(!(0)), 0);
2529
2530 hbox = ctk_box_new (CTK_ORIENTATION_HORIZONTAL, 0);
2531 ctk_container_set_border_width (CTK_CONTAINER (hbox)((((CtkContainer*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((hbox)), ((ctk_container_get_type ()))))))
, 10);
2532 ctk_box_pack_start (CTK_BOX (main_vbox)((((CtkBox*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((main_vbox)), ((ctk_box_get_type ()))))))
, hbox, FALSE(0), TRUE(!(0)), 0);
2533
2534 button = ctk_button_new_with_label ("Close");
2535 g_signal_connect_swapped (button, "clicked",g_signal_connect_data ((button), ("clicked"), (((GCallback) (
ctk_widget_destroy))), (window), ((void*)0), G_CONNECT_SWAPPED
)
2536 G_CALLBACK (ctk_widget_destroy),g_signal_connect_data ((button), ("clicked"), (((GCallback) (
ctk_widget_destroy))), (window), ((void*)0), G_CONNECT_SWAPPED
)
2537 window)g_signal_connect_data ((button), ("clicked"), (((GCallback) (
ctk_widget_destroy))), (window), ((void*)0), G_CONNECT_SWAPPED
)
;
2538 ctk_box_pack_start (CTK_BOX (hbox)((((CtkBox*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((hbox)), ((ctk_box_get_type ()))))))
, button, TRUE(!(0)), TRUE(!(0)), 5);
2539 ctk_widget_set_can_default (button, TRUE(!(0)));
2540 ctk_widget_grab_default (button);
2541
2542 ctk_widget_show_all (window);
2543 }
2544 else
2545 ctk_widget_destroy (window);
2546}
2547
2548/*
2549 * CtkPixmap
2550 */
2551
2552static void
2553create_pixbuf (CtkWidget *widget)
2554{
2555 static CtkWidget *window = NULL((void*)0);
2556
2557 if (!window)
2558 {
2559 CtkWidget *box1;
2560 CtkWidget *box2;
2561 CtkWidget *box3;
2562 CtkWidget *button;
2563 CtkWidget *label;
2564 CtkWidget *separator;
2565 CtkWidget *pixbufwid;
2566 CdkWindow *cdk_window;
2567
2568 window = ctk_window_new (CTK_WINDOW_TOPLEVEL);
2569
2570 ctk_window_set_screen (CTK_WINDOW (window)((((CtkWindow*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((window)), ((ctk_window_get_type ()))))))
,
2571 ctk_widget_get_screen (widget));
2572
2573 g_signal_connect (window, "destroy",g_signal_connect_data ((window), ("destroy"), (((GCallback) (
ctk_widget_destroyed))), (&window), ((void*)0), (GConnectFlags
) 0)
2574 G_CALLBACK (ctk_widget_destroyed),g_signal_connect_data ((window), ("destroy"), (((GCallback) (
ctk_widget_destroyed))), (&window), ((void*)0), (GConnectFlags
) 0)
2575 &window)g_signal_connect_data ((window), ("destroy"), (((GCallback) (
ctk_widget_destroyed))), (&window), ((void*)0), (GConnectFlags
) 0)
;
2576
2577 ctk_window_set_title (CTK_WINDOW (window)((((CtkWindow*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((window)), ((ctk_window_get_type ()))))))
, "CtkPixmap");
2578 ctk_container_set_border_width (CTK_CONTAINER (window)((((CtkContainer*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((window)), ((ctk_container_get_type ()))))))
, 0);
2579 ctk_widget_realize(window);
2580
2581 box1 = ctk_box_new (CTK_ORIENTATION_VERTICAL, 0);
2582 ctk_container_add (CTK_CONTAINER (window)((((CtkContainer*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((window)), ((ctk_container_get_type ()))))))
, box1);
2583
2584 box2 = ctk_box_new (CTK_ORIENTATION_VERTICAL, 10);
2585 ctk_container_set_border_width (CTK_CONTAINER (box2)((((CtkContainer*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((box2)), ((ctk_container_get_type ()))))))
, 10);
2586 ctk_box_pack_start (CTK_BOX (box1)((((CtkBox*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((box1)), ((ctk_box_get_type ()))))))
, box2, TRUE(!(0)), TRUE(!(0)), 0);
2587
2588 button = ctk_button_new ();
2589 ctk_box_pack_start (CTK_BOX (box2)((((CtkBox*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((box2)), ((ctk_box_get_type ()))))))
, button, FALSE(0), FALSE(0), 0);
2590
2591 cdk_window = ctk_widget_get_window (window);
2592
2593 pixbufwid = new_pixbuf ("test.xpm", cdk_window);
2594
2595 label = ctk_label_new ("Pixbuf\ntest");
2596 box3 = ctk_box_new (CTK_ORIENTATION_HORIZONTAL, 0);
2597 ctk_container_set_border_width (CTK_CONTAINER (box3)((((CtkContainer*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((box3)), ((ctk_container_get_type ()))))))
, 2);
2598 ctk_container_add (CTK_CONTAINER (box3)((((CtkContainer*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((box3)), ((ctk_container_get_type ()))))))
, pixbufwid);
2599 ctk_container_add (CTK_CONTAINER (box3)((((CtkContainer*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((box3)), ((ctk_container_get_type ()))))))
, label);
2600 ctk_container_add (CTK_CONTAINER (button)((((CtkContainer*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((button)), ((ctk_container_get_type ()))))))
, box3);
2601
2602 button = ctk_button_new ();
2603 ctk_box_pack_start (CTK_BOX (box2)((((CtkBox*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((box2)), ((ctk_box_get_type ()))))))
, button, FALSE(0), FALSE(0), 0);
2604
2605 pixbufwid = new_pixbuf ("test.xpm", cdk_window);
2606
2607 label = ctk_label_new ("Pixbuf\ntest");
2608 box3 = ctk_box_new (CTK_ORIENTATION_HORIZONTAL, 0);
2609 ctk_container_set_border_width (CTK_CONTAINER (box3)((((CtkContainer*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((box3)), ((ctk_container_get_type ()))))))
, 2);
2610 ctk_container_add (CTK_CONTAINER (box3)((((CtkContainer*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((box3)), ((ctk_container_get_type ()))))))
, pixbufwid);
2611 ctk_container_add (CTK_CONTAINER (box3)((((CtkContainer*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((box3)), ((ctk_container_get_type ()))))))
, label);
2612 ctk_container_add (CTK_CONTAINER (button)((((CtkContainer*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((button)), ((ctk_container_get_type ()))))))
, box3);
2613
2614 ctk_widget_set_sensitive (button, FALSE(0));
2615
2616 separator = ctk_separator_new (CTK_ORIENTATION_HORIZONTAL);
2617 ctk_box_pack_start (CTK_BOX (box1)((((CtkBox*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((box1)), ((ctk_box_get_type ()))))))
, separator, FALSE(0), TRUE(!(0)), 0);
2618
2619 box2 = ctk_box_new (CTK_ORIENTATION_VERTICAL, 10);
2620 ctk_container_set_border_width (CTK_CONTAINER (box2)((((CtkContainer*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((box2)), ((ctk_container_get_type ()))))))
, 10);
2621 ctk_box_pack_start (CTK_BOX (box1)((((CtkBox*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((box1)), ((ctk_box_get_type ()))))))
, box2, FALSE(0), TRUE(!(0)), 0);
2622
2623 button = ctk_button_new_with_label ("close");
2624 g_signal_connect_swapped (button, "clicked",g_signal_connect_data ((button), ("clicked"), (((GCallback) (
ctk_widget_destroy))), (window), ((void*)0), G_CONNECT_SWAPPED
)
2625 G_CALLBACK (ctk_widget_destroy),g_signal_connect_data ((button), ("clicked"), (((GCallback) (
ctk_widget_destroy))), (window), ((void*)0), G_CONNECT_SWAPPED
)
2626 window)g_signal_connect_data ((button), ("clicked"), (((GCallback) (
ctk_widget_destroy))), (window), ((void*)0), G_CONNECT_SWAPPED
)
;
2627 ctk_box_pack_start (CTK_BOX (box2)((((CtkBox*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((box2)), ((ctk_box_get_type ()))))))
, button, TRUE(!(0)), TRUE(!(0)), 0);
2628 ctk_widget_set_can_default (button, TRUE(!(0)));
2629 ctk_widget_grab_default (button);
2630 }
2631
2632 if (!ctk_widget_get_visible (window))
2633 ctk_widget_show_all (window);
2634 else
2635 ctk_widget_destroy (window);
2636}
2637
2638static void
2639create_tooltips (CtkWidget *widget)
2640{
2641 static CtkWidget *window = NULL((void*)0);
2642
2643 if (!window)
2644 {
2645 CtkWidget *box1;
2646 CtkWidget *box2;
2647 CtkWidget *box3;
2648 CtkWidget *button;
2649 CtkWidget *toggle;
2650 CtkWidget *frame;
2651 CtkWidget *separator;
2652
2653 window =
2654 g_object_new (ctk_window_get_type (),
2655 "CtkWindow::type", CTK_WINDOW_TOPLEVEL,
2656 "CtkContainer::border_width", 0,
2657 "CtkWindow::title", "Tooltips",
2658 "CtkWindow::resizable", FALSE(0),
2659 NULL((void*)0));
2660
2661 ctk_window_set_screen (CTK_WINDOW (window)((((CtkWindow*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((window)), ((ctk_window_get_type ()))))))
,
2662 ctk_widget_get_screen (widget));
2663
2664 box1 = ctk_box_new (CTK_ORIENTATION_VERTICAL, 0);
2665 ctk_container_add (CTK_CONTAINER (window)((((CtkContainer*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((window)), ((ctk_container_get_type ()))))))
, box1);
2666
2667 box2 = ctk_box_new (CTK_ORIENTATION_VERTICAL, 10);
2668 ctk_container_set_border_width (CTK_CONTAINER (box2)((((CtkContainer*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((box2)), ((ctk_container_get_type ()))))))
, 10);
2669 ctk_box_pack_start (CTK_BOX (box1)((((CtkBox*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((box1)), ((ctk_box_get_type ()))))))
, box2, TRUE(!(0)), TRUE(!(0)), 0);
2670
2671 button = ctk_toggle_button_new_with_label ("button1");
2672 ctk_box_pack_start (CTK_BOX (box2)((((CtkBox*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((box2)), ((ctk_box_get_type ()))))))
, button, TRUE(!(0)), TRUE(!(0)), 0);
2673
2674 ctk_widget_set_tooltip_text (button, "This is button 1");
2675
2676 button = ctk_toggle_button_new_with_label ("button2");
2677 ctk_box_pack_start (CTK_BOX (box2)((((CtkBox*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((box2)), ((ctk_box_get_type ()))))))
, button, TRUE(!(0)), TRUE(!(0)), 0);
2678
2679 ctk_widget_set_tooltip_text (button,
2680 "This is button 2. This is also a really long tooltip which probably "
2681 "won't fit on a single line and will therefore need to be wrapped. "
2682 "Hopefully the wrapping will work correctly.");
2683
2684 toggle = ctk_toggle_button_new_with_label ("Override TipsQuery Label");
2685 ctk_box_pack_start (CTK_BOX (box2)((((CtkBox*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((box2)), ((ctk_box_get_type ()))))))
, toggle, TRUE(!(0)), TRUE(!(0)), 0);
2686
2687 ctk_widget_set_tooltip_text (toggle, "Toggle TipsQuery view.");
2688
2689 box3 =
2690 g_object_new (CTK_TYPE_BOX(ctk_box_get_type ()),
2691 "orientation", CTK_ORIENTATION_VERTICAL,
2692 "homogeneous", FALSE(0),
2693 "spacing", 5,
2694 "border_width", 5,
2695 "visible", TRUE(!(0)),
2696 NULL((void*)0));
2697
2698 button =
2699 g_object_new (ctk_button_get_type (),
2700 "label", "[?]",
2701 "visible", TRUE(!(0)),
2702 "parent", box3,
2703 NULL((void*)0));
2704 ctk_box_set_child_packing (CTK_BOX (box3)((((CtkBox*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((box3)), ((ctk_box_get_type ()))))))
, button, FALSE(0), FALSE(0), 0, CTK_PACK_START);
2705 ctk_widget_set_tooltip_text (button, "Start the Tooltips Inspector");
2706
2707 frame = g_object_new (ctk_frame_get_type (),
2708 "label", "ToolTips Inspector",
2709 "label_xalign", (double) 0.5,
2710 "border_width", 0,
2711 "visible", TRUE(!(0)),
2712 "parent", box2,
2713 "child", box3,
2714 NULL((void*)0));
2715 ctk_box_set_child_packing (CTK_BOX (box2)((((CtkBox*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((box2)), ((ctk_box_get_type ()))))))
, frame, TRUE(!(0)), TRUE(!(0)), 10, CTK_PACK_START);
2716
2717 separator = ctk_separator_new (CTK_ORIENTATION_HORIZONTAL);
2718 ctk_box_pack_start (CTK_BOX (box1)((((CtkBox*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((box1)), ((ctk_box_get_type ()))))))
, separator, FALSE(0), TRUE(!(0)), 0);
2719
2720 box2 = ctk_box_new (CTK_ORIENTATION_VERTICAL, 10);
2721 ctk_container_set_border_width (CTK_CONTAINER (box2)((((CtkContainer*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((box2)), ((ctk_container_get_type ()))))))
, 10);
2722 ctk_box_pack_start (CTK_BOX (box1)((((CtkBox*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((box1)), ((ctk_box_get_type ()))))))
, box2, FALSE(0), TRUE(!(0)), 0);
2723
2724 button = ctk_button_new_with_label ("close");
2725 g_signal_connect_swapped (button, "clicked",g_signal_connect_data ((button), ("clicked"), (((GCallback) (
ctk_widget_destroy))), (window), ((void*)0), G_CONNECT_SWAPPED
)
2726 G_CALLBACK (ctk_widget_destroy),g_signal_connect_data ((button), ("clicked"), (((GCallback) (
ctk_widget_destroy))), (window), ((void*)0), G_CONNECT_SWAPPED
)
2727 window)g_signal_connect_data ((button), ("clicked"), (((GCallback) (
ctk_widget_destroy))), (window), ((void*)0), G_CONNECT_SWAPPED
)
;
2728 ctk_box_pack_start (CTK_BOX (box2)((((CtkBox*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((box2)), ((ctk_box_get_type ()))))))
, button, TRUE(!(0)), TRUE(!(0)), 0);
2729 ctk_widget_set_can_default (button, TRUE(!(0)));
2730 ctk_widget_grab_default (button);
2731
2732 ctk_widget_set_tooltip_text (button, "Push this button to close window");
2733 }
2734
2735 if (!ctk_widget_get_visible (window))
2736 ctk_widget_show_all (window);
2737 else
2738 ctk_widget_destroy (window);
2739}
2740
2741/*
2742 * CtkImage
2743 */
2744
2745static void
2746pack_image (CtkWidget *box,
2747 const gchar *text,
2748 CtkWidget *image)
2749{
2750 ctk_box_pack_start (CTK_BOX (box)((((CtkBox*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((box)), ((ctk_box_get_type ()))))))
,
2751 ctk_label_new (text),
2752 FALSE(0), FALSE(0), 0);
2753
2754 ctk_box_pack_start (CTK_BOX (box)((((CtkBox*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((box)), ((ctk_box_get_type ()))))))
,
2755 image,
2756 TRUE(!(0)), TRUE(!(0)), 0);
2757}
2758
2759static void
2760create_image (CtkWidget *widget)
2761{
2762 static CtkWidget *window = NULL((void*)0);
2763
2764 if (window == NULL((void*)0))
2765 {
2766 CtkWidget *vbox;
2767 GdkPixbuf *pixbuf;
2768
2769 window = ctk_window_new (CTK_WINDOW_TOPLEVEL);
2770
2771 ctk_window_set_screen (CTK_WINDOW (window)((((CtkWindow*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((window)), ((ctk_window_get_type ()))))))
,
2772 ctk_widget_get_screen (widget));
2773
2774 /* this is bogus for testing drawing when allocation < request,
2775 * don't copy into real code
2776 */
2777 ctk_window_set_resizable (CTK_WINDOW (window)((((CtkWindow*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((window)), ((ctk_window_get_type ()))))))
, TRUE(!(0)));
2778
2779 g_signal_connect (window, "destroy",g_signal_connect_data ((window), ("destroy"), (((GCallback) (
ctk_widget_destroyed))), (&window), ((void*)0), (GConnectFlags
) 0)
2780 G_CALLBACK (ctk_widget_destroyed),g_signal_connect_data ((window), ("destroy"), (((GCallback) (
ctk_widget_destroyed))), (&window), ((void*)0), (GConnectFlags
) 0)
2781 &window)g_signal_connect_data ((window), ("destroy"), (((GCallback) (
ctk_widget_destroyed))), (&window), ((void*)0), (GConnectFlags
) 0)
;
2782
2783 vbox = ctk_box_new (CTK_ORIENTATION_VERTICAL, 5);
2784
2785 ctk_container_add (CTK_CONTAINER (window)((((CtkContainer*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((window)), ((ctk_container_get_type ()))))))
, vbox);
2786
2787 pack_image (vbox, "Stock Warning Dialog",
2788 ctk_image_new_from_icon_name ("dialog-warning",
2789 CTK_ICON_SIZE_DIALOG));
2790
2791 pixbuf = gdk_pixbuf_new_from_xpm_data ((const char **) openfile);
2792
2793 pack_image (vbox, "Pixbuf",
2794 ctk_image_new_from_pixbuf (pixbuf));
2795
2796 g_object_unref (pixbuf);
2797 }
2798
2799 if (!ctk_widget_get_visible (window))
2800 ctk_widget_show_all (window);
2801 else
2802 ctk_widget_destroy (window);
2803}
2804
2805/*
2806 * ListBox demo
2807 */
2808
2809static int
2810list_sort_cb (CtkListBoxRow *a,
2811 CtkListBoxRow *b,
2812 gpointer data G_GNUC_UNUSED__attribute__ ((__unused__)))
2813{
2814 gint aa = GPOINTER_TO_INT (g_object_get_data (G_OBJECT (a), "value"))((gint) (glong) (g_object_get_data (((((GObject*) (void *) g_type_check_instance_cast
((GTypeInstance*) ((a)), (((GType) ((20) << (2))))))))
, "value")))
;
2815 gint bb = GPOINTER_TO_INT (g_object_get_data (G_OBJECT (b), "value"))((gint) (glong) (g_object_get_data (((((GObject*) (void *) g_type_check_instance_cast
((GTypeInstance*) ((b)), (((GType) ((20) << (2))))))))
, "value")))
;
2816 return aa - bb;
2817}
2818
2819static gboolean
2820list_filter_all_cb (CtkListBoxRow *row G_GNUC_UNUSED__attribute__ ((__unused__)),
2821 gpointer data G_GNUC_UNUSED__attribute__ ((__unused__)))
2822{
2823 return FALSE(0);
2824}
2825
2826static gboolean
2827list_filter_odd_cb (CtkListBoxRow *row,
2828 gpointer data G_GNUC_UNUSED__attribute__ ((__unused__)))
2829{
2830 gint value = GPOINTER_TO_INT (g_object_get_data (G_OBJECT (row), "value"))((gint) (glong) (g_object_get_data (((((GObject*) (void *) g_type_check_instance_cast
((GTypeInstance*) ((row)), (((GType) ((20) << (2))))))
)), "value")))
;
2831
2832 return value % 2 == 0;
2833}
2834
2835static void
2836list_sort_clicked_cb (CtkButton *button G_GNUC_UNUSED__attribute__ ((__unused__)),
2837 gpointer data)
2838{
2839 CtkListBox *list = data;
2840
2841 ctk_list_box_set_sort_func (list, list_sort_cb, NULL((void*)0), NULL((void*)0));
2842}
2843
2844static void
2845list_filter_odd_clicked_cb (CtkButton *button G_GNUC_UNUSED__attribute__ ((__unused__)),
2846 gpointer data)
2847{
2848 CtkListBox *list = data;
2849
2850 ctk_list_box_set_filter_func (list, list_filter_odd_cb, NULL((void*)0), NULL((void*)0));
2851}
2852
2853static void
2854list_filter_all_clicked_cb (CtkButton *button G_GNUC_UNUSED__attribute__ ((__unused__)),
2855 gpointer data)
2856{
2857 CtkListBox *list = data;
2858
2859 ctk_list_box_set_filter_func (list, list_filter_all_cb, NULL((void*)0), NULL((void*)0));
2860}
2861
2862
2863static void
2864list_unfilter_clicked_cb (CtkButton *button G_GNUC_UNUSED__attribute__ ((__unused__)),
2865 gpointer data)
2866{
2867 CtkListBox *list = data;
2868
2869 ctk_list_box_set_filter_func (list, NULL((void*)0), NULL((void*)0), NULL((void*)0));
2870}
2871
2872static void
2873add_placeholder_clicked_cb (CtkButton *button G_GNUC_UNUSED__attribute__ ((__unused__)),
2874 gpointer data)
2875{
2876 CtkListBox *list = data;
2877 CtkWidget *label;
2878
2879 label = ctk_label_new ("You filtered everything!!!");
2880 ctk_widget_show (label);
2881 ctk_list_box_set_placeholder (CTK_LIST_BOX (list)((((CtkListBox*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((list)), ((ctk_list_box_get_type ()))))))
, label);
2882}
2883
2884static void
2885remove_placeholder_clicked_cb (CtkButton *button G_GNUC_UNUSED__attribute__ ((__unused__)),
2886 gpointer data)
2887{
2888 CtkListBox *list = data;
2889
2890 ctk_list_box_set_placeholder (CTK_LIST_BOX (list)((((CtkListBox*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((list)), ((ctk_list_box_get_type ()))))))
, NULL((void*)0));
2891}
2892
2893
2894static void
2895create_listbox (CtkWidget *widget)
2896{
2897 static CtkWidget *window = NULL((void*)0);
2898
2899 if (!window)
2900 {
2901 CtkWidget *hbox, *vbox, *scrolled, *scrolled_box, *list, *label, *button;
2902 CdkScreen *screen = ctk_widget_get_screen (widget);
2903 int i;
2904
2905 window = ctk_window_new (CTK_WINDOW_TOPLEVEL);
2906 ctk_window_set_screen (CTK_WINDOW (window)((((CtkWindow*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((window)), ((ctk_window_get_type ()))))))
, screen);
2907
2908 g_signal_connect (window, "destroy",g_signal_connect_data ((window), ("destroy"), (((GCallback) (
ctk_widget_destroyed))), (&window), ((void*)0), (GConnectFlags
) 0)
2909 G_CALLBACK (ctk_widget_destroyed),g_signal_connect_data ((window), ("destroy"), (((GCallback) (
ctk_widget_destroyed))), (&window), ((void*)0), (GConnectFlags
) 0)
2910 &window)g_signal_connect_data ((window), ("destroy"), (((GCallback) (
ctk_widget_destroyed))), (&window), ((void*)0), (GConnectFlags
) 0)
;
2911 g_signal_connect (window, "delete-event",g_signal_connect_data ((window), ("delete-event"), (((GCallback
) (ctk_true))), (((void*)0)), ((void*)0), (GConnectFlags) 0)
2912 G_CALLBACK (ctk_true),g_signal_connect_data ((window), ("delete-event"), (((GCallback
) (ctk_true))), (((void*)0)), ((void*)0), (GConnectFlags) 0)
2913 NULL)g_signal_connect_data ((window), ("delete-event"), (((GCallback
) (ctk_true))), (((void*)0)), ((void*)0), (GConnectFlags) 0)
;
2914
2915 ctk_window_set_title (CTK_WINDOW (window)((((CtkWindow*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((window)), ((ctk_window_get_type ()))))))
, "listbox");
2916
2917 hbox = ctk_box_new(CTK_ORIENTATION_HORIZONTAL, 0);
2918 ctk_container_add (CTK_CONTAINER (window)((((CtkContainer*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((window)), ((ctk_container_get_type ()))))))
, hbox);
2919
2920 scrolled = ctk_scrolled_window_new (NULL((void*)0), NULL((void*)0));
2921 ctk_scrolled_window_set_policy (CTK_SCROLLED_WINDOW (scrolled)((((CtkScrolledWindow*) (void *) g_type_check_instance_cast (
(GTypeInstance*) ((scrolled)), ((ctk_scrolled_window_get_type
()))))))
, CTK_POLICY_NEVER, CTK_POLICY_AUTOMATIC);
2922 ctk_container_add (CTK_CONTAINER (hbox)((((CtkContainer*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((hbox)), ((ctk_container_get_type ()))))))
, scrolled);
2923
2924 scrolled_box = ctk_box_new (CTK_ORIENTATION_VERTICAL, 0);
2925 ctk_container_add (CTK_CONTAINER (scrolled)((((CtkContainer*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((scrolled)), ((ctk_container_get_type ()))))))
, scrolled_box);
2926
2927 label = ctk_label_new ("This is \na LABEL\nwith rows");
2928 ctk_container_add (CTK_CONTAINER (scrolled_box)((((CtkContainer*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((scrolled_box)), ((ctk_container_get_type ()))))))
, label);
2929
2930 list = ctk_list_box_new();
2931 ctk_list_box_set_adjustment (CTK_LIST_BOX (list)((((CtkListBox*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((list)), ((ctk_list_box_get_type ()))))))
, ctk_scrolled_window_get_vadjustment (CTK_SCROLLED_WINDOW (scrolled)((((CtkScrolledWindow*) (void *) g_type_check_instance_cast (
(GTypeInstance*) ((scrolled)), ((ctk_scrolled_window_get_type
()))))))
));
2932 ctk_container_add (CTK_CONTAINER (scrolled_box)((((CtkContainer*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((scrolled_box)), ((ctk_container_get_type ()))))))
, list);
2933
2934 for (i = 0; i < 1000; i++)
2935 {
2936 gint value = g_random_int_range (0, 10000);
2937 label = ctk_label_new (g_strdup_printf ("Value %u", value));
2938 ctk_widget_show (label);
2939 ctk_container_add (CTK_CONTAINER (list)((((CtkContainer*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((list)), ((ctk_container_get_type ()))))))
, label);
2940 g_object_set_data (G_OBJECT (ctk_widget_get_parent (label))((((GObject*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((ctk_widget_get_parent (label))), (((GType) ((20) <<
(2))))))))
, "value", GINT_TO_POINTER (value)((gpointer) (glong) (value)));
2941 }
2942
2943 vbox = ctk_box_new (CTK_ORIENTATION_VERTICAL, 0);
2944 ctk_container_add (CTK_CONTAINER (hbox)((((CtkContainer*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((hbox)), ((ctk_container_get_type ()))))))
, vbox);
2945
2946 button = ctk_button_new_with_label ("sort");
2947 ctk_container_add (CTK_CONTAINER (vbox)((((CtkContainer*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((vbox)), ((ctk_container_get_type ()))))))
, button);
2948 g_signal_connect (button, "clicked", G_CALLBACK (list_sort_clicked_cb), list)g_signal_connect_data ((button), ("clicked"), (((GCallback) (
list_sort_clicked_cb))), (list), ((void*)0), (GConnectFlags) 0
)
;
2949
2950 button = ctk_button_new_with_label ("filter odd");
2951 ctk_container_add (CTK_CONTAINER (vbox)((((CtkContainer*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((vbox)), ((ctk_container_get_type ()))))))
, button);
2952 g_signal_connect (button, "clicked", G_CALLBACK (list_filter_odd_clicked_cb), list)g_signal_connect_data ((button), ("clicked"), (((GCallback) (
list_filter_odd_clicked_cb))), (list), ((void*)0), (GConnectFlags
) 0)
;
2953
2954 button = ctk_button_new_with_label ("filter all");
2955 ctk_container_add (CTK_CONTAINER (vbox)((((CtkContainer*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((vbox)), ((ctk_container_get_type ()))))))
, button);
2956 g_signal_connect (button, "clicked", G_CALLBACK (list_filter_all_clicked_cb), list)g_signal_connect_data ((button), ("clicked"), (((GCallback) (
list_filter_all_clicked_cb))), (list), ((void*)0), (GConnectFlags
) 0)
;
2957
2958 button = ctk_button_new_with_label ("unfilter");
2959 ctk_container_add (CTK_CONTAINER (vbox)((((CtkContainer*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((vbox)), ((ctk_container_get_type ()))))))
, button);
2960 g_signal_connect (button, "clicked", G_CALLBACK (list_unfilter_clicked_cb), list)g_signal_connect_data ((button), ("clicked"), (((GCallback) (
list_unfilter_clicked_cb))), (list), ((void*)0), (GConnectFlags
) 0)
;
2961
2962 button = ctk_button_new_with_label ("add placeholder");
2963 ctk_container_add (CTK_CONTAINER (vbox)((((CtkContainer*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((vbox)), ((ctk_container_get_type ()))))))
, button);
2964 g_signal_connect (button, "clicked", G_CALLBACK (add_placeholder_clicked_cb), list)g_signal_connect_data ((button), ("clicked"), (((GCallback) (
add_placeholder_clicked_cb))), (list), ((void*)0), (GConnectFlags
) 0)
;
2965
2966 button = ctk_button_new_with_label ("remove placeholder");
2967 ctk_container_add (CTK_CONTAINER (vbox)((((CtkContainer*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((vbox)), ((ctk_container_get_type ()))))))
, button);
2968 g_signal_connect (button, "clicked", G_CALLBACK (remove_placeholder_clicked_cb), list)g_signal_connect_data ((button), ("clicked"), (((GCallback) (
remove_placeholder_clicked_cb))), (list), ((void*)0), (GConnectFlags
) 0)
;
2969 }
2970
2971 if (!ctk_widget_get_visible (window))
2972 ctk_widget_show_all (window);
2973 else
2974 ctk_widget_destroy (window);
2975}
2976
2977
2978/*
2979 * Menu demo
2980 */
2981
2982static CtkWidget*
2983create_menu (CdkScreen *screen, gint depth, gint length)
2984{
2985 CtkWidget *menu;
2986 CtkWidget *menuitem;
2987 CtkWidget *image;
2988 GSList *group;
2989 char buf[32];
2990 int i, j;
2991
2992 if (depth < 1)
2993 return NULL((void*)0);
2994
2995 menu = ctk_menu_new ();
2996 ctk_menu_set_screen (CTK_MENU (menu)((((CtkMenu*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((menu)), ((ctk_menu_get_type ()))))))
, screen);
2997
2998 group = NULL((void*)0);
2999
3000 image = ctk_image_new_from_icon_name ("document-open",
3001 CTK_ICON_SIZE_MENU);
3002 ctk_widget_show (image);
3003
3004 menuitem = ctk_image_menu_item_new_with_label ("Image item");
3005 ctk_image_menu_item_set_image (CTK_IMAGE_MENU_ITEM (menuitem)((((CtkImageMenuItem*) (void *) g_type_check_instance_cast ((
GTypeInstance*) ((menuitem)), ((ctk_image_menu_item_get_type (
)))))))
, image);
3006 ctk_image_menu_item_set_always_show_image (CTK_IMAGE_MENU_ITEM (menuitem)((((CtkImageMenuItem*) (void *) g_type_check_instance_cast ((
GTypeInstance*) ((menuitem)), ((ctk_image_menu_item_get_type (
)))))))
, TRUE(!(0)));
3007
3008 ctk_menu_shell_append (CTK_MENU_SHELL (menu)((((CtkMenuShell*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((menu)), ((ctk_menu_shell_get_type ()))))))
, menuitem);
3009 ctk_widget_show (menuitem);
3010
3011 for (i = 0, j = 1; i < length; i++, j++)
3012 {
3013 sprintf (buf, "item %2d - %d", depth, j);
3014
3015 menuitem = ctk_radio_menu_item_new_with_label (group, buf);
3016 group = ctk_radio_menu_item_get_group (CTK_RADIO_MENU_ITEM (menuitem)((((CtkRadioMenuItem*) (void *) g_type_check_instance_cast ((
GTypeInstance*) ((menuitem)), ((ctk_radio_menu_item_get_type (
)))))))
);
3017
3018 ctk_menu_shell_append (CTK_MENU_SHELL (menu)((((CtkMenuShell*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((menu)), ((ctk_menu_shell_get_type ()))))))
, menuitem);
3019 ctk_widget_show (menuitem);
3020 if (i == 3)
3021 ctk_widget_set_sensitive (menuitem, FALSE(0));
3022
3023 if (i == 5)
3024 ctk_check_menu_item_set_inconsistent (CTK_CHECK_MENU_ITEM (menuitem)((((CtkCheckMenuItem*) (void *) g_type_check_instance_cast ((
GTypeInstance*) ((menuitem)), ((ctk_check_menu_item_get_type (
)))))))
,
3025 TRUE(!(0)));
3026
3027 if (i < 5)
3028 ctk_menu_item_set_submenu (CTK_MENU_ITEM (menuitem)((((CtkMenuItem*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((menuitem)), ((ctk_menu_item_get_type ()))))))
,
3029 create_menu (screen, depth - 1, 5));
3030 }
3031
3032 return menu;
3033}
3034
3035static CtkWidget*
3036create_table_menu (CdkScreen *screen, gint cols, gint rows)
3037{
3038 CtkWidget *menu;
3039 CtkWidget *menuitem;
3040 CtkWidget *submenu;
3041 CtkWidget *image;
3042 char buf[32];
3043 int i, j;
3044
3045 menu = ctk_menu_new ();
3046 ctk_menu_set_screen (CTK_MENU (menu)((((CtkMenu*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((menu)), ((ctk_menu_get_type ()))))))
, screen);
3047
3048 j = 0;
3049
3050 menuitem = ctk_menu_item_new_with_label ("items");
3051 ctk_menu_attach (CTK_MENU (menu)((((CtkMenu*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((menu)), ((ctk_menu_get_type ()))))))
, menuitem, 0, cols, j, j + 1);
3052
3053 submenu = ctk_menu_new ();
3054 ctk_menu_set_screen (CTK_MENU (submenu)((((CtkMenu*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((submenu)), ((ctk_menu_get_type ()))))))
, screen);
3055 ctk_menu_item_set_submenu (CTK_MENU_ITEM (menuitem)((((CtkMenuItem*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((menuitem)), ((ctk_menu_item_get_type ()))))))
, submenu);
3056 ctk_widget_show (menuitem);
3057 j++;
3058
3059 /* now fill the items submenu */
3060 image = ctk_image_new_from_icon_name ("help-broswer",
3061 CTK_ICON_SIZE_MENU);
3062 ctk_widget_show (image);
3063
3064 menuitem = ctk_image_menu_item_new_with_label ("Image");
3065 ctk_image_menu_item_set_image (CTK_IMAGE_MENU_ITEM (menuitem)((((CtkImageMenuItem*) (void *) g_type_check_instance_cast ((
GTypeInstance*) ((menuitem)), ((ctk_image_menu_item_get_type (
)))))))
, image);
3066 ctk_image_menu_item_set_always_show_image (CTK_IMAGE_MENU_ITEM (menuitem)((((CtkImageMenuItem*) (void *) g_type_check_instance_cast ((
GTypeInstance*) ((menuitem)), ((ctk_image_menu_item_get_type (
)))))))
, TRUE(!(0)));
3067
3068 ctk_menu_attach (CTK_MENU (submenu)((((CtkMenu*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((submenu)), ((ctk_menu_get_type ()))))))
, menuitem, 0, 1, 0, 1);
3069 ctk_widget_show (menuitem);
3070
3071 menuitem = ctk_menu_item_new_with_label ("x");
3072 ctk_menu_attach (CTK_MENU (submenu)((((CtkMenu*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((submenu)), ((ctk_menu_get_type ()))))))
, menuitem, 1, 2, 0, 1);
3073 ctk_widget_show (menuitem);
3074
3075 menuitem = ctk_menu_item_new_with_label ("x");
3076 ctk_menu_attach (CTK_MENU (submenu)((((CtkMenu*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((submenu)), ((ctk_menu_get_type ()))))))
, menuitem, 0, 1, 1, 2);
3077 ctk_widget_show (menuitem);
3078
3079 image = ctk_image_new_from_icon_name ("help-browser",
3080 CTK_ICON_SIZE_MENU);
3081 ctk_widget_show (image);
3082
3083 menuitem = ctk_image_menu_item_new_with_label ("Image");
3084 ctk_image_menu_item_set_image (CTK_IMAGE_MENU_ITEM (menuitem)((((CtkImageMenuItem*) (void *) g_type_check_instance_cast ((
GTypeInstance*) ((menuitem)), ((ctk_image_menu_item_get_type (
)))))))
, image);
3085 ctk_image_menu_item_set_always_show_image (CTK_IMAGE_MENU_ITEM (menuitem)((((CtkImageMenuItem*) (void *) g_type_check_instance_cast ((
GTypeInstance*) ((menuitem)), ((ctk_image_menu_item_get_type (
)))))))
, TRUE(!(0)));
3086
3087 ctk_menu_attach (CTK_MENU (submenu)((((CtkMenu*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((submenu)), ((ctk_menu_get_type ()))))))
, menuitem, 1, 2, 1, 2);
3088 ctk_widget_show (menuitem);
3089
3090 menuitem = ctk_radio_menu_item_new_with_label (NULL((void*)0), "Radio");
3091 ctk_menu_attach (CTK_MENU (submenu)((((CtkMenu*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((submenu)), ((ctk_menu_get_type ()))))))
, menuitem, 0, 1, 2, 3);
3092 ctk_widget_show (menuitem);
3093
3094 menuitem = ctk_menu_item_new_with_label ("x");
3095 ctk_menu_attach (CTK_MENU (submenu)((((CtkMenu*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((submenu)), ((ctk_menu_get_type ()))))))
, menuitem, 1, 2, 2, 3);
3096 ctk_widget_show (menuitem);
3097
3098 menuitem = ctk_menu_item_new_with_label ("x");
3099 ctk_menu_attach (CTK_MENU (submenu)((((CtkMenu*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((submenu)), ((ctk_menu_get_type ()))))))
, menuitem, 0, 1, 3, 4);
3100 ctk_widget_show (menuitem);
3101
3102 menuitem = ctk_radio_menu_item_new_with_label (NULL((void*)0), "Radio");
3103 ctk_menu_attach (CTK_MENU (submenu)((((CtkMenu*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((submenu)), ((ctk_menu_get_type ()))))))
, menuitem, 1, 2, 3, 4);
3104 ctk_widget_show (menuitem);
3105
3106 menuitem = ctk_check_menu_item_new_with_label ("Check");
3107 ctk_menu_attach (CTK_MENU (submenu)((((CtkMenu*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((submenu)), ((ctk_menu_get_type ()))))))
, menuitem, 0, 1, 4, 5);
3108 ctk_widget_show (menuitem);
3109
3110 menuitem = ctk_menu_item_new_with_label ("x");
3111 ctk_menu_attach (CTK_MENU (submenu)((((CtkMenu*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((submenu)), ((ctk_menu_get_type ()))))))
, menuitem, 1, 2, 4, 5);
3112 ctk_widget_show (menuitem);
3113
3114 menuitem = ctk_menu_item_new_with_label ("x");
3115 ctk_menu_attach (CTK_MENU (submenu)((((CtkMenu*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((submenu)), ((ctk_menu_get_type ()))))))
, menuitem, 0, 1, 5, 6);
3116 ctk_widget_show (menuitem);
3117
3118 menuitem = ctk_check_menu_item_new_with_label ("Check");
3119 ctk_menu_attach (CTK_MENU (submenu)((((CtkMenu*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((submenu)), ((ctk_menu_get_type ()))))))
, menuitem, 1, 2, 5, 6);
3120 ctk_widget_show (menuitem);
3121
3122 menuitem = ctk_menu_item_new_with_label ("1. Inserted normally (8)");
3123 ctk_widget_show (menuitem);
3124 ctk_menu_shell_insert (CTK_MENU_SHELL (submenu)((((CtkMenuShell*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((submenu)), ((ctk_menu_shell_get_type ()))))))
, menuitem, 8);
3125
3126 menuitem = ctk_menu_item_new_with_label ("2. Inserted normally (2)");
3127 ctk_widget_show (menuitem);
3128 ctk_menu_shell_insert (CTK_MENU_SHELL (submenu)((((CtkMenuShell*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((submenu)), ((ctk_menu_shell_get_type ()))))))
, menuitem, 2);
3129
3130 menuitem = ctk_menu_item_new_with_label ("3. Inserted normally (0)");
3131 ctk_widget_show (menuitem);
3132 ctk_menu_shell_insert (CTK_MENU_SHELL (submenu)((((CtkMenuShell*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((submenu)), ((ctk_menu_shell_get_type ()))))))
, menuitem, 0);
3133
3134 menuitem = ctk_menu_item_new_with_label ("4. Inserted normally (-1)");
3135 ctk_widget_show (menuitem);
3136 ctk_menu_shell_insert (CTK_MENU_SHELL (submenu)((((CtkMenuShell*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((submenu)), ((ctk_menu_shell_get_type ()))))))
, menuitem, -1);
3137
3138 /* end of items submenu */
3139
3140 menuitem = ctk_menu_item_new_with_label ("spanning");
3141 ctk_menu_attach (CTK_MENU (menu)((((CtkMenu*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((menu)), ((ctk_menu_get_type ()))))))
, menuitem, 0, cols, j, j + 1);
3142
3143 submenu = ctk_menu_new ();
3144 ctk_menu_set_screen (CTK_MENU (submenu)((((CtkMenu*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((submenu)), ((ctk_menu_get_type ()))))))
, screen);
3145 ctk_menu_item_set_submenu (CTK_MENU_ITEM (menuitem)((((CtkMenuItem*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((menuitem)), ((ctk_menu_item_get_type ()))))))
, submenu);
3146 ctk_widget_show (menuitem);
3147 j++;
3148
3149 /* now fill the spanning submenu */
3150 menuitem = ctk_menu_item_new_with_label ("a");
3151 ctk_menu_attach (CTK_MENU (submenu)((((CtkMenu*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((submenu)), ((ctk_menu_get_type ()))))))
, menuitem, 0, 2, 0, 1);
3152 ctk_widget_show (menuitem);
3153
3154 menuitem = ctk_menu_item_new_with_label ("b");
3155 ctk_menu_attach (CTK_MENU (submenu)((((CtkMenu*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((submenu)), ((ctk_menu_get_type ()))))))
, menuitem, 2, 3, 0, 2);
3156 ctk_widget_show (menuitem);
3157
3158 menuitem = ctk_menu_item_new_with_label ("c");
3159 ctk_menu_attach (CTK_MENU (submenu)((((CtkMenu*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((submenu)), ((ctk_menu_get_type ()))))))
, menuitem, 0, 1, 1, 3);
3160 ctk_widget_show (menuitem);
3161
3162 menuitem = ctk_menu_item_new_with_label ("d");
3163 ctk_menu_attach (CTK_MENU (submenu)((((CtkMenu*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((submenu)), ((ctk_menu_get_type ()))))))
, menuitem, 1, 2, 1, 2);
3164 ctk_widget_show (menuitem);
3165
3166 menuitem = ctk_menu_item_new_with_label ("e");
3167 ctk_menu_attach (CTK_MENU (submenu)((((CtkMenu*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((submenu)), ((ctk_menu_get_type ()))))))
, menuitem, 1, 3, 2, 3);
3168 ctk_widget_show (menuitem);
3169 /* end of spanning submenu */
3170
3171 menuitem = ctk_menu_item_new_with_label ("left");
3172 ctk_menu_attach (CTK_MENU (menu)((((CtkMenu*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((menu)), ((ctk_menu_get_type ()))))))
, menuitem, 0, 1, j, j + 1);
3173 submenu = ctk_menu_new ();
3174 ctk_menu_set_screen (CTK_MENU (submenu)((((CtkMenu*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((submenu)), ((ctk_menu_get_type ()))))))
, screen);
3175 ctk_menu_item_set_submenu (CTK_MENU_ITEM (menuitem)((((CtkMenuItem*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((menuitem)), ((ctk_menu_item_get_type ()))))))
, submenu);
3176 ctk_widget_show (menuitem);
3177
3178 menuitem = ctk_menu_item_new_with_label ("Empty");
3179 ctk_menu_attach (CTK_MENU (submenu)((((CtkMenu*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((submenu)), ((ctk_menu_get_type ()))))))
, menuitem, 0, 1, 0, 1);
3180 submenu = ctk_menu_new ();
3181 ctk_menu_set_screen (CTK_MENU (submenu)((((CtkMenu*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((submenu)), ((ctk_menu_get_type ()))))))
, screen);
3182 ctk_menu_item_set_submenu (CTK_MENU_ITEM (menuitem)((((CtkMenuItem*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((menuitem)), ((ctk_menu_item_get_type ()))))))
, submenu);
3183 ctk_widget_show (menuitem);
3184
3185 menuitem = ctk_menu_item_new_with_label ("right");
3186 ctk_menu_attach (CTK_MENU (menu)((((CtkMenu*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((menu)), ((ctk_menu_get_type ()))))))
, menuitem, 1, 2, j, j + 1);
3187 submenu = ctk_menu_new ();
3188 ctk_menu_set_screen (CTK_MENU (submenu)((((CtkMenu*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((submenu)), ((ctk_menu_get_type ()))))))
, screen);
3189 ctk_menu_item_set_submenu (CTK_MENU_ITEM (menuitem)((((CtkMenuItem*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((menuitem)), ((ctk_menu_item_get_type ()))))))
, submenu);
3190 ctk_widget_show (menuitem);
3191
3192 menuitem = ctk_menu_item_new_with_label ("Empty");
3193 ctk_menu_attach (CTK_MENU (submenu)((((CtkMenu*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((submenu)), ((ctk_menu_get_type ()))))))
, menuitem, 0, 1, 0, 1);
3194 ctk_widget_show (menuitem);
3195
3196 j++;
3197
3198 for (; j < rows; j++)
3199 for (i = 0; i < cols; i++)
3200 {
3201 sprintf (buf, "(%d %d)", i, j);
3202 menuitem = ctk_menu_item_new_with_label (buf);
3203 ctk_menu_attach (CTK_MENU (menu)((((CtkMenu*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((menu)), ((ctk_menu_get_type ()))))))
, menuitem, i, i + 1, j, j + 1);
3204 ctk_widget_show (menuitem);
3205 }
3206
3207 menuitem = ctk_menu_item_new_with_label ("1. Inserted normally (8)");
3208 ctk_menu_shell_insert (CTK_MENU_SHELL (menu)((((CtkMenuShell*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((menu)), ((ctk_menu_shell_get_type ()))))))
, menuitem, 8);
3209 ctk_widget_show (menuitem);
3210 menuitem = ctk_menu_item_new_with_label ("2. Inserted normally (2)");
3211 ctk_menu_shell_insert (CTK_MENU_SHELL (menu)((((CtkMenuShell*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((menu)), ((ctk_menu_shell_get_type ()))))))
, menuitem, 2);
3212 ctk_widget_show (menuitem);
3213 menuitem = ctk_menu_item_new_with_label ("3. Inserted normally (0)");
3214 ctk_menu_shell_insert (CTK_MENU_SHELL (menu)((((CtkMenuShell*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((menu)), ((ctk_menu_shell_get_type ()))))))
, menuitem, 0);
3215 ctk_widget_show (menuitem);
3216 menuitem = ctk_menu_item_new_with_label ("4. Inserted normally (-1)");
3217 ctk_menu_shell_insert (CTK_MENU_SHELL (menu)((((CtkMenuShell*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((menu)), ((ctk_menu_shell_get_type ()))))))
, menuitem, -1);
3218 ctk_widget_show (menuitem);
3219
3220 return menu;
3221}
3222
3223static void
3224create_menus (CtkWidget *widget)
3225{
3226 static CtkWidget *window = NULL((void*)0);
3227
3228 if (!window)
3229 {
3230 CtkWidget *box1;
3231 CtkWidget *box2;
3232 CtkWidget *button;
3233 CtkWidget *optionmenu;
3234 CtkWidget *separator;
3235 CtkWidget *menubar;
3236 CtkWidget *menu;
3237 CtkWidget *menuitem;
3238 CtkAccelGroup *accel_group;
3239 CtkWidget *image;
3240 CdkScreen *screen = ctk_widget_get_screen (widget);
3241
3242 window = ctk_window_new (CTK_WINDOW_TOPLEVEL);
3243
3244 ctk_window_set_screen (CTK_WINDOW (window)((((CtkWindow*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((window)), ((ctk_window_get_type ()))))))
, screen);
3245
3246 g_signal_connect (window, "destroy",g_signal_connect_data ((window), ("destroy"), (((GCallback) (
ctk_widget_destroyed))), (&window), ((void*)0), (GConnectFlags
) 0)
3247 G_CALLBACK (ctk_widget_destroyed),g_signal_connect_data ((window), ("destroy"), (((GCallback) (
ctk_widget_destroyed))), (&window), ((void*)0), (GConnectFlags
) 0)
3248 &window)g_signal_connect_data ((window), ("destroy"), (((GCallback) (
ctk_widget_destroyed))), (&window), ((void*)0), (GConnectFlags
) 0)
;
3249 g_signal_connect (window, "delete-event",g_signal_connect_data ((window), ("delete-event"), (((GCallback
) (ctk_true))), (((void*)0)), ((void*)0), (GConnectFlags) 0)
3250 G_CALLBACK (ctk_true),g_signal_connect_data ((window), ("delete-event"), (((GCallback
) (ctk_true))), (((void*)0)), ((void*)0), (GConnectFlags) 0)
3251 NULL)g_signal_connect_data ((window), ("delete-event"), (((GCallback
) (ctk_true))), (((void*)0)), ((void*)0), (GConnectFlags) 0)
;
3252
3253 accel_group = ctk_accel_group_new ();
3254 ctk_window_add_accel_group (CTK_WINDOW (window)((((CtkWindow*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((window)), ((ctk_window_get_type ()))))))
, accel_group);
3255
3256 ctk_window_set_title (CTK_WINDOW (window)((((CtkWindow*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((window)), ((ctk_window_get_type ()))))))
, "menus");
3257 ctk_container_set_border_width (CTK_CONTAINER (window)((((CtkContainer*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((window)), ((ctk_container_get_type ()))))))
, 0);
3258
3259
3260 box1 = ctk_box_new (CTK_ORIENTATION_VERTICAL, 0);
3261 ctk_container_add (CTK_CONTAINER (window)((((CtkContainer*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((window)), ((ctk_container_get_type ()))))))
, box1);
3262 ctk_widget_show (box1);
3263
3264 menubar = ctk_menu_bar_new ();
3265 ctk_box_pack_start (CTK_BOX (box1)((((CtkBox*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((box1)), ((ctk_box_get_type ()))))))
, menubar, FALSE(0), TRUE(!(0)), 0);
3266 ctk_widget_show (menubar);
3267
3268 menu = create_menu (screen, 2, 50);
3269
3270 menuitem = ctk_menu_item_new_with_label ("test\nline2");
3271 ctk_menu_item_set_submenu (CTK_MENU_ITEM (menuitem)((((CtkMenuItem*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((menuitem)), ((ctk_menu_item_get_type ()))))))
, menu);
3272 ctk_menu_shell_append (CTK_MENU_SHELL (menubar)((((CtkMenuShell*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((menubar)), ((ctk_menu_shell_get_type ()))))))
, menuitem);
3273 ctk_widget_show (menuitem);
3274
3275 menu = create_table_menu (screen, 2, 50);
3276
3277 menuitem = ctk_menu_item_new_with_label ("table");
3278 ctk_menu_item_set_submenu (CTK_MENU_ITEM (menuitem)((((CtkMenuItem*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((menuitem)), ((ctk_menu_item_get_type ()))))))
, menu);
3279 ctk_menu_shell_append (CTK_MENU_SHELL (menubar)((((CtkMenuShell*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((menubar)), ((ctk_menu_shell_get_type ()))))))
, menuitem);
3280 ctk_widget_show (menuitem);
3281
3282 menuitem = ctk_menu_item_new_with_label ("foo");
3283 ctk_menu_item_set_submenu (CTK_MENU_ITEM (menuitem)((((CtkMenuItem*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((menuitem)), ((ctk_menu_item_get_type ()))))))
, create_menu (screen, 3, 5));
3284 ctk_menu_shell_append (CTK_MENU_SHELL (menubar)((((CtkMenuShell*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((menubar)), ((ctk_menu_shell_get_type ()))))))
, menuitem);
3285 ctk_widget_show (menuitem);
3286
3287 image = ctk_image_new_from_icon_name ("help-browser",
3288 CTK_ICON_SIZE_MENU);
3289 ctk_widget_show (image);
3290
3291 menuitem = ctk_image_menu_item_new_with_label ("Help");
3292 ctk_image_menu_item_set_image (CTK_IMAGE_MENU_ITEM (menuitem)((((CtkImageMenuItem*) (void *) g_type_check_instance_cast ((
GTypeInstance*) ((menuitem)), ((ctk_image_menu_item_get_type (
)))))))
, image);
3293 ctk_image_menu_item_set_always_show_image (CTK_IMAGE_MENU_ITEM (menuitem)((((CtkImageMenuItem*) (void *) g_type_check_instance_cast ((
GTypeInstance*) ((menuitem)), ((ctk_image_menu_item_get_type (
)))))))
, TRUE(!(0)));
3294
3295 ctk_menu_item_set_submenu (CTK_MENU_ITEM (menuitem)((((CtkMenuItem*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((menuitem)), ((ctk_menu_item_get_type ()))))))
, create_menu (screen, 4, 5));
3296 ctk_widget_set_hexpand (menuitem, TRUE(!(0)));
3297 ctk_widget_set_halign (menuitem, CTK_ALIGN_END);
3298 ctk_menu_shell_append (CTK_MENU_SHELL (menubar)((((CtkMenuShell*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((menubar)), ((ctk_menu_shell_get_type ()))))))
, menuitem);
3299 ctk_widget_show (menuitem);
3300
3301 menubar = ctk_menu_bar_new ();
3302 ctk_box_pack_start (CTK_BOX (box1)((((CtkBox*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((box1)), ((ctk_box_get_type ()))))))
, menubar, FALSE(0), TRUE(!(0)), 0);
3303 ctk_widget_show (menubar);
3304
3305 menu = create_menu (screen, 2, 10);
3306
3307 menuitem = ctk_menu_item_new_with_label ("Second menu bar");
3308 ctk_menu_item_set_submenu (CTK_MENU_ITEM (menuitem)((((CtkMenuItem*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((menuitem)), ((ctk_menu_item_get_type ()))))))
, menu);
3309 ctk_menu_shell_append (CTK_MENU_SHELL (menubar)((((CtkMenuShell*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((menubar)), ((ctk_menu_shell_get_type ()))))))
, menuitem);
3310 ctk_widget_show (menuitem);
3311
3312 box2 = ctk_box_new (CTK_ORIENTATION_VERTICAL, 10);
3313 ctk_container_set_border_width (CTK_CONTAINER (box2)((((CtkContainer*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((box2)), ((ctk_container_get_type ()))))))
, 10);
3314 ctk_box_pack_start (CTK_BOX (box1)((((CtkBox*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((box1)), ((ctk_box_get_type ()))))))
, box2, TRUE(!(0)), TRUE(!(0)), 0);
3315 ctk_widget_show (box2);
3316
3317 menu = create_menu (screen, 1, 5);
3318 ctk_menu_set_accel_group (CTK_MENU (menu)((((CtkMenu*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((menu)), ((ctk_menu_get_type ()))))))
, accel_group);
3319
3320 menuitem = ctk_check_menu_item_new_with_label ("Accelerate Me");
3321 ctk_menu_shell_append (CTK_MENU_SHELL (menu)((((CtkMenuShell*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((menu)), ((ctk_menu_shell_get_type ()))))))
, menuitem);
3322 ctk_widget_show (menuitem);
3323 ctk_widget_add_accelerator (menuitem,
3324 "activate",
3325 accel_group,
3326 CDK_KEY_F10xffbe,
3327 0,
3328 CTK_ACCEL_VISIBLE);
3329 menuitem = ctk_check_menu_item_new_with_label ("Accelerator Locked");
3330 ctk_menu_shell_append (CTK_MENU_SHELL (menu)((((CtkMenuShell*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((menu)), ((ctk_menu_shell_get_type ()))))))
, menuitem);
3331 ctk_widget_show (menuitem);
3332 ctk_widget_add_accelerator (menuitem,
3333 "activate",
3334 accel_group,
3335 CDK_KEY_F20xffbf,
3336 0,
3337 CTK_ACCEL_VISIBLE | CTK_ACCEL_LOCKED);
3338 menuitem = ctk_check_menu_item_new_with_label ("Accelerators Frozen");
3339 ctk_menu_shell_append (CTK_MENU_SHELL (menu)((((CtkMenuShell*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((menu)), ((ctk_menu_shell_get_type ()))))))
, menuitem);
3340 ctk_widget_show (menuitem);
3341 ctk_widget_add_accelerator (menuitem,
3342 "activate",
3343 accel_group,
3344 CDK_KEY_F20xffbf,
3345 0,
3346 CTK_ACCEL_VISIBLE);
3347 ctk_widget_add_accelerator (menuitem,
3348 "activate",
3349 accel_group,
3350 CDK_KEY_F30xffc0,
3351 0,
3352 CTK_ACCEL_VISIBLE);
3353
3354 optionmenu = ctk_combo_box_text_new ();
3355 ctk_combo_box_set_active (CTK_COMBO_BOX (optionmenu)((((CtkComboBox*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((optionmenu)), ((ctk_combo_box_get_type ()))))))
, 3);
3356 ctk_box_pack_start (CTK_BOX (box2)((((CtkBox*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((box2)), ((ctk_box_get_type ()))))))
, optionmenu, TRUE(!(0)), TRUE(!(0)), 0);
3357 ctk_widget_show (optionmenu);
3358
3359 separator = ctk_separator_new (CTK_ORIENTATION_HORIZONTAL);
3360 ctk_box_pack_start (CTK_BOX (box1)((((CtkBox*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((box1)), ((ctk_box_get_type ()))))))
, separator, FALSE(0), TRUE(!(0)), 0);
3361 ctk_widget_show (separator);
3362
3363 box2 = ctk_box_new (CTK_ORIENTATION_VERTICAL, 10);
3364 ctk_container_set_border_width (CTK_CONTAINER (box2)((((CtkContainer*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((box2)), ((ctk_container_get_type ()))))))
, 10);
3365 ctk_box_pack_start (CTK_BOX (box1)((((CtkBox*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((box1)), ((ctk_box_get_type ()))))))
, box2, FALSE(0), TRUE(!(0)), 0);
3366 ctk_widget_show (box2);
3367
3368 button = ctk_button_new_with_label ("close");
3369 g_signal_connect_swapped (button, "clicked",g_signal_connect_data ((button), ("clicked"), (((GCallback) (
ctk_widget_destroy))), (window), ((void*)0), G_CONNECT_SWAPPED
)
3370 G_CALLBACK (ctk_widget_destroy),g_signal_connect_data ((button), ("clicked"), (((GCallback) (
ctk_widget_destroy))), (window), ((void*)0), G_CONNECT_SWAPPED
)
3371 window)g_signal_connect_data ((button), ("clicked"), (((GCallback) (
ctk_widget_destroy))), (window), ((void*)0), G_CONNECT_SWAPPED
)
;
3372 ctk_box_pack_start (CTK_BOX (box2)((((CtkBox*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((box2)), ((ctk_box_get_type ()))))))
, button, TRUE(!(0)), TRUE(!(0)), 0);
3373 ctk_widget_set_can_default (button, TRUE(!(0)));
3374 ctk_widget_grab_default (button);
3375 ctk_widget_show (button);
3376 }
3377
3378 if (!ctk_widget_get_visible (window))
3379 ctk_widget_show (window);
3380 else
3381 ctk_widget_destroy (window);
3382}
3383
3384
3385static CtkWidget *
3386accel_button_new (CtkAccelGroup *accel_group,
3387 const gchar *text,
3388 const gchar *accel)
3389{
3390 guint keyval;
3391 CdkModifierType modifiers;
3392 CtkWidget *button;
3393 CtkWidget *label;
3394
3395 ctk_accelerator_parse (accel, &keyval, &modifiers);
3396 g_assert (keyval)do { if (keyval) ; else g_assertion_message_expr (((gchar*) 0
), "testctk.c", 3396, ((const char*) (__func__)), "keyval"); }
while (0)
;
3397
3398 button = ctk_button_new ();
3399 ctk_widget_add_accelerator (button, "activate", accel_group,
3400 keyval, modifiers, CTK_ACCEL_VISIBLE | CTK_ACCEL_LOCKED);
3401
3402 label = ctk_accel_label_new (text);
3403 ctk_accel_label_set_accel_widget (CTK_ACCEL_LABEL (label)((((CtkAccelLabel*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((label)), ((ctk_accel_label_get_type ()))))))
, button);
3404 ctk_widget_show (label);
3405
3406 ctk_container_add (CTK_CONTAINER (button)((((CtkContainer*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((button)), ((ctk_container_get_type ()))))))
, label);
3407
3408 return button;
3409}
3410
3411static void
3412create_key_lookup (CtkWidget *widget)
3413{
3414 static CtkWidget *window = NULL((void*)0);
3415 gpointer window_ptr;
3416
3417 if (!window)
3418 {
3419 CtkAccelGroup *accel_group = ctk_accel_group_new ();
3420 CtkWidget *button;
3421 CtkWidget *content_area;
3422
3423 window = ctk_dialog_new_with_buttons ("Key Lookup", NULL((void*)0), 0,
3424 "_Close", CTK_RESPONSE_CLOSE,
3425 NULL((void*)0));
3426
3427 ctk_window_set_screen (CTK_WINDOW (window)((((CtkWindow*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((window)), ((ctk_window_get_type ()))))))
,
3428 ctk_widget_get_screen (widget));
3429
3430 /* We have to expand it so the accel labels will draw their labels
3431 */
3432 ctk_window_set_default_size (CTK_WINDOW (window)((((CtkWindow*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((window)), ((ctk_window_get_type ()))))))
, 300, -1);
3433
3434 ctk_window_add_accel_group (CTK_WINDOW (window)((((CtkWindow*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((window)), ((ctk_window_get_type ()))))))
, accel_group);
3435
3436 content_area = ctk_dialog_get_content_area (CTK_DIALOG (window)((((CtkDialog*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((window)), ((ctk_dialog_get_type ()))))))
);
3437
3438 button = ctk_button_new_with_mnemonic ("Button 1 (_a)");
3439 ctk_box_pack_start (CTK_BOX (content_area)((((CtkBox*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((content_area)), ((ctk_box_get_type ()))))))
, button, FALSE(0), FALSE(0), 0);
3440 button = ctk_button_new_with_mnemonic ("Button 2 (_A)");
3441 ctk_box_pack_start (CTK_BOX (content_area)((((CtkBox*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((content_area)), ((ctk_box_get_type ()))))))
, button, FALSE(0), FALSE(0), 0);
3442 button = ctk_button_new_with_mnemonic ("Button 3 (_\321\204)");
3443 ctk_box_pack_start (CTK_BOX (content_area)((((CtkBox*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((content_area)), ((ctk_box_get_type ()))))))
, button, FALSE(0), FALSE(0), 0);
3444 button = ctk_button_new_with_mnemonic ("Button 4 (_\320\244)");
3445 ctk_box_pack_start (CTK_BOX (content_area)((((CtkBox*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((content_area)), ((ctk_box_get_type ()))))))
, button, FALSE(0), FALSE(0), 0);
3446 button = ctk_button_new_with_mnemonic ("Button 6 (_b)");
3447 ctk_box_pack_start (CTK_BOX (content_area)((((CtkBox*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((content_area)), ((ctk_box_get_type ()))))))
, button, FALSE(0), FALSE(0), 0);
3448 button = accel_button_new (accel_group, "Button 7", "<Alt><Shift>b");
3449 ctk_box_pack_start (CTK_BOX (content_area)((((CtkBox*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((content_area)), ((ctk_box_get_type ()))))))
, button, FALSE(0), FALSE(0), 0);
3450 button = accel_button_new (accel_group, "Button 8", "<Alt>d");
3451 ctk_box_pack_start (CTK_BOX (content_area)((((CtkBox*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((content_area)), ((ctk_box_get_type ()))))))
, button, FALSE(0), FALSE(0), 0);
3452 button = accel_button_new (accel_group, "Button 9", "<Alt>Cyrillic_ve");
3453 ctk_box_pack_start (CTK_BOX (content_area)((((CtkBox*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((content_area)), ((ctk_box_get_type ()))))))
, button, FALSE(0), FALSE(0), 0);
3454 button = ctk_button_new_with_mnemonic ("Button 10 (_1)");
3455 ctk_box_pack_start (CTK_BOX (content_area)((((CtkBox*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((content_area)), ((ctk_box_get_type ()))))))
, button, FALSE(0), FALSE(0), 0);
3456 button = ctk_button_new_with_mnemonic ("Button 11 (_!)");
3457 ctk_box_pack_start (CTK_BOX (content_area)((((CtkBox*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((content_area)), ((ctk_box_get_type ()))))))
, button, FALSE(0), FALSE(0), 0);
3458 button = accel_button_new (accel_group, "Button 12", "<Super>a");
3459 ctk_box_pack_start (CTK_BOX (content_area)((((CtkBox*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((content_area)), ((ctk_box_get_type ()))))))
, button, FALSE(0), FALSE(0), 0);
3460 button = accel_button_new (accel_group, "Button 13", "<Hyper>a");
3461 ctk_box_pack_start (CTK_BOX (content_area)((((CtkBox*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((content_area)), ((ctk_box_get_type ()))))))
, button, FALSE(0), FALSE(0), 0);
3462 button = accel_button_new (accel_group, "Button 14", "<Meta>a");
3463 ctk_box_pack_start (CTK_BOX (content_area)((((CtkBox*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((content_area)), ((ctk_box_get_type ()))))))
, button, FALSE(0), FALSE(0), 0);
3464 button = accel_button_new (accel_group, "Button 15", "<Shift><Mod4>b");
3465 ctk_box_pack_start (CTK_BOX (content_area)((((CtkBox*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((content_area)), ((ctk_box_get_type ()))))))
, button, FALSE(0), FALSE(0), 0);
3466
3467 window_ptr = &window;
3468 g_object_add_weak_pointer (G_OBJECT (window)((((GObject*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((window)), (((GType) ((20) << (2))))))))
, window_ptr);
3469 g_signal_connect (window, "response", G_CALLBACK (ctk_widget_destroy), NULL)g_signal_connect_data ((window), ("response"), (((GCallback) (
ctk_widget_destroy))), (((void*)0)), ((void*)0), (GConnectFlags
) 0)
;
3470
3471 ctk_widget_show_all (window);
3472 }
3473 else
3474 ctk_widget_destroy (window);
3475}
3476
3477
3478/*
3479 create_modal_window
3480 */
3481
3482static gboolean
3483cmw_destroy_cb (CtkWidget *widget G_GNUC_UNUSED__attribute__ ((__unused__)))
3484{
3485 /* This is needed to get out of ctk_main */
3486 ctk_main_quit ();
3487
3488 return FALSE(0);
3489}
3490
3491static void
3492cmw_color (CtkWidget *widget G_GNUC_UNUSED__attribute__ ((__unused__)), CtkWidget *parent)
3493{
3494 CtkWidget *csd;
3495
3496 csd = ctk_color_chooser_dialog_new ("This is a modal color selection dialog", CTK_WINDOW (parent)((((CtkWindow*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((parent)), ((ctk_window_get_type ()))))))
);
3497
3498 /* Set as modal */
3499 ctk_window_set_modal (CTK_WINDOW(csd)((((CtkWindow*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((csd)), ((ctk_window_get_type ()))))))
,TRUE(!(0)));
3500
3501 g_signal_connect (csd, "destroy",g_signal_connect_data ((csd), ("destroy"), (((GCallback) (cmw_destroy_cb
))), (((void*)0)), ((void*)0), (GConnectFlags) 0)
3502 G_CALLBACK (cmw_destroy_cb), NULL)g_signal_connect_data ((csd), ("destroy"), (((GCallback) (cmw_destroy_cb
))), (((void*)0)), ((void*)0), (GConnectFlags) 0)
;
3503 g_signal_connect (csd, "response",g_signal_connect_data ((csd), ("response"), (((GCallback) (ctk_widget_destroy
))), (((void*)0)), ((void*)0), (GConnectFlags) 0)
3504 G_CALLBACK (ctk_widget_destroy), NULL)g_signal_connect_data ((csd), ("response"), (((GCallback) (ctk_widget_destroy
))), (((void*)0)), ((void*)0), (GConnectFlags) 0)
;
3505
3506 /* wait until destroy calls ctk_main_quit */
3507 ctk_widget_show (csd);
3508 ctk_main ();
3509}
3510
3511static void
3512cmw_file (CtkWidget *widget G_GNUC_UNUSED__attribute__ ((__unused__)),
3513 CtkWidget *parent)
3514{
3515 CtkWidget *fs;
3516
3517 fs = ctk_file_chooser_dialog_new ("This is a modal file selection dialog",
3518 CTK_WINDOW (parent)((((CtkWindow*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((parent)), ((ctk_window_get_type ()))))))
,
3519 CTK_FILE_CHOOSER_ACTION_OPEN,
3520 "_Open", CTK_RESPONSE_ACCEPT,
3521 "_Cancel", CTK_RESPONSE_CANCEL,
3522 NULL((void*)0));
3523 ctk_window_set_screen (CTK_WINDOW (fs)((((CtkWindow*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((fs)), ((ctk_window_get_type ()))))))
, ctk_widget_get_screen (parent));
3524 ctk_window_set_modal (CTK_WINDOW (fs)((((CtkWindow*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((fs)), ((ctk_window_get_type ()))))))
, TRUE(!(0)));
3525
3526 g_signal_connect (fs, "destroy",g_signal_connect_data ((fs), ("destroy"), (((GCallback) (cmw_destroy_cb
))), (((void*)0)), ((void*)0), (GConnectFlags) 0)
3527 G_CALLBACK (cmw_destroy_cb), NULL)g_signal_connect_data ((fs), ("destroy"), (((GCallback) (cmw_destroy_cb
))), (((void*)0)), ((void*)0), (GConnectFlags) 0)
;
3528 g_signal_connect_swapped (fs, "response",g_signal_connect_data ((fs), ("response"), (((GCallback) (ctk_widget_destroy
))), (fs), ((void*)0), G_CONNECT_SWAPPED)
3529 G_CALLBACK (ctk_widget_destroy), fs)g_signal_connect_data ((fs), ("response"), (((GCallback) (ctk_widget_destroy
))), (fs), ((void*)0), G_CONNECT_SWAPPED)
;
3530
3531 /* wait until destroy calls ctk_main_quit */
3532 ctk_widget_show (fs);
3533 ctk_main();
3534}
3535
3536
3537static void
3538create_modal_window (CtkWidget *widget)
3539{
3540 CtkWidget *window = NULL((void*)0);
3541 CtkWidget *box1,*box2;
3542 CtkWidget *frame1;
3543 CtkWidget *btnColor,*btnFile,*btnClose;
3544
3545 /* Create modal window (Here you can use any window descendent )*/
3546 window = ctk_window_new (CTK_WINDOW_TOPLEVEL);
3547 ctk_window_set_screen (CTK_WINDOW (window)((((CtkWindow*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((window)), ((ctk_window_get_type ()))))))
,
3548 ctk_widget_get_screen (widget));
3549
3550 ctk_window_set_title (CTK_WINDOW(window)((((CtkWindow*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((window)), ((ctk_window_get_type ()))))))
,"This window is modal");
3551
3552 /* Set window as modal */
3553 ctk_window_set_modal (CTK_WINDOW(window)((((CtkWindow*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((window)), ((ctk_window_get_type ()))))))
,TRUE(!(0)));
3554
3555 /* Create widgets */
3556 box1 = ctk_box_new (CTK_ORIENTATION_VERTICAL, 5);
3557 frame1 = ctk_frame_new ("Standard dialogs in modal form");
3558 box2 = ctk_box_new (CTK_ORIENTATION_VERTICAL, 5);
3559 ctk_box_set_homogeneous (CTK_BOX (box2)((((CtkBox*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((box2)), ((ctk_box_get_type ()))))))
, TRUE(!(0)));
3560 btnColor = ctk_button_new_with_label ("Color");
3561 btnFile = ctk_button_new_with_label ("File Selection");
3562 btnClose = ctk_button_new_with_label ("Close");
3563
3564 /* Init widgets */
3565 ctk_container_set_border_width (CTK_CONTAINER (box1)((((CtkContainer*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((box1)), ((ctk_container_get_type ()))))))
, 3);
3566 ctk_container_set_border_width (CTK_CONTAINER (box2)((((CtkContainer*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((box2)), ((ctk_container_get_type ()))))))
, 3);
3567
3568 /* Pack widgets */
3569 ctk_container_add (CTK_CONTAINER (window)((((CtkContainer*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((window)), ((ctk_container_get_type ()))))))
, box1);
3570 ctk_box_pack_start (CTK_BOX (box1)((((CtkBox*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((box1)), ((ctk_box_get_type ()))))))
, frame1, TRUE(!(0)), TRUE(!(0)), 4);
3571 ctk_container_add (CTK_CONTAINER (frame1)((((CtkContainer*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((frame1)), ((ctk_container_get_type ()))))))
, box2);
3572 ctk_box_pack_start (CTK_BOX (box2)((((CtkBox*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((box2)), ((ctk_box_get_type ()))))))
, btnColor, FALSE(0), FALSE(0), 4);
3573 ctk_box_pack_start (CTK_BOX (box2)((((CtkBox*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((box2)), ((ctk_box_get_type ()))))))
, btnFile, FALSE(0), FALSE(0), 4);
3574 ctk_box_pack_start (CTK_BOX (box1)((((CtkBox*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((box1)), ((ctk_box_get_type ()))))))
, ctk_separator_new (CTK_ORIENTATION_HORIZONTAL), FALSE(0), FALSE(0), 4);
3575 ctk_box_pack_start (CTK_BOX (box1)((((CtkBox*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((box1)), ((ctk_box_get_type ()))))))
, btnClose, FALSE(0), FALSE(0), 4);
3576
3577 /* connect signals */
3578 g_signal_connect_swapped (btnClose, "clicked",g_signal_connect_data ((btnClose), ("clicked"), (((GCallback)
(ctk_widget_destroy))), (window), ((void*)0), G_CONNECT_SWAPPED
)
3579 G_CALLBACK (ctk_widget_destroy), window)g_signal_connect_data ((btnClose), ("clicked"), (((GCallback)
(ctk_widget_destroy))), (window), ((void*)0), G_CONNECT_SWAPPED
)
;
3580
3581 g_signal_connect (window, "destroy",g_signal_connect_data ((window), ("destroy"), (((GCallback) (
cmw_destroy_cb))), (((void*)0)), ((void*)0), (GConnectFlags) 0
)
3582 G_CALLBACK (cmw_destroy_cb), NULL)g_signal_connect_data ((window), ("destroy"), (((GCallback) (
cmw_destroy_cb))), (((void*)0)), ((void*)0), (GConnectFlags) 0
)
;
3583
3584 g_signal_connect (btnColor, "clicked",g_signal_connect_data ((btnColor), ("clicked"), (((GCallback)
(cmw_color))), (window), ((void*)0), (GConnectFlags) 0)
3585 G_CALLBACK (cmw_color), window)g_signal_connect_data ((btnColor), ("clicked"), (((GCallback)
(cmw_color))), (window), ((void*)0), (GConnectFlags) 0)
;
3586 g_signal_connect (btnFile, "clicked",g_signal_connect_data ((btnFile), ("clicked"), (((GCallback) (
cmw_file))), (window), ((void*)0), (GConnectFlags) 0)
3587 G_CALLBACK (cmw_file), window)g_signal_connect_data ((btnFile), ("clicked"), (((GCallback) (
cmw_file))), (window), ((void*)0), (GConnectFlags) 0)
;
3588
3589 /* Show widgets */
3590 ctk_widget_show_all (window);
3591
3592 /* wait until dialog get destroyed */
3593 ctk_main();
3594}
3595
3596/*
3597 * CtkMessageDialog
3598 */
3599
3600static void
3601make_message_dialog (CdkScreen *screen,
3602 CtkWidget **dialog,
3603 CtkMessageType type,
3604 CtkButtonsType buttons,
3605 guint default_response)
3606{
3607 if (*dialog)
3608 {
3609 ctk_widget_destroy (*dialog);
3610
3611 return;
3612 }
3613
3614 *dialog = ctk_message_dialog_new (NULL((void*)0), 0, type, buttons,
3615 "This is a message dialog; it can wrap long lines. This is a long line. La la la. Look this line is wrapped. Blah blah blah blah blah blah. (Note: testctk has a nonstandard ctkrc that changes some of the message dialog icons.)");
3616
3617 ctk_window_set_screen (CTK_WINDOW (*dialog)((((CtkWindow*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((*dialog)), ((ctk_window_get_type ()))))))
, screen);
3618
3619 g_signal_connect_swapped (*dialog,g_signal_connect_data ((*dialog), ("response"), (((GCallback)
(ctk_widget_destroy))), (*dialog), ((void*)0), G_CONNECT_SWAPPED
)
3620 "response",g_signal_connect_data ((*dialog), ("response"), (((GCallback)
(ctk_widget_destroy))), (*dialog), ((void*)0), G_CONNECT_SWAPPED
)
3621 G_CALLBACK (ctk_widget_destroy),g_signal_connect_data ((*dialog), ("response"), (((GCallback)
(ctk_widget_destroy))), (*dialog), ((void*)0), G_CONNECT_SWAPPED
)
3622 *dialog)g_signal_connect_data ((*dialog), ("response"), (((GCallback)
(ctk_widget_destroy))), (*dialog), ((void*)0), G_CONNECT_SWAPPED
)
;
3623
3624 g_signal_connect (*dialog,g_signal_connect_data ((*dialog), ("destroy"), (((GCallback) (
ctk_widget_destroyed))), (dialog), ((void*)0), (GConnectFlags
) 0)
3625 "destroy",g_signal_connect_data ((*dialog), ("destroy"), (((GCallback) (
ctk_widget_destroyed))), (dialog), ((void*)0), (GConnectFlags
) 0)
3626 G_CALLBACK (ctk_widget_destroyed),g_signal_connect_data ((*dialog), ("destroy"), (((GCallback) (
ctk_widget_destroyed))), (dialog), ((void*)0), (GConnectFlags
) 0)
3627 dialog)g_signal_connect_data ((*dialog), ("destroy"), (((GCallback) (
ctk_widget_destroyed))), (dialog), ((void*)0), (GConnectFlags
) 0)
;
3628
3629 ctk_dialog_set_default_response (CTK_DIALOG (*dialog)((((CtkDialog*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((*dialog)), ((ctk_dialog_get_type ()))))))
, default_response);
3630
3631 ctk_widget_show (*dialog);
3632}
3633
3634static void
3635create_message_dialog (CtkWidget *widget)
3636{
3637 static CtkWidget *info = NULL((void*)0);
3638 static CtkWidget *warning = NULL((void*)0);
3639 static CtkWidget *error = NULL((void*)0);
3640 static CtkWidget *question = NULL((void*)0);
3641 CdkScreen *screen = ctk_widget_get_screen (widget);
3642
3643 make_message_dialog (screen, &info, CTK_MESSAGE_INFO, CTK_BUTTONS_OK, CTK_RESPONSE_OK);
3644 make_message_dialog (screen, &warning, CTK_MESSAGE_WARNING, CTK_BUTTONS_CLOSE, CTK_RESPONSE_CLOSE);
3645 make_message_dialog (screen, &error, CTK_MESSAGE_ERROR, CTK_BUTTONS_OK_CANCEL, CTK_RESPONSE_OK);
3646 make_message_dialog (screen, &question, CTK_MESSAGE_QUESTION, CTK_BUTTONS_YES_NO, CTK_RESPONSE_NO);
3647}
3648
3649/*
3650 * CtkScrolledWindow
3651 */
3652
3653static CtkWidget *sw_parent = NULL((void*)0);
3654static CtkWidget *sw_float_parent;
3655static gulong sw_destroyed_handler = 0;
3656
3657static gboolean
3658scrolled_windows_delete_cb (CtkWidget *widget G_GNUC_UNUSED__attribute__ ((__unused__)),
3659 CdkEventAny *event G_GNUC_UNUSED__attribute__ ((__unused__)),
3660 CtkWidget *scrollwin)
3661{
3662 ctk_widget_reparent (scrollwin, sw_parent);
3663
3664 g_signal_handler_disconnect (sw_parent, sw_destroyed_handler);
3665 sw_float_parent = NULL((void*)0);
3666 sw_parent = NULL((void*)0);
3667 sw_destroyed_handler = 0;
3668
3669 return FALSE(0);
3670}
3671
3672static void
3673scrolled_windows_destroy_cb (CtkWidget *widget G_GNUC_UNUSED__attribute__ ((__unused__)),
3674 CtkWidget *scrollwin G_GNUC_UNUSED__attribute__ ((__unused__)))
3675{
3676 ctk_widget_destroy (sw_float_parent);
3677
3678 sw_float_parent = NULL((void*)0);
3679 sw_parent = NULL((void*)0);
3680 sw_destroyed_handler = 0;
3681}
3682
3683static void
3684scrolled_windows_remove (CtkWidget *dialog, gint response, CtkWidget *scrollwin)
3685{
3686 if (response != CTK_RESPONSE_APPLY)
3687 {
3688 ctk_widget_destroy (dialog);
3689 return;
3690 }
3691
3692 if (sw_parent)
3693 {
3694 ctk_widget_reparent (scrollwin, sw_parent);
3695 ctk_widget_destroy (sw_float_parent);
3696
3697 g_signal_handler_disconnect (sw_parent, sw_destroyed_handler);
3698 sw_float_parent = NULL((void*)0);
3699 sw_parent = NULL((void*)0);
3700 sw_destroyed_handler = 0;
3701 }
3702 else
3703 {
3704 sw_parent = ctk_widget_get_parent (scrollwin);
3705 sw_float_parent = ctk_window_new (CTK_WINDOW_TOPLEVEL);
3706 ctk_window_set_screen (CTK_WINDOW (sw_float_parent)((((CtkWindow*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((sw_float_parent)), ((ctk_window_get_type ()))))))
,
3707 ctk_widget_get_screen (dialog));
3708
3709 ctk_window_set_default_size (CTK_WINDOW (sw_float_parent)((((CtkWindow*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((sw_float_parent)), ((ctk_window_get_type ()))))))
, 200, 200);
3710
3711 ctk_widget_reparent (scrollwin, sw_float_parent);
3712 ctk_widget_show (sw_float_parent);
3713
3714 sw_destroyed_handler =
3715 g_signal_connect (sw_parent, "destroy",g_signal_connect_data ((sw_parent), ("destroy"), (((GCallback
) (scrolled_windows_destroy_cb))), (scrollwin), ((void*)0), (
GConnectFlags) 0)
3716 G_CALLBACK (scrolled_windows_destroy_cb), scrollwin)g_signal_connect_data ((sw_parent), ("destroy"), (((GCallback
) (scrolled_windows_destroy_cb))), (scrollwin), ((void*)0), (
GConnectFlags) 0)
;
3717 g_signal_connect (sw_float_parent, "delete_event",g_signal_connect_data ((sw_float_parent), ("delete_event"), (
((GCallback) (scrolled_windows_delete_cb))), (scrollwin), ((void
*)0), (GConnectFlags) 0)
3718 G_CALLBACK (scrolled_windows_delete_cb), scrollwin)g_signal_connect_data ((sw_float_parent), ("delete_event"), (
((GCallback) (scrolled_windows_delete_cb))), (scrollwin), ((void
*)0), (GConnectFlags) 0)
;
3719 }
3720}
3721
3722static void
3723create_scrolled_windows (CtkWidget *widget)
3724{
3725 static CtkWidget *window;
3726
3727 if (!window)
3728 {
3729 CtkWidget *content_area;
3730 CtkWidget *scrolled_window;
3731 CtkWidget *button;
3732 CtkWidget *grid;
3733 char buffer[32];
3734 int i, j;
3735
3736 window = ctk_dialog_new ();
3737
3738 ctk_window_set_screen (CTK_WINDOW (window)((((CtkWindow*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((window)), ((ctk_window_get_type ()))))))
,
3739 ctk_widget_get_screen (widget));
3740
3741 g_signal_connect (window, "destroy",g_signal_connect_data ((window), ("destroy"), (((GCallback) (
ctk_widget_destroyed))), (&window), ((void*)0), (GConnectFlags
) 0)
3742 G_CALLBACK (ctk_widget_destroyed),g_signal_connect_data ((window), ("destroy"), (((GCallback) (
ctk_widget_destroyed))), (&window), ((void*)0), (GConnectFlags
) 0)
3743 &window)g_signal_connect_data ((window), ("destroy"), (((GCallback) (
ctk_widget_destroyed))), (&window), ((void*)0), (GConnectFlags
) 0)
;
3744
3745 content_area = ctk_dialog_get_content_area (CTK_DIALOG (window)((((CtkDialog*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((window)), ((ctk_dialog_get_type ()))))))
);
3746
3747 ctk_window_set_title (CTK_WINDOW (window)((((CtkWindow*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((window)), ((ctk_window_get_type ()))))))
, "dialog");
3748 ctk_container_set_border_width (CTK_CONTAINER (window)((((CtkContainer*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((window)), ((ctk_container_get_type ()))))))
, 0);
3749
3750 scrolled_window = ctk_scrolled_window_new (NULL((void*)0), NULL((void*)0));
3751 ctk_container_set_border_width (CTK_CONTAINER (scrolled_window)((((CtkContainer*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((scrolled_window)), ((ctk_container_get_type ()))))))
, 10);
3752 ctk_scrolled_window_set_policy (CTK_SCROLLED_WINDOW (scrolled_window)((((CtkScrolledWindow*) (void *) g_type_check_instance_cast (
(GTypeInstance*) ((scrolled_window)), ((ctk_scrolled_window_get_type
()))))))
,
3753 CTK_POLICY_AUTOMATIC,
3754 CTK_POLICY_AUTOMATIC);
3755 ctk_box_pack_start (CTK_BOX (content_area)((((CtkBox*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((content_area)), ((ctk_box_get_type ()))))))
, scrolled_window, TRUE(!(0)), TRUE(!(0)), 0);
3756 ctk_widget_show (scrolled_window);
3757
3758 grid = ctk_grid_new ();
3759 ctk_grid_set_row_spacing (CTK_GRID (grid)((((CtkGrid*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((grid)), ((ctk_grid_get_type ()))))))
, 10);
3760 ctk_grid_set_column_spacing (CTK_GRID (grid)((((CtkGrid*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((grid)), ((ctk_grid_get_type ()))))))
, 10);
3761 ctk_container_add (CTK_CONTAINER (scrolled_window)((((CtkContainer*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((scrolled_window)), ((ctk_container_get_type ()))))))
, grid);
3762 ctk_container_set_focus_hadjustment (CTK_CONTAINER (grid)((((CtkContainer*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((grid)), ((ctk_container_get_type ()))))))
,
3763 ctk_scrolled_window_get_hadjustment (CTK_SCROLLED_WINDOW (scrolled_window)((((CtkScrolledWindow*) (void *) g_type_check_instance_cast (
(GTypeInstance*) ((scrolled_window)), ((ctk_scrolled_window_get_type
()))))))
));
3764 ctk_container_set_focus_vadjustment (CTK_CONTAINER (grid)((((CtkContainer*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((grid)), ((ctk_container_get_type ()))))))
,
3765 ctk_scrolled_window_get_vadjustment (CTK_SCROLLED_WINDOW (scrolled_window)((((CtkScrolledWindow*) (void *) g_type_check_instance_cast (
(GTypeInstance*) ((scrolled_window)), ((ctk_scrolled_window_get_type
()))))))
));
3766 ctk_widget_show (grid);
3767
3768 for (i = 0; i < 20; i++)
3769 for (j = 0; j < 20; j++)
3770 {
3771 sprintf (buffer, "button (%d,%d)\n", i, j);
3772 button = ctk_toggle_button_new_with_label (buffer);
3773 ctk_grid_attach (CTK_GRID (grid)((((CtkGrid*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((grid)), ((ctk_grid_get_type ()))))))
, button, i, j, 1, 1);
3774 ctk_widget_show (button);
3775 }
3776
3777 ctk_dialog_add_button (CTK_DIALOG (window)((((CtkDialog*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((window)), ((ctk_dialog_get_type ()))))))
,
3778 "Close",
3779 CTK_RESPONSE_CLOSE);
3780
3781 ctk_dialog_add_button (CTK_DIALOG (window)((((CtkDialog*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((window)), ((ctk_dialog_get_type ()))))))
,
3782 "Reparent Out",
3783 CTK_RESPONSE_APPLY);
3784
3785 g_signal_connect (window, "response",g_signal_connect_data ((window), ("response"), (((GCallback) (
scrolled_windows_remove))), (scrolled_window), ((void*)0), (GConnectFlags
) 0)
3786 G_CALLBACK (scrolled_windows_remove),g_signal_connect_data ((window), ("response"), (((GCallback) (
scrolled_windows_remove))), (scrolled_window), ((void*)0), (GConnectFlags
) 0)
3787 scrolled_window)g_signal_connect_data ((window), ("response"), (((GCallback) (
scrolled_windows_remove))), (scrolled_window), ((void*)0), (GConnectFlags
) 0)
;
3788
3789 ctk_window_set_default_size (CTK_WINDOW (window)((((CtkWindow*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((window)), ((ctk_window_get_type ()))))))
, 300, 300);
3790 }
3791
3792 if (!ctk_widget_get_visible (window))
3793 ctk_widget_show (window);
3794 else
3795 ctk_widget_destroy (window);
3796}
3797
3798/*
3799 * CtkEntry
3800 */
3801
3802static void
3803entry_toggle_frame (CtkWidget *checkbutton,
3804 CtkWidget *entry)
3805{
3806 ctk_entry_set_has_frame (CTK_ENTRY(entry)((((CtkEntry*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((entry)), ((ctk_entry_get_type ()))))))
,
3807 ctk_toggle_button_get_active (CTK_TOGGLE_BUTTON (checkbutton)((((CtkToggleButton*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((checkbutton)), ((ctk_toggle_button_get_type ()))))))
));
3808}
3809
3810static void
3811entry_toggle_sensitive (CtkWidget *checkbutton,
3812 CtkWidget *entry)
3813{
3814 ctk_widget_set_sensitive (entry,
3815 ctk_toggle_button_get_active (CTK_TOGGLE_BUTTON(checkbutton)((((CtkToggleButton*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((checkbutton)), ((ctk_toggle_button_get_type ()))))))
));
3816}
3817
3818static gboolean
3819entry_progress_timeout (gpointer data)
3820{
3821 if (GPOINTER_TO_INT (g_object_get_data (G_OBJECT (data), "progress-pulse"))((gint) (glong) (g_object_get_data (((((GObject*) (void *) g_type_check_instance_cast
((GTypeInstance*) ((data)), (((GType) ((20) << (2)))))
))), "progress-pulse")))
)
3822 {
3823 ctk_entry_progress_pulse (CTK_ENTRY (data)((((CtkEntry*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((data)), ((ctk_entry_get_type ()))))))
);
3824 }
3825 else
3826 {
3827 gdouble fraction;
3828
3829 fraction = ctk_entry_get_progress_fraction (CTK_ENTRY (data)((((CtkEntry*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((data)), ((ctk_entry_get_type ()))))))
);
3830
3831 fraction += 0.05;
3832 if (fraction > 1.0001)
3833 fraction = 0.0;
3834
3835 ctk_entry_set_progress_fraction (CTK_ENTRY (data)((((CtkEntry*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((data)), ((ctk_entry_get_type ()))))))
, fraction);
3836 }
3837
3838 return G_SOURCE_CONTINUE(!(0));
3839}
3840
3841static void
3842entry_remove_timeout (gpointer data)
3843{
3844 g_source_remove (GPOINTER_TO_UINT (data)((guint) (gulong) (data)));
3845}
3846
3847static void
3848entry_toggle_progress (CtkWidget *checkbutton,
3849 CtkWidget *entry)
3850{
3851 if (ctk_toggle_button_get_active (CTK_TOGGLE_BUTTON (checkbutton)((((CtkToggleButton*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((checkbutton)), ((ctk_toggle_button_get_type ()))))))
))
3852 {
3853 guint timeout = cdk_threads_add_timeout (100,
3854 entry_progress_timeout,
3855 entry);
3856 g_object_set_data_full (G_OBJECT (entry)((((GObject*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((entry)), (((GType) ((20) << (2))))))))
, "timeout-id",
3857 GUINT_TO_POINTER (timeout)((gpointer) (gulong) (timeout)),
3858 entry_remove_timeout);
3859 }
3860 else
3861 {
3862 g_object_set_data (G_OBJECT (entry)((((GObject*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((entry)), (((GType) ((20) << (2))))))))
, "timeout-id",
3863 GUINT_TO_POINTER (0)((gpointer) (gulong) (0)));
3864
3865 ctk_entry_set_progress_fraction (CTK_ENTRY (entry)((((CtkEntry*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((entry)), ((ctk_entry_get_type ()))))))
, 0.0);
3866 }
3867}
3868
3869static void
3870entry_toggle_pulse (CtkWidget *checkbutton,
3871 CtkWidget *entry)
3872{
3873 g_object_set_data (G_OBJECT (entry)((((GObject*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((entry)), (((GType) ((20) << (2))))))))
, "progress-pulse",
3874 GUINT_TO_POINTER ((guint) ctk_toggle_button_get_active (CTK_TOGGLE_BUTTON (checkbutton)))((gpointer) (gulong) ((guint) ctk_toggle_button_get_active ((
(((CtkToggleButton*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((checkbutton)), ((ctk_toggle_button_get_type ())))))))))
);
3875}
3876
3877static void
3878create_entry (CtkWidget *widget)
3879{
3880 static CtkWidget *window = NULL((void*)0);
3881
3882 if (!window)
3883 {
3884 CtkWidget *box1;
3885 CtkWidget *box2;
3886 CtkWidget *hbox;
3887 CtkWidget *has_frame_check;
3888 CtkWidget *sensitive_check;
3889 CtkWidget *progress_check;
3890 CtkWidget *entry;
3891 CtkComboBoxText *cb;
3892 CtkWidget *cb_entry;
3893 CtkWidget *button;
3894 CtkWidget *separator;
3895
3896 window = ctk_window_new (CTK_WINDOW_TOPLEVEL);
3897 ctk_window_set_screen (CTK_WINDOW (window)((((CtkWindow*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((window)), ((ctk_window_get_type ()))))))
,
3898 ctk_widget_get_screen (widget));
3899
3900 g_signal_connect (window, "destroy",g_signal_connect_data ((window), ("destroy"), (((GCallback) (
ctk_widget_destroyed))), (&window), ((void*)0), (GConnectFlags
) 0)
3901 G_CALLBACK (ctk_widget_destroyed),g_signal_connect_data ((window), ("destroy"), (((GCallback) (
ctk_widget_destroyed))), (&window), ((void*)0), (GConnectFlags
) 0)
3902 &window)g_signal_connect_data ((window), ("destroy"), (((GCallback) (
ctk_widget_destroyed))), (&window), ((void*)0), (GConnectFlags
) 0)
;
3903
3904 ctk_window_set_title (CTK_WINDOW (window)((((CtkWindow*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((window)), ((ctk_window_get_type ()))))))
, "entry");
3905 ctk_container_set_border_width (CTK_CONTAINER (window)((((CtkContainer*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((window)), ((ctk_container_get_type ()))))))
, 0);
3906
3907
3908 box1 = ctk_box_new (CTK_ORIENTATION_VERTICAL, 0);
3909 ctk_container_add (CTK_CONTAINER (window)((((CtkContainer*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((window)), ((ctk_container_get_type ()))))))
, box1);
3910
3911
3912 box2 = ctk_box_new (CTK_ORIENTATION_VERTICAL, 10);
3913 ctk_container_set_border_width (CTK_CONTAINER (box2)((((CtkContainer*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((box2)), ((ctk_container_get_type ()))))))
, 10);
3914 ctk_box_pack_start (CTK_BOX (box1)((((CtkBox*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((box1)), ((ctk_box_get_type ()))))))
, box2, TRUE(!(0)), TRUE(!(0)), 0);
3915
3916 hbox = ctk_box_new (CTK_ORIENTATION_HORIZONTAL, 5);
3917 ctk_box_pack_start (CTK_BOX (box2)((((CtkBox*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((box2)), ((ctk_box_get_type ()))))))
, hbox, TRUE(!(0)), TRUE(!(0)), 0);
3918
3919 entry = ctk_entry_new ();
3920 ctk_entry_set_text (CTK_ENTRY (entry)((((CtkEntry*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((entry)), ((ctk_entry_get_type ()))))))
, "hello world \330\247\331\204\330\263\331\204\330\247\331\205 \330\271\331\204\331\212\331\203\331\205");
3921 ctk_editable_select_region (CTK_EDITABLE (entry)((((CtkEditable*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((entry)), ((ctk_editable_get_type ()))))))
, 0, 5);
3922 ctk_box_pack_start (CTK_BOX (hbox)((((CtkBox*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((hbox)), ((ctk_box_get_type ()))))))
, entry, TRUE(!(0)), TRUE(!(0)), 0);
3923
3924 cb = CTK_COMBO_BOX_TEXT (ctk_combo_box_text_new_with_entry ())((((CtkComboBoxText*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((ctk_combo_box_text_new_with_entry ())), ((ctk_combo_box_text_get_type
()))))))
;
3925
3926 ctk_combo_box_text_append_text (cb, "item0");
3927 ctk_combo_box_text_append_text (cb, "item0");
3928 ctk_combo_box_text_append_text (cb, "item1 item1");
3929 ctk_combo_box_text_append_text (cb, "item2 item2 item2");
3930 ctk_combo_box_text_append_text (cb, "item3 item3 item3 item3");
3931 ctk_combo_box_text_append_text (cb, "item4 item4 item4 item4 item4");
3932 ctk_combo_box_text_append_text (cb, "item5 item5 item5 item5 item5 item5");
3933 ctk_combo_box_text_append_text (cb, "item6 item6 item6 item6 item6");
3934 ctk_combo_box_text_append_text (cb, "item7 item7 item7 item7");
3935 ctk_combo_box_text_append_text (cb, "item8 item8 item8");
3936 ctk_combo_box_text_append_text (cb, "item9 item9");
3937
3938 cb_entry = ctk_bin_get_child (CTK_BIN (cb)((((CtkBin*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((cb)), ((ctk_bin_get_type ()))))))
);
3939 ctk_entry_set_text (CTK_ENTRY (cb_entry)((((CtkEntry*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((cb_entry)), ((ctk_entry_get_type ()))))))
, "hello world \n\n\n foo");
3940 ctk_editable_select_region (CTK_EDITABLE (cb_entry)((((CtkEditable*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((cb_entry)), ((ctk_editable_get_type ()))))))
, 0, -1);
3941 ctk_box_pack_start (CTK_BOX (box2)((((CtkBox*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((box2)), ((ctk_box_get_type ()))))))
, CTK_WIDGET (cb)((((CtkWidget*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((cb)), ((ctk_widget_get_type ()))))))
, TRUE(!(0)), TRUE(!(0)), 0);
3942
3943 sensitive_check = ctk_check_button_new_with_label("Sensitive");
3944 ctk_box_pack_start (CTK_BOX (box2)((((CtkBox*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((box2)), ((ctk_box_get_type ()))))))
, sensitive_check, FALSE(0), TRUE(!(0)), 0);
3945 g_signal_connect (sensitive_check, "toggled",g_signal_connect_data ((sensitive_check), ("toggled"), (((GCallback
) (entry_toggle_sensitive))), (entry), ((void*)0), (GConnectFlags
) 0)
3946 G_CALLBACK (entry_toggle_sensitive), entry)g_signal_connect_data ((sensitive_check), ("toggled"), (((GCallback
) (entry_toggle_sensitive))), (entry), ((void*)0), (GConnectFlags
) 0)
;
3947 ctk_toggle_button_set_active (CTK_TOGGLE_BUTTON (sensitive_check)((((CtkToggleButton*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((sensitive_check)), ((ctk_toggle_button_get_type ()))))))
, TRUE(!(0)));
3948
3949 has_frame_check = ctk_check_button_new_with_label("Has Frame");
3950 ctk_box_pack_start (CTK_BOX (box2)((((CtkBox*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((box2)), ((ctk_box_get_type ()))))))
, has_frame_check, FALSE(0), TRUE(!(0)), 0);
3951 g_signal_connect (has_frame_check, "toggled",g_signal_connect_data ((has_frame_check), ("toggled"), (((GCallback
) (entry_toggle_frame))), (entry), ((void*)0), (GConnectFlags
) 0)
3952 G_CALLBACK (entry_toggle_frame), entry)g_signal_connect_data ((has_frame_check), ("toggled"), (((GCallback
) (entry_toggle_frame))), (entry), ((void*)0), (GConnectFlags
) 0)
;
3953 ctk_toggle_button_set_active (CTK_TOGGLE_BUTTON (has_frame_check)((((CtkToggleButton*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((has_frame_check)), ((ctk_toggle_button_get_type ()))))))
, TRUE(!(0)));
3954
3955 progress_check = ctk_check_button_new_with_label("Show Progress");
3956 ctk_box_pack_start (CTK_BOX (box2)((((CtkBox*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((box2)), ((ctk_box_get_type ()))))))
, progress_check, FALSE(0), TRUE(!(0)), 0);
3957 g_signal_connect (progress_check, "toggled",g_signal_connect_data ((progress_check), ("toggled"), (((GCallback
) (entry_toggle_progress))), (entry), ((void*)0), (GConnectFlags
) 0)
3958 G_CALLBACK (entry_toggle_progress), entry)g_signal_connect_data ((progress_check), ("toggled"), (((GCallback
) (entry_toggle_progress))), (entry), ((void*)0), (GConnectFlags
) 0)
;
3959
3960 progress_check = ctk_check_button_new_with_label("Pulse Progress");
3961 ctk_box_pack_start (CTK_BOX (box2)((((CtkBox*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((box2)), ((ctk_box_get_type ()))))))
, progress_check, FALSE(0), TRUE(!(0)), 0);
3962 g_signal_connect (progress_check, "toggled",g_signal_connect_data ((progress_check), ("toggled"), (((GCallback
) (entry_toggle_pulse))), (entry), ((void*)0), (GConnectFlags
) 0)
3963 G_CALLBACK (entry_toggle_pulse), entry)g_signal_connect_data ((progress_check), ("toggled"), (((GCallback
) (entry_toggle_pulse))), (entry), ((void*)0), (GConnectFlags
) 0)
;
3964
3965 separator = ctk_separator_new (CTK_ORIENTATION_HORIZONTAL);
3966 ctk_box_pack_start (CTK_BOX (box1)((((CtkBox*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((box1)), ((ctk_box_get_type ()))))))
, separator, FALSE(0), TRUE(!(0)), 0);
3967
3968 box2 = ctk_box_new (CTK_ORIENTATION_VERTICAL, 10);
3969 ctk_container_set_border_width (CTK_CONTAINER (box2)((((CtkContainer*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((box2)), ((ctk_container_get_type ()))))))
, 10);
3970 ctk_box_pack_start (CTK_BOX (box1)((((CtkBox*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((box1)), ((ctk_box_get_type ()))))))
, box2, FALSE(0), TRUE(!(0)), 0);
3971
3972 button = ctk_button_new_with_label ("close");
3973 g_signal_connect_swapped (button, "clicked",g_signal_connect_data ((button), ("clicked"), (((GCallback) (
ctk_widget_destroy))), (window), ((void*)0), G_CONNECT_SWAPPED
)
3974 G_CALLBACK (ctk_widget_destroy),g_signal_connect_data ((button), ("clicked"), (((GCallback) (
ctk_widget_destroy))), (window), ((void*)0), G_CONNECT_SWAPPED
)
3975 window)g_signal_connect_data ((button), ("clicked"), (((GCallback) (
ctk_widget_destroy))), (window), ((void*)0), G_CONNECT_SWAPPED
)
;
3976 ctk_box_pack_start (CTK_BOX (box2)((((CtkBox*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((box2)), ((ctk_box_get_type ()))))))
, button, TRUE(!(0)), TRUE(!(0)), 0);
3977 ctk_widget_set_can_default (button, TRUE(!(0)));
3978 ctk_widget_grab_default (button);
3979 }
3980
3981 if (!ctk_widget_get_visible (window))
3982 ctk_widget_show_all (window);
3983 else
3984 ctk_widget_destroy (window);
3985}
3986
3987static void
3988create_expander (CtkWidget *widget)
3989{
3990 static CtkWidget *window = NULL((void*)0);
3991
3992 if (!window)
3993 {
3994 CtkWidget *box1;
3995 CtkWidget *expander;
3996 CtkWidget *hidden;
3997
3998 window = ctk_window_new (CTK_WINDOW_TOPLEVEL);
3999 ctk_window_set_screen (CTK_WINDOW (window)((((CtkWindow*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((window)), ((ctk_window_get_type ()))))))
,
4000 ctk_widget_get_screen (widget));
4001
4002 g_signal_connect (window, "destroy",g_signal_connect_data ((window), ("destroy"), (((GCallback) (
ctk_widget_destroyed))), (&window), ((void*)0), (GConnectFlags
) 0)
4003 G_CALLBACK (ctk_widget_destroyed),g_signal_connect_data ((window), ("destroy"), (((GCallback) (
ctk_widget_destroyed))), (&window), ((void*)0), (GConnectFlags
) 0)
4004 &window)g_signal_connect_data ((window), ("destroy"), (((GCallback) (
ctk_widget_destroyed))), (&window), ((void*)0), (GConnectFlags
) 0)
;
4005
4006 ctk_window_set_title (CTK_WINDOW (window)((((CtkWindow*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((window)), ((ctk_window_get_type ()))))))
, "expander");
4007 ctk_container_set_border_width (CTK_CONTAINER (window)((((CtkContainer*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((window)), ((ctk_container_get_type ()))))))
, 0);
4008
4009 box1 = ctk_box_new (CTK_ORIENTATION_VERTICAL, 0);
4010 ctk_container_add (CTK_CONTAINER (window)((((CtkContainer*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((window)), ((ctk_container_get_type ()))))))
, box1);
4011
4012 expander = ctk_expander_new ("The Hidden");
4013
4014 ctk_box_pack_start (CTK_BOX (box1)((((CtkBox*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((box1)), ((ctk_box_get_type ()))))))
, expander, TRUE(!(0)), TRUE(!(0)), 0);
4015
4016 hidden = ctk_label_new ("Revealed!");
4017
4018 ctk_container_add (CTK_CONTAINER (expander)((((CtkContainer*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((expander)), ((ctk_container_get_type ()))))))
, hidden);
4019 }
4020
4021 if (!ctk_widget_get_visible (window))
4022 ctk_widget_show_all (window);
4023 else
4024 ctk_widget_destroy (window);
4025}
4026
4027
4028/* CtkEventBox */
4029
4030
4031static gboolean
4032event_box_draw (CtkWidget *widget,
4033 cairo_t *cr,
4034 gpointer user_data G_GNUC_UNUSED__attribute__ ((__unused__)))
4035{
4036 if (ctk_widget_get_window (widget) ==
4037 ctk_widget_get_window (ctk_widget_get_parent (widget)))
4038 return FALSE(0);
4039
4040 cairo_set_source_rgb (cr, 0, 1, 0);
4041 cairo_paint (cr);
4042
4043 return FALSE(0);
4044}
4045
4046static void
4047event_box_label_pressed (CtkWidget *widget G_GNUC_UNUSED__attribute__ ((__unused__)),
4048 CdkEventButton *event G_GNUC_UNUSED__attribute__ ((__unused__)),
4049 gpointer user_data G_GNUC_UNUSED__attribute__ ((__unused__)))
4050{
4051 g_print ("clicked on event box\n");
4052}
4053
4054static void
4055event_box_button_clicked (CtkWidget *widget G_GNUC_UNUSED__attribute__ ((__unused__)),
4056 CtkWidget *button G_GNUC_UNUSED__attribute__ ((__unused__)),
4057 gpointer user_data G_GNUC_UNUSED__attribute__ ((__unused__)))
4058{
4059 g_print ("pushed button\n");
4060}
4061
4062static void
4063event_box_toggle_visible_window (CtkWidget *checkbutton,
4064 CtkEventBox *event_box)
4065{
4066 ctk_event_box_set_visible_window (event_box,
4067 ctk_toggle_button_get_active (CTK_TOGGLE_BUTTON (checkbutton)((((CtkToggleButton*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((checkbutton)), ((ctk_toggle_button_get_type ()))))))
));
4068}
4069
4070static void
4071event_box_toggle_above_child (CtkWidget *checkbutton,
4072 CtkEventBox *event_box)
4073{
4074 ctk_event_box_set_above_child (event_box,
4075 ctk_toggle_button_get_active (CTK_TOGGLE_BUTTON (checkbutton)((((CtkToggleButton*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((checkbutton)), ((ctk_toggle_button_get_type ()))))))
));
4076}
4077
4078static void
4079create_event_box (CtkWidget *widget)
4080{
4081 static CtkWidget *window = NULL((void*)0);
4082
4083 if (!window)
4084 {
4085 CtkWidget *box1;
4086 CtkWidget *box2;
4087 CtkWidget *hbox;
4088 CtkWidget *vbox;
4089 CtkWidget *button;
4090 CtkWidget *separator;
4091 CtkWidget *event_box;
4092 CtkWidget *label;
4093 CtkWidget *visible_window_check;
4094 CtkWidget *above_child_check;
4095
4096 window = ctk_window_new (CTK_WINDOW_TOPLEVEL);
4097 ctk_window_set_screen (CTK_WINDOW (window)((((CtkWindow*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((window)), ((ctk_window_get_type ()))))))
,
4098 ctk_widget_get_screen (widget));
4099
4100 g_signal_connect (window, "destroy",g_signal_connect_data ((window), ("destroy"), (((GCallback) (
ctk_widget_destroyed))), (&window), ((void*)0), (GConnectFlags
) 0)
4101 G_CALLBACK (ctk_widget_destroyed),g_signal_connect_data ((window), ("destroy"), (((GCallback) (
ctk_widget_destroyed))), (&window), ((void*)0), (GConnectFlags
) 0)
4102 &window)g_signal_connect_data ((window), ("destroy"), (((GCallback) (
ctk_widget_destroyed))), (&window), ((void*)0), (GConnectFlags
) 0)
;
4103
4104 ctk_window_set_title (CTK_WINDOW (window)((((CtkWindow*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((window)), ((ctk_window_get_type ()))))))
, "event box");
4105 ctk_container_set_border_width (CTK_CONTAINER (window)((((CtkContainer*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((window)), ((ctk_container_get_type ()))))))
, 0);
4106
4107 box1 = ctk_box_new (CTK_ORIENTATION_VERTICAL, 0);
4108 ctk_container_add (CTK_CONTAINER (window)((((CtkContainer*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((window)), ((ctk_container_get_type ()))))))
, box1);
4109
4110 hbox = ctk_box_new (CTK_ORIENTATION_HORIZONTAL, 0);
4111 ctk_box_pack_start (CTK_BOX (box1)((((CtkBox*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((box1)), ((ctk_box_get_type ()))))))
, hbox, TRUE(!(0)), FALSE(0), 0);
4112
4113 event_box = ctk_event_box_new ();
4114 ctk_box_pack_start (CTK_BOX (hbox)((((CtkBox*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((hbox)), ((ctk_box_get_type ()))))))
, event_box, TRUE(!(0)), FALSE(0), 0);
4115
4116 vbox = ctk_box_new (CTK_ORIENTATION_VERTICAL, 0);
4117 ctk_container_add (CTK_CONTAINER (event_box)((((CtkContainer*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((event_box)), ((ctk_container_get_type ()))))))
, vbox);
4118 g_signal_connect (event_box, "button_press_event",g_signal_connect_data ((event_box), ("button_press_event"), (
((GCallback) (event_box_label_pressed))), (((void*)0)), ((void
*)0), (GConnectFlags) 0)
4119 G_CALLBACK (event_box_label_pressed),g_signal_connect_data ((event_box), ("button_press_event"), (
((GCallback) (event_box_label_pressed))), (((void*)0)), ((void
*)0), (GConnectFlags) 0)
4120 NULL)g_signal_connect_data ((event_box), ("button_press_event"), (
((GCallback) (event_box_label_pressed))), (((void*)0)), ((void
*)0), (GConnectFlags) 0)
;
4121 g_signal_connect (event_box, "draw",g_signal_connect_data ((event_box), ("draw"), (((GCallback) (
event_box_draw))), (((void*)0)), ((void*)0), (GConnectFlags) 0
)
4122 G_CALLBACK (event_box_draw),g_signal_connect_data ((event_box), ("draw"), (((GCallback) (
event_box_draw))), (((void*)0)), ((void*)0), (GConnectFlags) 0
)
4123 NULL)g_signal_connect_data ((event_box), ("draw"), (((GCallback) (
event_box_draw))), (((void*)0)), ((void*)0), (GConnectFlags) 0
)
;
4124
4125 label = ctk_label_new ("Click on this label");
4126 ctk_box_pack_start (CTK_BOX (vbox)((((CtkBox*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((vbox)), ((ctk_box_get_type ()))))))
, label, TRUE(!(0)), FALSE(0), 0);
4127
4128 button = ctk_button_new_with_label ("button in eventbox");
4129 ctk_box_pack_start (CTK_BOX (vbox)((((CtkBox*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((vbox)), ((ctk_box_get_type ()))))))
, button, TRUE(!(0)), FALSE(0), 0);
4130 g_signal_connect (button, "clicked",g_signal_connect_data ((button), ("clicked"), (((GCallback) (
event_box_button_clicked))), (((void*)0)), ((void*)0), (GConnectFlags
) 0)
4131 G_CALLBACK (event_box_button_clicked),g_signal_connect_data ((button), ("clicked"), (((GCallback) (
event_box_button_clicked))), (((void*)0)), ((void*)0), (GConnectFlags
) 0)
4132 NULL)g_signal_connect_data ((button), ("clicked"), (((GCallback) (
event_box_button_clicked))), (((void*)0)), ((void*)0), (GConnectFlags
) 0)
;
4133
4134
4135 visible_window_check = ctk_check_button_new_with_label("Visible Window");
4136 ctk_box_pack_start (CTK_BOX (box1)((((CtkBox*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((box1)), ((ctk_box_get_type ()))))))
, visible_window_check, FALSE(0), TRUE(!(0)), 0);
4137 g_signal_connect (visible_window_check, "toggled",g_signal_connect_data ((visible_window_check), ("toggled"), (
((GCallback) (event_box_toggle_visible_window))), (event_box)
, ((void*)0), (GConnectFlags) 0)
4138 G_CALLBACK (event_box_toggle_visible_window), event_box)g_signal_connect_data ((visible_window_check), ("toggled"), (
((GCallback) (event_box_toggle_visible_window))), (event_box)
, ((void*)0), (GConnectFlags) 0)
;
4139 ctk_toggle_button_set_active (CTK_TOGGLE_BUTTON (visible_window_check)((((CtkToggleButton*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((visible_window_check)), ((ctk_toggle_button_get_type ())
)))))
, TRUE(!(0)));
4140
4141 above_child_check = ctk_check_button_new_with_label("Above Child");
4142 ctk_box_pack_start (CTK_BOX (box1)((((CtkBox*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((box1)), ((ctk_box_get_type ()))))))
, above_child_check, FALSE(0), TRUE(!(0)), 0);
4143 g_signal_connect (above_child_check, "toggled",g_signal_connect_data ((above_child_check), ("toggled"), (((GCallback
) (event_box_toggle_above_child))), (event_box), ((void*)0), (
GConnectFlags) 0)
4144 G_CALLBACK (event_box_toggle_above_child), event_box)g_signal_connect_data ((above_child_check), ("toggled"), (((GCallback
) (event_box_toggle_above_child))), (event_box), ((void*)0), (
GConnectFlags) 0)
;
4145 ctk_toggle_button_set_active (CTK_TOGGLE_BUTTON (above_child_check)((((CtkToggleButton*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((above_child_check)), ((ctk_toggle_button_get_type ()))))
))
, FALSE(0));
4146
4147 separator = ctk_separator_new (CTK_ORIENTATION_HORIZONTAL);
4148 ctk_box_pack_start (CTK_BOX (box1)((((CtkBox*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((box1)), ((ctk_box_get_type ()))))))
, separator, FALSE(0), TRUE(!(0)), 0);
4149
4150 box2 = ctk_box_new (CTK_ORIENTATION_VERTICAL, 10);
4151 ctk_container_set_border_width (CTK_CONTAINER (box2)((((CtkContainer*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((box2)), ((ctk_container_get_type ()))))))
, 10);
4152 ctk_box_pack_start (CTK_BOX (box1)((((CtkBox*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((box1)), ((ctk_box_get_type ()))))))
, box2, FALSE(0), TRUE(!(0)), 0);
4153
4154 button = ctk_button_new_with_label ("close");
4155 g_signal_connect_swapped (button, "clicked",g_signal_connect_data ((button), ("clicked"), (((GCallback) (
ctk_widget_destroy))), (window), ((void*)0), G_CONNECT_SWAPPED
)
4156 G_CALLBACK (ctk_widget_destroy),g_signal_connect_data ((button), ("clicked"), (((GCallback) (
ctk_widget_destroy))), (window), ((void*)0), G_CONNECT_SWAPPED
)
4157 window)g_signal_connect_data ((button), ("clicked"), (((GCallback) (
ctk_widget_destroy))), (window), ((void*)0), G_CONNECT_SWAPPED
)
;
4158 ctk_box_pack_start (CTK_BOX (box2)((((CtkBox*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((box2)), ((ctk_box_get_type ()))))))
, button, TRUE(!(0)), TRUE(!(0)), 0);
4159 ctk_widget_set_can_default (button, TRUE(!(0)));
4160 ctk_widget_grab_default (button);
4161 }
4162
4163 if (!ctk_widget_get_visible (window))
4164 ctk_widget_show_all (window);
4165 else
4166 ctk_widget_destroy (window);
4167}
4168
4169
4170/*
4171 * CtkSizeGroup
4172 */
4173
4174#define SIZE_GROUP_INITIAL_SIZE50 50
4175
4176static void
4177size_group_hsize_changed (CtkSpinButton *spin_button,
4178 CtkWidget *button)
4179{
4180 ctk_widget_set_size_request (ctk_bin_get_child (CTK_BIN (button)((((CtkBin*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((button)), ((ctk_bin_get_type ()))))))
),
4181 ctk_spin_button_get_value_as_int (spin_button),
4182 -1);
4183}
4184
4185static void
4186size_group_vsize_changed (CtkSpinButton *spin_button,
4187 CtkWidget *button)
4188{
4189 ctk_widget_set_size_request (ctk_bin_get_child (CTK_BIN (button)((((CtkBin*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((button)), ((ctk_bin_get_type ()))))))
),
4190 -1,
4191 ctk_spin_button_get_value_as_int (spin_button));
4192}
4193
4194static CtkWidget *
4195create_size_group_window (CdkScreen *screen,
4196 CtkSizeGroup *master_size_group)
4197{
4198 CtkWidget *content_area;
4199 CtkWidget *window;
4200 CtkWidget *grid;
4201 CtkWidget *main_button;
4202 CtkWidget *button;
4203 CtkWidget *spin_button;
4204 CtkWidget *hbox;
4205 CtkSizeGroup *hgroup1;
4206 CtkSizeGroup *hgroup2;
4207 CtkSizeGroup *vgroup1;
4208 CtkSizeGroup *vgroup2;
4209
4210 window = ctk_dialog_new_with_buttons ("CtkSizeGroup",
4211 NULL((void*)0), 0,
4212 "_Close",
4213 CTK_RESPONSE_NONE,
4214 NULL((void*)0));
4215
4216 ctk_window_set_screen (CTK_WINDOW (window)((((CtkWindow*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((window)), ((ctk_window_get_type ()))))))
, screen);
4217
4218 ctk_window_set_resizable (CTK_WINDOW (window)((((CtkWindow*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((window)), ((ctk_window_get_type ()))))))
, TRUE(!(0)));
4219
4220 g_signal_connect (window, "response",g_signal_connect_data ((window), ("response"), (((GCallback) (
ctk_widget_destroy))), (((void*)0)), ((void*)0), (GConnectFlags
) 0)
4221 G_CALLBACK (ctk_widget_destroy),g_signal_connect_data ((window), ("response"), (((GCallback) (
ctk_widget_destroy))), (((void*)0)), ((void*)0), (GConnectFlags
) 0)
4222 NULL)g_signal_connect_data ((window), ("response"), (((GCallback) (
ctk_widget_destroy))), (((void*)0)), ((void*)0), (GConnectFlags
) 0)
;
4223
4224 content_area = ctk_dialog_get_content_area (CTK_DIALOG (window)((((CtkDialog*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((window)), ((ctk_dialog_get_type ()))))))
);
4225
4226 grid = ctk_grid_new ();
4227 ctk_box_pack_start (CTK_BOX (content_area)((((CtkBox*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((content_area)), ((ctk_box_get_type ()))))))
, grid, TRUE(!(0)), TRUE(!(0)), 0);
4228
4229 ctk_grid_set_row_spacing (CTK_GRID (grid)((((CtkGrid*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((grid)), ((ctk_grid_get_type ()))))))
, 5);
4230 ctk_grid_set_column_spacing (CTK_GRID (grid)((((CtkGrid*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((grid)), ((ctk_grid_get_type ()))))))
, 5);
4231 ctk_container_set_border_width (CTK_CONTAINER (grid)((((CtkContainer*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((grid)), ((ctk_container_get_type ()))))))
, 5);
4232 ctk_widget_set_size_request (grid, 250, 250);
4233
4234 hgroup1 = ctk_size_group_new (CTK_SIZE_GROUP_HORIZONTAL);
4235 hgroup2 = ctk_size_group_new (CTK_SIZE_GROUP_HORIZONTAL);
4236 vgroup1 = ctk_size_group_new (CTK_SIZE_GROUP_VERTICAL);
4237 vgroup2 = ctk_size_group_new (CTK_SIZE_GROUP_VERTICAL);
4238
4239 main_button = ctk_button_new_with_label ("X");
4240 ctk_widget_set_hexpand (main_button, TRUE(!(0)));
4241 ctk_widget_set_vexpand (main_button, TRUE(!(0)));
4242 ctk_widget_set_halign (main_button, CTK_ALIGN_CENTER);
4243 ctk_widget_set_valign (main_button, CTK_ALIGN_CENTER);
4244 ctk_grid_attach (CTK_GRID (grid)((((CtkGrid*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((grid)), ((ctk_grid_get_type ()))))))
, main_button, 0, 0, 1, 1);
4245
4246 ctk_size_group_add_widget (master_size_group, main_button);
4247 ctk_size_group_add_widget (hgroup1, main_button);
4248 ctk_size_group_add_widget (vgroup1, main_button);
4249 ctk_widget_set_size_request (ctk_bin_get_child (CTK_BIN (main_button)((((CtkBin*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((main_button)), ((ctk_bin_get_type ()))))))
),
4250 SIZE_GROUP_INITIAL_SIZE50,
4251 SIZE_GROUP_INITIAL_SIZE50);
4252
4253 button = ctk_button_new ();
4254 ctk_widget_set_hexpand (button, TRUE(!(0)));
4255 ctk_widget_set_vexpand (button, TRUE(!(0)));
4256 ctk_widget_set_halign (button, CTK_ALIGN_CENTER);
4257 ctk_widget_set_valign (button, CTK_ALIGN_CENTER);
4258 ctk_grid_attach (CTK_GRID (grid)((((CtkGrid*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((grid)), ((ctk_grid_get_type ()))))))
, button, 1, 0, 1, 1);
4259
4260 ctk_size_group_add_widget (vgroup1, button);
4261 ctk_size_group_add_widget (vgroup2, button);
4262
4263 button = ctk_button_new ();
4264 ctk_widget_set_hexpand (button, TRUE(!(0)));
4265 ctk_widget_set_vexpand (button, TRUE(!(0)));
4266 ctk_widget_set_halign (button, CTK_ALIGN_CENTER);
4267 ctk_widget_set_valign (button, CTK_ALIGN_CENTER);
4268 ctk_grid_attach (CTK_GRID (grid)((((CtkGrid*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((grid)), ((ctk_grid_get_type ()))))))
, button, 0, 1, 1, 1);
4269
4270 ctk_size_group_add_widget (hgroup1, button);
4271 ctk_size_group_add_widget (hgroup2, button);
4272
4273 button = ctk_button_new ();
4274 ctk_widget_set_hexpand (button, TRUE(!(0)));
4275 ctk_widget_set_vexpand (button, TRUE(!(0)));
4276 ctk_widget_set_halign (button, CTK_ALIGN_CENTER);
4277 ctk_widget_set_valign (button, CTK_ALIGN_CENTER);
4278 ctk_grid_attach (CTK_GRID (grid)((((CtkGrid*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((grid)), ((ctk_grid_get_type ()))))))
, button, 1, 1, 1, 1);
4279
4280 ctk_size_group_add_widget (hgroup2, button);
4281 ctk_size_group_add_widget (vgroup2, button);
4282
4283 g_object_unref (hgroup1);
4284 g_object_unref (hgroup2);
4285 g_object_unref (vgroup1);
4286 g_object_unref (vgroup2);
4287
4288 hbox = ctk_box_new (CTK_ORIENTATION_HORIZONTAL, 5);
4289 ctk_box_pack_start (CTK_BOX (content_area)((((CtkBox*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((content_area)), ((ctk_box_get_type ()))))))
, hbox, FALSE(0), FALSE(0), 0);
4290
4291 spin_button = ctk_spin_button_new_with_range (1, 100, 1);
4292 ctk_spin_button_set_value (CTK_SPIN_BUTTON (spin_button)((((CtkSpinButton*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((spin_button)), ((ctk_spin_button_get_type ()))))))
, SIZE_GROUP_INITIAL_SIZE50);
4293 ctk_box_pack_start (CTK_BOX (hbox)((((CtkBox*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((hbox)), ((ctk_box_get_type ()))))))
, spin_button, TRUE(!(0)), TRUE(!(0)), 0);
4294 g_signal_connect (spin_button, "value_changed",g_signal_connect_data ((spin_button), ("value_changed"), (((GCallback
) (size_group_hsize_changed))), (main_button), ((void*)0), (GConnectFlags
) 0)
4295 G_CALLBACK (size_group_hsize_changed), main_button)g_signal_connect_data ((spin_button), ("value_changed"), (((GCallback
) (size_group_hsize_changed))), (main_button), ((void*)0), (GConnectFlags
) 0)
;
4296
4297 spin_button = ctk_spin_button_new_with_range (1, 100, 1);
4298 ctk_spin_button_set_value (CTK_SPIN_BUTTON (spin_button)((((CtkSpinButton*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((spin_button)), ((ctk_spin_button_get_type ()))))))
, SIZE_GROUP_INITIAL_SIZE50);
4299 ctk_box_pack_start (CTK_BOX (hbox)((((CtkBox*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((hbox)), ((ctk_box_get_type ()))))))
, spin_button, TRUE(!(0)), TRUE(!(0)), 0);
4300 g_signal_connect (spin_button, "value_changed",g_signal_connect_data ((spin_button), ("value_changed"), (((GCallback
) (size_group_vsize_changed))), (main_button), ((void*)0), (GConnectFlags
) 0)
4301 G_CALLBACK (size_group_vsize_changed), main_button)g_signal_connect_data ((spin_button), ("value_changed"), (((GCallback
) (size_group_vsize_changed))), (main_button), ((void*)0), (GConnectFlags
) 0)
;
4302
4303 return window;
4304}
4305
4306static void
4307create_size_groups (CtkWidget *widget)
4308{
4309 static CtkWidget *window1 = NULL((void*)0);
4310 static CtkWidget *window2 = NULL((void*)0);
4311 static CtkSizeGroup *master_size_group;
4312
4313 if (!master_size_group)
4314 master_size_group = ctk_size_group_new (CTK_SIZE_GROUP_BOTH);
4315
4316 if (!window1)
4317 {
4318 window1 = create_size_group_window (ctk_widget_get_screen (widget),
4319 master_size_group);
4320
4321 g_signal_connect (window1, "destroy",g_signal_connect_data ((window1), ("destroy"), (((GCallback) (
ctk_widget_destroyed))), (&window1), ((void*)0), (GConnectFlags
) 0)
4322 G_CALLBACK (ctk_widget_destroyed),g_signal_connect_data ((window1), ("destroy"), (((GCallback) (
ctk_widget_destroyed))), (&window1), ((void*)0), (GConnectFlags
) 0)
4323 &window1)g_signal_connect_data ((window1), ("destroy"), (((GCallback) (
ctk_widget_destroyed))), (&window1), ((void*)0), (GConnectFlags
) 0)
;
4324 }
4325
4326 if (!window2)
4327 {
4328 window2 = create_size_group_window (ctk_widget_get_screen (widget),
4329 master_size_group);
4330
4331 g_signal_connect (window2, "destroy",g_signal_connect_data ((window2), ("destroy"), (((GCallback) (
ctk_widget_destroyed))), (&window2), ((void*)0), (GConnectFlags
) 0)
4332 G_CALLBACK (ctk_widget_destroyed),g_signal_connect_data ((window2), ("destroy"), (((GCallback) (
ctk_widget_destroyed))), (&window2), ((void*)0), (GConnectFlags
) 0)
4333 &window2)g_signal_connect_data ((window2), ("destroy"), (((GCallback) (
ctk_widget_destroyed))), (&window2), ((void*)0), (GConnectFlags
) 0)
;
4334 }
4335
4336 if (ctk_widget_get_visible (window1) && ctk_widget_get_visible (window2))
4337 {
4338 ctk_widget_destroy (window1);
4339 ctk_widget_destroy (window2);
4340 }
4341 else
4342 {
4343 if (!ctk_widget_get_visible (window1))
4344 ctk_widget_show_all (window1);
4345 if (!ctk_widget_get_visible (window2))
4346 ctk_widget_show_all (window2);
4347 }
4348}
4349
4350/*
4351 * CtkSpinButton
4352 */
4353
4354static CtkWidget *spinner1;
4355
4356static void
4357toggle_snap (CtkWidget *widget, CtkSpinButton *spin)
4358{
4359 ctk_spin_button_set_snap_to_ticks (spin,
4360 ctk_toggle_button_get_active (CTK_TOGGLE_BUTTON (widget)((((CtkToggleButton*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((widget)), ((ctk_toggle_button_get_type ()))))))
));
4361}
4362
4363static void
4364toggle_numeric (CtkWidget *widget, CtkSpinButton *spin)
4365{
4366 ctk_spin_button_set_numeric (spin,
4367 ctk_toggle_button_get_active (CTK_TOGGLE_BUTTON (widget)((((CtkToggleButton*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((widget)), ((ctk_toggle_button_get_type ()))))))
));
4368}
4369
4370static void
4371change_digits (CtkWidget *widget G_GNUC_UNUSED__attribute__ ((__unused__)),
4372 CtkSpinButton *spin)
4373{
4374 ctk_spin_button_set_digits (CTK_SPIN_BUTTON (spinner1)((((CtkSpinButton*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((spinner1)), ((ctk_spin_button_get_type ()))))))
,
4375 ctk_spin_button_get_value_as_int (spin));
4376}
4377
4378static void
4379get_value (CtkWidget *widget, gpointer data)
4380{
4381 gchar buf[32];
4382 CtkLabel *label;
4383 CtkSpinButton *spin;
4384
4385 spin = CTK_SPIN_BUTTON (spinner1)((((CtkSpinButton*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((spinner1)), ((ctk_spin_button_get_type ()))))))
;
4386 label = CTK_LABEL (g_object_get_data (G_OBJECT (widget), "user_data"))((((CtkLabel*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((g_object_get_data (((((GObject*) (void *) g_type_check_instance_cast
((GTypeInstance*) ((widget)), (((GType) ((20) << (2)))
))))), "user_data"))), ((ctk_label_get_type ()))))))
;
4387 if (GPOINTER_TO_INT (data)((gint) (glong) (data)) == 1)
4388 sprintf (buf, "%d", ctk_spin_button_get_value_as_int (spin));
4389 else
4390 sprintf (buf, "%0.*f",
4391 ctk_spin_button_get_digits (spin),
4392 ctk_spin_button_get_value (spin));
4393
4394 ctk_label_set_text (label, buf);
4395}
4396
4397static void
4398get_spin_value (CtkWidget *widget, gpointer data)
4399{
4400 gchar *buffer;
4401 CtkLabel *label;
4402 CtkSpinButton *spin;
4403
4404 spin = CTK_SPIN_BUTTON (widget)((((CtkSpinButton*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((widget)), ((ctk_spin_button_get_type ()))))))
;
4405 label = CTK_LABEL (data)((((CtkLabel*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((data)), ((ctk_label_get_type ()))))))
;
4406
4407 buffer = g_strdup_printf ("%0.*f",
4408 ctk_spin_button_get_digits (spin),
4409 ctk_spin_button_get_value (spin));
4410 ctk_label_set_text (label, buffer);
4411
4412 g_free (buffer);
4413}
4414
4415static gint
4416spin_button_time_output_func (CtkSpinButton *spin_button)
4417{
4418 CtkAdjustment *adjustment;
4419 static gchar buf[6];
4420 gdouble hours;
4421 gdouble minutes;
4422
4423 adjustment = ctk_spin_button_get_adjustment (spin_button);
4424 hours = ctk_adjustment_get_value (adjustment) / 60.0;
4425 minutes = (fabs(floor (hours) - hours) < 1e-5) ? 0.0 : 30;
4426 sprintf (buf, "%02.0f:%02.0f", floor (hours), minutes);
4427 if (strcmp (buf, ctk_entry_get_text (CTK_ENTRY (spin_button)((((CtkEntry*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((spin_button)), ((ctk_entry_get_type ()))))))
)))
4428 ctk_entry_set_text (CTK_ENTRY (spin_button)((((CtkEntry*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((spin_button)), ((ctk_entry_get_type ()))))))
, buf);
4429 return TRUE(!(0));
4430}
4431
4432static gint
4433spin_button_month_input_func (CtkSpinButton *spin_button,
4434 gdouble *new_val)
4435{
4436 gint i;
4437 static gchar *month[12] = { "January", "February", "March", "April",
4438 "May", "June", "July", "August",
4439 "September", "October", "November", "December" };
4440 gboolean found = FALSE(0);
4441
4442 for (i = 1; i <= 12; i++)
4443 {
4444 gchar *tmp1, *tmp2;
4445
4446 tmp1 = g_ascii_strup (month[i - 1], -1);
4447 tmp2 = g_ascii_strup (ctk_entry_get_text (CTK_ENTRY (spin_button)((((CtkEntry*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((spin_button)), ((ctk_entry_get_type ()))))))
), -1);
4448 if (strstr (tmp1, tmp2) == tmp1)
4449 found = TRUE(!(0));
4450 g_free (tmp1);
4451 g_free (tmp2);
4452 if (found)
4453 break;
4454 }
4455 if (!found)
4456 {
4457 *new_val = 0.0;
4458 return CTK_INPUT_ERROR-1;
4459 }
4460 *new_val = (gdouble) i;
4461 return TRUE(!(0));
4462}
4463
4464static gint
4465spin_button_month_output_func (CtkSpinButton *spin_button)
4466{
4467 CtkAdjustment *adjustment;
4468 gdouble value;
4469 gint i;
4470 static gchar *month[12] = { "January", "February", "March", "April",
4471 "May", "June", "July", "August", "September",
4472 "October", "November", "December" };
4473
4474 adjustment = ctk_spin_button_get_adjustment (spin_button);
4475 value = ctk_adjustment_get_value (adjustment);
4476 for (i = 1; i <= 12; i++)
4477 if (fabs (value - (double)i) < 1e-5)
4478 {
4479 if (strcmp (month[i-1], ctk_entry_get_text (CTK_ENTRY (spin_button)((((CtkEntry*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((spin_button)), ((ctk_entry_get_type ()))))))
)))
4480 ctk_entry_set_text (CTK_ENTRY (spin_button)((((CtkEntry*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((spin_button)), ((ctk_entry_get_type ()))))))
, month[i-1]);
4481 }
4482 return TRUE(!(0));
4483}
4484
4485static gint
4486spin_button_hex_input_func (CtkSpinButton *spin_button,
4487 gdouble *new_val)
4488{
4489 const gchar *buf;
4490 gchar *err;
4491 gdouble res;
4492
4493 buf = ctk_entry_get_text (CTK_ENTRY (spin_button)((((CtkEntry*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((spin_button)), ((ctk_entry_get_type ()))))))
);
4494 res = strtol(buf, &err, 16);
4495 *new_val = res;
4496 if (*err)
4497 return CTK_INPUT_ERROR-1;
4498 else
4499 return TRUE(!(0));
4500}
4501
4502static gint
4503spin_button_hex_output_func (CtkSpinButton *spin_button)
4504{
4505 CtkAdjustment *adjustment;
4506 static gchar buf[7];
4507 gint val;
4508
4509 adjustment = ctk_spin_button_get_adjustment (spin_button);
4510 val = (gint) ctk_adjustment_get_value (adjustment);
4511 if (fabs (val) < 1e-5)
4512 sprintf (buf, "0x00");
4513 else
4514 sprintf (buf, "0x%.2X", val);
4515 if (strcmp (buf, ctk_entry_get_text (CTK_ENTRY (spin_button)((((CtkEntry*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((spin_button)), ((ctk_entry_get_type ()))))))
)))
4516 ctk_entry_set_text (CTK_ENTRY (spin_button)((((CtkEntry*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((spin_button)), ((ctk_entry_get_type ()))))))
, buf);
4517 return TRUE(!(0));
4518}
4519
4520static void
4521create_spins (CtkWidget *widget)
4522{
4523 static CtkWidget *window = NULL((void*)0);
4524
4525 if (!window)
4526 {
4527 CtkWidget *frame;
4528 CtkWidget *hbox;
4529 CtkWidget *main_vbox;
4530 CtkWidget *vbox;
4531 CtkWidget *vbox2;
4532 CtkWidget *spinner2;
4533 CtkWidget *spinner;
4534 CtkWidget *button;
4535 CtkWidget *label;
4536 CtkWidget *val_label;
4537 CtkAdjustment *adjustment;
4538
4539 window = ctk_window_new (CTK_WINDOW_TOPLEVEL);
4540 ctk_window_set_screen (CTK_WINDOW (window)((((CtkWindow*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((window)), ((ctk_window_get_type ()))))))
,
4541 ctk_widget_get_screen (widget));
4542
4543 g_signal_connect (window, "destroy",g_signal_connect_data ((window), ("destroy"), (((GCallback) (
ctk_widget_destroyed))), (&window), ((void*)0), (GConnectFlags
) 0)
4544 G_CALLBACK (ctk_widget_destroyed),g_signal_connect_data ((window), ("destroy"), (((GCallback) (
ctk_widget_destroyed))), (&window), ((void*)0), (GConnectFlags
) 0)
4545 &window)g_signal_connect_data ((window), ("destroy"), (((GCallback) (
ctk_widget_destroyed))), (&window), ((void*)0), (GConnectFlags
) 0)
;
4546
4547 ctk_window_set_title (CTK_WINDOW (window)((((CtkWindow*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((window)), ((ctk_window_get_type ()))))))
, "CtkSpinButton");
4548
4549 main_vbox = ctk_box_new (CTK_ORIENTATION_VERTICAL, 5);
4550 ctk_container_set_border_width (CTK_CONTAINER (main_vbox)((((CtkContainer*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((main_vbox)), ((ctk_container_get_type ()))))))
, 10);
4551 ctk_container_add (CTK_CONTAINER (window)((((CtkContainer*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((window)), ((ctk_container_get_type ()))))))
, main_vbox);
4552
4553 frame = ctk_frame_new ("Not accelerated");
4554 ctk_box_pack_start (CTK_BOX (main_vbox)((((CtkBox*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((main_vbox)), ((ctk_box_get_type ()))))))
, frame, TRUE(!(0)), TRUE(!(0)), 0);
4555
4556 vbox = ctk_box_new (CTK_ORIENTATION_VERTICAL, 0);
4557 ctk_container_set_border_width (CTK_CONTAINER (vbox)((((CtkContainer*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((vbox)), ((ctk_container_get_type ()))))))
, 5);
4558 ctk_container_add (CTK_CONTAINER (frame)((((CtkContainer*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((frame)), ((ctk_container_get_type ()))))))
, vbox);
4559
4560 /* Time, month, hex spinners */
4561
4562 hbox = ctk_box_new (CTK_ORIENTATION_HORIZONTAL, 0);
4563 ctk_box_pack_start (CTK_BOX (vbox)((((CtkBox*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((vbox)), ((ctk_box_get_type ()))))))
, hbox, TRUE(!(0)), TRUE(!(0)), 5);
4564
4565 vbox2 = ctk_box_new (CTK_ORIENTATION_VERTICAL, 0);
4566 ctk_box_pack_start (CTK_BOX (hbox)((((CtkBox*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((hbox)), ((ctk_box_get_type ()))))))
, vbox2, TRUE(!(0)), TRUE(!(0)), 5);
4567
4568 label = ctk_label_new ("Time :");
4569 ctk_widget_set_halign (label, CTK_ALIGN_START);
4570 ctk_widget_set_valign (label, CTK_ALIGN_CENTER);
4571 ctk_box_pack_start (CTK_BOX (vbox2)((((CtkBox*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((vbox2)), ((ctk_box_get_type ()))))))
, label, FALSE(0), TRUE(!(0)), 0);
4572
4573 adjustment = ctk_adjustment_new (0, 0, 1410, 30, 60, 0);
4574 spinner = ctk_spin_button_new (adjustment, 0, 0);
4575 ctk_editable_set_editable (CTK_EDITABLE (spinner)((((CtkEditable*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((spinner)), ((ctk_editable_get_type ()))))))
, FALSE(0));
4576 g_signal_connect (spinner,g_signal_connect_data ((spinner), ("output"), (((GCallback) (
spin_button_time_output_func))), (((void*)0)), ((void*)0), (GConnectFlags
) 0)
4577 "output",g_signal_connect_data ((spinner), ("output"), (((GCallback) (
spin_button_time_output_func))), (((void*)0)), ((void*)0), (GConnectFlags
) 0)
4578 G_CALLBACK (spin_button_time_output_func),g_signal_connect_data ((spinner), ("output"), (((GCallback) (
spin_button_time_output_func))), (((void*)0)), ((void*)0), (GConnectFlags
) 0)
4579 NULL)g_signal_connect_data ((spinner), ("output"), (((GCallback) (
spin_button_time_output_func))), (((void*)0)), ((void*)0), (GConnectFlags
) 0)
;
4580 ctk_spin_button_set_wrap (CTK_SPIN_BUTTON (spinner)((((CtkSpinButton*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((spinner)), ((ctk_spin_button_get_type ()))))))
, TRUE(!(0)));
4581 ctk_entry_set_width_chars (CTK_ENTRY (spinner)((((CtkEntry*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((spinner)), ((ctk_entry_get_type ()))))))
, 5);
4582 ctk_box_pack_start (CTK_BOX (vbox2)((((CtkBox*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((vbox2)), ((ctk_box_get_type ()))))))
, spinner, FALSE(0), TRUE(!(0)), 0);
4583
4584 vbox2 = ctk_box_new (CTK_ORIENTATION_VERTICAL, 0);
4585 ctk_box_pack_start (CTK_BOX (hbox)((((CtkBox*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((hbox)), ((ctk_box_get_type ()))))))
, vbox2, TRUE(!(0)), TRUE(!(0)), 5);
4586
4587 label = ctk_label_new ("Month :");
4588 ctk_widget_set_halign (label, CTK_ALIGN_START);
4589 ctk_widget_set_valign (label, CTK_ALIGN_CENTER);
4590 ctk_box_pack_start (CTK_BOX (vbox2)((((CtkBox*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((vbox2)), ((ctk_box_get_type ()))))))
, label, FALSE(0), TRUE(!(0)), 0);
4591
4592 adjustment = ctk_adjustment_new (1.0, 1.0, 12.0, 1.0,
4593 5.0, 0.0);
4594 spinner = ctk_spin_button_new (adjustment, 0, 0);
4595 ctk_spin_button_set_update_policy (CTK_SPIN_BUTTON (spinner)((((CtkSpinButton*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((spinner)), ((ctk_spin_button_get_type ()))))))
,
4596 CTK_UPDATE_IF_VALID);
4597 g_signal_connect (spinner,g_signal_connect_data ((spinner), ("input"), (((GCallback) (spin_button_month_input_func
))), (((void*)0)), ((void*)0), (GConnectFlags) 0)
4598 "input",g_signal_connect_data ((spinner), ("input"), (((GCallback) (spin_button_month_input_func
))), (((void*)0)), ((void*)0), (GConnectFlags) 0)
4599 G_CALLBACK (spin_button_month_input_func),g_signal_connect_data ((spinner), ("input"), (((GCallback) (spin_button_month_input_func
))), (((void*)0)), ((void*)0), (GConnectFlags) 0)
4600 NULL)g_signal_connect_data ((spinner), ("input"), (((GCallback) (spin_button_month_input_func
))), (((void*)0)), ((void*)0), (GConnectFlags) 0)
;
4601 g_signal_connect (spinner,g_signal_connect_data ((spinner), ("output"), (((GCallback) (
spin_button_month_output_func))), (((void*)0)), ((void*)0), (
GConnectFlags) 0)
4602 "output",g_signal_connect_data ((spinner), ("output"), (((GCallback) (
spin_button_month_output_func))), (((void*)0)), ((void*)0), (
GConnectFlags) 0)
4603 G_CALLBACK (spin_button_month_output_func),g_signal_connect_data ((spinner), ("output"), (((GCallback) (
spin_button_month_output_func))), (((void*)0)), ((void*)0), (
GConnectFlags) 0)
4604 NULL)g_signal_connect_data ((spinner), ("output"), (((GCallback) (
spin_button_month_output_func))), (((void*)0)), ((void*)0), (
GConnectFlags) 0)
;
4605 ctk_spin_button_set_wrap (CTK_SPIN_BUTTON (spinner)((((CtkSpinButton*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((spinner)), ((ctk_spin_button_get_type ()))))))
, TRUE(!(0)));
4606 ctk_entry_set_width_chars (CTK_ENTRY (spinner)((((CtkEntry*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((spinner)), ((ctk_entry_get_type ()))))))
, 9);
4607 ctk_box_pack_start (CTK_BOX (vbox2)((((CtkBox*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((vbox2)), ((ctk_box_get_type ()))))))
, spinner, FALSE(0), TRUE(!(0)), 0);
4608
4609 vbox2 = ctk_box_new (CTK_ORIENTATION_VERTICAL, 0);
4610 ctk_box_pack_start (CTK_BOX (hbox)((((CtkBox*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((hbox)), ((ctk_box_get_type ()))))))
, vbox2, TRUE(!(0)), TRUE(!(0)), 5);
4611
4612 label = ctk_label_new ("Hex :");
4613 ctk_widget_set_halign (label, CTK_ALIGN_START);
4614 ctk_widget_set_valign (label, CTK_ALIGN_CENTER);
4615 ctk_box_pack_start (CTK_BOX (vbox2)((((CtkBox*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((vbox2)), ((ctk_box_get_type ()))))))
, label, FALSE(0), TRUE(!(0)), 0);
4616
4617 adjustment = ctk_adjustment_new (0, 0, 255, 1, 16, 0);
4618 spinner = ctk_spin_button_new (adjustment, 0, 0);
4619 ctk_editable_set_editable (CTK_EDITABLE (spinner)((((CtkEditable*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((spinner)), ((ctk_editable_get_type ()))))))
, TRUE(!(0)));
4620 g_signal_connect (spinner,g_signal_connect_data ((spinner), ("input"), (((GCallback) (spin_button_hex_input_func
))), (((void*)0)), ((void*)0), (GConnectFlags) 0)
4621 "input",g_signal_connect_data ((spinner), ("input"), (((GCallback) (spin_button_hex_input_func
))), (((void*)0)), ((void*)0), (GConnectFlags) 0)
4622 G_CALLBACK (spin_button_hex_input_func),g_signal_connect_data ((spinner), ("input"), (((GCallback) (spin_button_hex_input_func
))), (((void*)0)), ((void*)0), (GConnectFlags) 0)
4623 NULL)g_signal_connect_data ((spinner), ("input"), (((GCallback) (spin_button_hex_input_func
))), (((void*)0)), ((void*)0), (GConnectFlags) 0)
;
4624 g_signal_connect (spinner,g_signal_connect_data ((spinner), ("output"), (((GCallback) (
spin_button_hex_output_func))), (((void*)0)), ((void*)0), (GConnectFlags
) 0)
4625 "output",g_signal_connect_data ((spinner), ("output"), (((GCallback) (
spin_button_hex_output_func))), (((void*)0)), ((void*)0), (GConnectFlags
) 0)
4626 G_CALLBACK (spin_button_hex_output_func),g_signal_connect_data ((spinner), ("output"), (((GCallback) (
spin_button_hex_output_func))), (((void*)0)), ((void*)0), (GConnectFlags
) 0)
4627 NULL)g_signal_connect_data ((spinner), ("output"), (((GCallback) (
spin_button_hex_output_func))), (((void*)0)), ((void*)0), (GConnectFlags
) 0)
;
4628 ctk_spin_button_set_wrap (CTK_SPIN_BUTTON (spinner)((((CtkSpinButton*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((spinner)), ((ctk_spin_button_get_type ()))))))
, TRUE(!(0)));
4629 ctk_entry_set_width_chars (CTK_ENTRY (spinner)((((CtkEntry*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((spinner)), ((ctk_entry_get_type ()))))))
, 4);
4630 ctk_box_pack_start (CTK_BOX (vbox2)((((CtkBox*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((vbox2)), ((ctk_box_get_type ()))))))
, spinner, FALSE(0), TRUE(!(0)), 0);
4631
4632 frame = ctk_frame_new ("Accelerated");
4633 ctk_box_pack_start (CTK_BOX (main_vbox)((((CtkBox*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((main_vbox)), ((ctk_box_get_type ()))))))
, frame, TRUE(!(0)), TRUE(!(0)), 0);
4634
4635 vbox = ctk_box_new (CTK_ORIENTATION_VERTICAL, 0);
4636 ctk_container_set_border_width (CTK_CONTAINER (vbox)((((CtkContainer*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((vbox)), ((ctk_container_get_type ()))))))
, 5);
4637 ctk_container_add (CTK_CONTAINER (frame)((((CtkContainer*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((frame)), ((ctk_container_get_type ()))))))
, vbox);
4638
4639 hbox = ctk_box_new (CTK_ORIENTATION_HORIZONTAL, 0);
4640 ctk_box_pack_start (CTK_BOX (vbox)((((CtkBox*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((vbox)), ((ctk_box_get_type ()))))))
, hbox, FALSE(0), TRUE(!(0)), 5);
4641
4642 vbox2 = ctk_box_new (CTK_ORIENTATION_VERTICAL, 0);
4643 ctk_box_pack_start (CTK_BOX (hbox)((((CtkBox*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((hbox)), ((ctk_box_get_type ()))))))
, vbox2, FALSE(0), FALSE(0), 5);
4644
4645 label = ctk_label_new ("Value :");
4646 ctk_widget_set_halign (label, CTK_ALIGN_START);
4647 ctk_widget_set_valign (label, CTK_ALIGN_CENTER);
4648 ctk_box_pack_start (CTK_BOX (vbox2)((((CtkBox*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((vbox2)), ((ctk_box_get_type ()))))))
, label, FALSE(0), TRUE(!(0)), 0);
4649
4650 adjustment = ctk_adjustment_new (0.0, -10000.0, 10000.0,
4651 0.5, 100.0, 0.0);
4652 spinner1 = ctk_spin_button_new (adjustment, 1.0, 2);
4653 ctk_spin_button_set_wrap (CTK_SPIN_BUTTON (spinner1)((((CtkSpinButton*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((spinner1)), ((ctk_spin_button_get_type ()))))))
, TRUE(!(0)));
4654 ctk_box_pack_start (CTK_BOX (vbox2)((((CtkBox*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((vbox2)), ((ctk_box_get_type ()))))))
, spinner1, FALSE(0), TRUE(!(0)), 0);
4655
4656 vbox2 = ctk_box_new (CTK_ORIENTATION_VERTICAL, 0);
4657 ctk_box_pack_start (CTK_BOX (hbox)((((CtkBox*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((hbox)), ((ctk_box_get_type ()))))))
, vbox2, FALSE(0), FALSE(0), 5);
4658
4659 label = ctk_label_new ("Digits :");
4660 ctk_widget_set_halign (label, CTK_ALIGN_START);
4661 ctk_widget_set_valign (label, CTK_ALIGN_CENTER);
4662 ctk_box_pack_start (CTK_BOX (vbox2)((((CtkBox*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((vbox2)), ((ctk_box_get_type ()))))))
, label, FALSE(0), TRUE(!(0)), 0);
4663
4664 adjustment = ctk_adjustment_new (2, 1, 15, 1, 1, 0);
4665 spinner2 = ctk_spin_button_new (adjustment, 0.0, 0);
4666 g_signal_connect (adjustment, "value_changed",g_signal_connect_data ((adjustment), ("value_changed"), (((GCallback
) (change_digits))), (spinner2), ((void*)0), (GConnectFlags) 0
)
4667 G_CALLBACK (change_digits),g_signal_connect_data ((adjustment), ("value_changed"), (((GCallback
) (change_digits))), (spinner2), ((void*)0), (GConnectFlags) 0
)
4668 spinner2)g_signal_connect_data ((adjustment), ("value_changed"), (((GCallback
) (change_digits))), (spinner2), ((void*)0), (GConnectFlags) 0
)
;
4669 ctk_box_pack_start (CTK_BOX (vbox2)((((CtkBox*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((vbox2)), ((ctk_box_get_type ()))))))
, spinner2, FALSE(0), TRUE(!(0)), 0);
4670
4671 hbox = ctk_box_new (CTK_ORIENTATION_HORIZONTAL, 0);
4672 ctk_box_pack_start (CTK_BOX (vbox)((((CtkBox*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((vbox)), ((ctk_box_get_type ()))))))
, hbox, FALSE(0), FALSE(0), 5);
4673
4674 button = ctk_check_button_new_with_label ("Snap to 0.5-ticks");
4675 g_signal_connect (button, "clicked",g_signal_connect_data ((button), ("clicked"), (((GCallback) (
toggle_snap))), (spinner1), ((void*)0), (GConnectFlags) 0)
4676 G_CALLBACK (toggle_snap),g_signal_connect_data ((button), ("clicked"), (((GCallback) (
toggle_snap))), (spinner1), ((void*)0), (GConnectFlags) 0)
4677 spinner1)g_signal_connect_data ((button), ("clicked"), (((GCallback) (
toggle_snap))), (spinner1), ((void*)0), (GConnectFlags) 0)
;
4678 ctk_box_pack_start (CTK_BOX (vbox)((((CtkBox*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((vbox)), ((ctk_box_get_type ()))))))
, button, TRUE(!(0)), TRUE(!(0)), 0);
4679 ctk_toggle_button_set_active (CTK_TOGGLE_BUTTON (button)((((CtkToggleButton*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((button)), ((ctk_toggle_button_get_type ()))))))
, TRUE(!(0)));
4680
4681 button = ctk_check_button_new_with_label ("Numeric only input mode");
4682 g_signal_connect (button, "clicked",g_signal_connect_data ((button), ("clicked"), (((GCallback) (
toggle_numeric))), (spinner1), ((void*)0), (GConnectFlags) 0)
4683 G_CALLBACK (toggle_numeric),g_signal_connect_data ((button), ("clicked"), (((GCallback) (
toggle_numeric))), (spinner1), ((void*)0), (GConnectFlags) 0)
4684 spinner1)g_signal_connect_data ((button), ("clicked"), (((GCallback) (
toggle_numeric))), (spinner1), ((void*)0), (GConnectFlags) 0)
;
4685 ctk_box_pack_start (CTK_BOX (vbox)((((CtkBox*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((vbox)), ((ctk_box_get_type ()))))))
, button, TRUE(!(0)), TRUE(!(0)), 0);
4686 ctk_toggle_button_set_active (CTK_TOGGLE_BUTTON (button)((((CtkToggleButton*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((button)), ((ctk_toggle_button_get_type ()))))))
, TRUE(!(0)));
4687
4688 val_label = ctk_label_new ("");
4689
4690 hbox = ctk_box_new (CTK_ORIENTATION_HORIZONTAL, 0);
4691 ctk_box_pack_start (CTK_BOX (vbox)((((CtkBox*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((vbox)), ((ctk_box_get_type ()))))))
, hbox, FALSE(0), TRUE(!(0)), 5);
4692
4693 button = ctk_button_new_with_label ("Value as Int");
4694 g_object_set_data (G_OBJECT (button)((((GObject*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((button)), (((GType) ((20) << (2))))))))
, "user_data", val_label);
4695 g_signal_connect (button, "clicked",g_signal_connect_data ((button), ("clicked"), (((GCallback) (
get_value))), (((gpointer) (glong) (1))), ((void*)0), (GConnectFlags
) 0)
4696 G_CALLBACK (get_value),g_signal_connect_data ((button), ("clicked"), (((GCallback) (
get_value))), (((gpointer) (glong) (1))), ((void*)0), (GConnectFlags
) 0)
4697 GINT_TO_POINTER (1))g_signal_connect_data ((button), ("clicked"), (((GCallback) (
get_value))), (((gpointer) (glong) (1))), ((void*)0), (GConnectFlags
) 0)
;
4698 ctk_box_pack_start (CTK_BOX (hbox)((((CtkBox*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((hbox)), ((ctk_box_get_type ()))))))
, button, TRUE(!(0)), TRUE(!(0)), 5);
4699
4700 button = ctk_button_new_with_label ("Value as Float");
4701 g_object_set_data (G_OBJECT (button)((((GObject*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((button)), (((GType) ((20) << (2))))))))
, "user_data", val_label);
4702 g_signal_connect (button, "clicked",g_signal_connect_data ((button), ("clicked"), (((GCallback) (
get_value))), (((gpointer) (glong) (2))), ((void*)0), (GConnectFlags
) 0)
4703 G_CALLBACK (get_value),g_signal_connect_data ((button), ("clicked"), (((GCallback) (
get_value))), (((gpointer) (glong) (2))), ((void*)0), (GConnectFlags
) 0)
4704 GINT_TO_POINTER (2))g_signal_connect_data ((button), ("clicked"), (((GCallback) (
get_value))), (((gpointer) (glong) (2))), ((void*)0), (GConnectFlags
) 0)
;
4705 ctk_box_pack_start (CTK_BOX (hbox)((((CtkBox*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((hbox)), ((ctk_box_get_type ()))))))
, button, TRUE(!(0)), TRUE(!(0)), 5);
4706
4707 ctk_box_pack_start (CTK_BOX (vbox)((((CtkBox*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((vbox)), ((ctk_box_get_type ()))))))
, val_label, TRUE(!(0)), TRUE(!(0)), 0);
4708 ctk_label_set_text (CTK_LABEL (val_label)((((CtkLabel*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((val_label)), ((ctk_label_get_type ()))))))
, "0");
4709
4710 frame = ctk_frame_new ("Using Convenience Constructor");
4711 ctk_box_pack_start (CTK_BOX (main_vbox)((((CtkBox*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((main_vbox)), ((ctk_box_get_type ()))))))
, frame, TRUE(!(0)), TRUE(!(0)), 0);
4712
4713 hbox = ctk_box_new (CTK_ORIENTATION_HORIZONTAL, 0);
4714 ctk_container_set_border_width (CTK_CONTAINER (hbox)((((CtkContainer*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((hbox)), ((ctk_container_get_type ()))))))
, 5);
4715 ctk_container_add (CTK_CONTAINER (frame)((((CtkContainer*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((frame)), ((ctk_container_get_type ()))))))
, hbox);
4716
4717 val_label = ctk_label_new ("0.0");
4718
4719 spinner = ctk_spin_button_new_with_range (0.0, 10.0, 0.009);
4720 ctk_spin_button_set_value (CTK_SPIN_BUTTON (spinner)((((CtkSpinButton*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((spinner)), ((ctk_spin_button_get_type ()))))))
, 0.0);
4721 g_signal_connect (spinner, "value_changed",g_signal_connect_data ((spinner), ("value_changed"), (((GCallback
) (get_spin_value))), (val_label), ((void*)0), (GConnectFlags
) 0)
4722 G_CALLBACK (get_spin_value), val_label)g_signal_connect_data ((spinner), ("value_changed"), (((GCallback
) (get_spin_value))), (val_label), ((void*)0), (GConnectFlags
) 0)
;
4723 ctk_box_pack_start (CTK_BOX (hbox)((((CtkBox*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((hbox)), ((ctk_box_get_type ()))))))
, spinner, TRUE(!(0)), TRUE(!(0)), 5);
4724 ctk_box_pack_start (CTK_BOX (hbox)((((CtkBox*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((hbox)), ((ctk_box_get_type ()))))))
, val_label, TRUE(!(0)), TRUE(!(0)), 5);
4725
4726 hbox = ctk_box_new (CTK_ORIENTATION_HORIZONTAL, 0);
4727 ctk_box_pack_start (CTK_BOX (main_vbox)((((CtkBox*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((main_vbox)), ((ctk_box_get_type ()))))))
, hbox, FALSE(0), TRUE(!(0)), 0);
4728
4729 button = ctk_button_new_with_label ("Close");
4730 g_signal_connect_swapped (button, "clicked",g_signal_connect_data ((button), ("clicked"), (((GCallback) (
ctk_widget_destroy))), (window), ((void*)0), G_CONNECT_SWAPPED
)
4731 G_CALLBACK (ctk_widget_destroy),g_signal_connect_data ((button), ("clicked"), (((GCallback) (
ctk_widget_destroy))), (window), ((void*)0), G_CONNECT_SWAPPED
)
4732 window)g_signal_connect_data ((button), ("clicked"), (((GCallback) (
ctk_widget_destroy))), (window), ((void*)0), G_CONNECT_SWAPPED
)
;
4733 ctk_box_pack_start (CTK_BOX (hbox)((((CtkBox*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((hbox)), ((ctk_box_get_type ()))))))
, button, TRUE(!(0)), TRUE(!(0)), 5);
4734 }
4735
4736 if (!ctk_widget_get_visible (window))
4737 ctk_widget_show_all (window);
4738 else
4739 ctk_widget_destroy (window);
4740}
4741
4742
4743/*
4744 * Cursors
4745 */
4746
4747static gint
4748cursor_draw (CtkWidget *widget,
4749 cairo_t *cr,
4750 gpointer user_data G_GNUC_UNUSED__attribute__ ((__unused__)))
4751{
4752 int width, height;
4753
4754 width = ctk_widget_get_allocated_width (widget);
4755 height = ctk_widget_get_allocated_height (widget);
4756
4757 cairo_set_fill_rule (cr, CAIRO_FILL_RULE_EVEN_ODD);
4758 cairo_rectangle (cr, 0, 0, width, height);
4759 cairo_rectangle (cr, width / 3, height / 3, width / 3, height / 3);
4760 cairo_clip (cr);
4761
4762 cairo_set_source_rgb (cr, 1, 1, 1);
4763 cairo_rectangle (cr, 0, 0, width, height / 2);
4764 cairo_fill (cr);
4765
4766 cairo_set_source_rgb (cr, 0, 0, 0);
4767 cairo_rectangle (cr, 0, height / 2, width, height / 2);
4768 cairo_fill (cr);
4769
4770 return TRUE(!(0));
4771}
4772
4773static const gchar *cursor_names[] = {
4774 "all-scroll",
4775 "arrow",
4776 "bd_double_arrow",
4777 "boat",
4778 "bottom_left_corner",
4779 "bottom_right_corner",
4780 "bottom_side",
4781 "bottom_tee",
4782 "box_spiral",
4783 "center_ptr",
4784 "circle",
4785 "clock",
4786 "coffee_mug",
4787 "copy",
4788 "cross",
4789 "crossed_circle",
4790 "cross_reverse",
4791 "crosshair",
4792 "diamond_cross",
4793 "dnd-ask",
4794 "dnd-copy",
4795 "dnd-link",
4796 "dnd-move",
4797 "dnd-none",
4798 "dot",
4799 "dotbox",
4800 "double_arrow",
4801 "draft_large",
4802 "draft_small",
4803 "draped_box",
4804 "exchange",
4805 "fd_double_arrow",
4806 "fleur",
4807 "gobbler",
4808 "gumby",
4809 "grab",
4810 "grabbing",
4811 "hand",
4812 "hand1",
4813 "hand2",
4814 "heart",
4815 "h_double_arrow",
4816 "help",
4817 "icon",
4818 "iron_cross",
4819 "left_ptr",
4820 "left_ptr_help",
4821 "left_ptr_watch",
4822 "left_side",
4823 "left_tee",
4824 "leftbutton",
4825 "link",
4826 "ll_angle",
4827 "lr_angle",
4828 "man",
4829 "middlebutton",
4830 "mouse",
4831 "move",
4832 "pencil",
4833 "pirate",
4834 "plus",
4835 "question_arrow",
4836 "right_ptr",
4837 "right_side",
4838 "right_tee",
4839 "rightbutton",
4840 "rtl_logo",
4841 "sailboat",
4842 "sb_down_arrow",
4843 "sb_h_double_arrow",
4844 "sb_left_arrow",
4845 "sb_right_arrow",
4846 "sb_up_arrow",
4847 "sb_v_double_arrow",
4848 "shuttle",
4849 "sizing",
4850 "spider",
4851 "spraycan",
4852 "star",
4853 "target",
4854 "tcross",
4855 "top_left_arrow",
4856 "top_left_corner",
4857 "top_right_corner",
4858 "top_side",
4859 "top_tee",
4860 "trek",
4861 "ul_angle",
4862 "umbrella",
4863 "ur_angle",
4864 "v_double_arrow",
4865 "vertical-text",
4866 "watch",
4867 "X_cursor",
4868 "xterm",
4869 "zoom-in",
4870 "zoom-out"
4871};
4872
4873static CtkTreeModel *
4874cursor_model (void)
4875{
4876 CtkListStore *store;
4877 gint i;
4878 store = ctk_list_store_new (1, G_TYPE_STRING((GType) ((16) << (2))));
4879
4880 for (i = 0; i < G_N_ELEMENTS (cursor_names)(sizeof (cursor_names) / sizeof ((cursor_names)[0])); i++)
4881 ctk_list_store_insert_with_values (store, NULL((void*)0), -1, 0, cursor_names[i], -1);
4882
4883 return (CtkTreeModel *)store;
4884}
4885
4886static gint
4887cursor_event (CtkWidget *widget,
4888 CdkEvent *event,
4889 CtkWidget *entry)
4890{
4891 const gchar *name;
4892 gint i;
4893 const gint n = G_N_ELEMENTS (cursor_names)(sizeof (cursor_names) / sizeof ((cursor_names)[0]));
4894
4895 name = (const gchar *)g_object_get_data (G_OBJECT (widget)((((GObject*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((widget)), (((GType) ((20) << (2))))))))
, "name");
4896 if (name != NULL((void*)0))
4897 {
4898 for (i = 0; i < n; i++)
4899 if (strcmp (name, cursor_names[i]) == 0)
4900 break;
4901 }
4902 else
4903 i = 0;
4904
4905 if ((event->type == CDK_BUTTON_PRESS) &&
4906 ((event->button.button == CDK_BUTTON_PRIMARY(1)) ||
4907 (event->button.button == CDK_BUTTON_SECONDARY(3))))
4908 {
4909 if (event->button.button == CDK_BUTTON_PRIMARY(1))
4910 i = (i + 1) % n;
4911 else
4912 i = (i + n - 1) % n;
4913
4914 ctk_entry_set_text (CTK_ENTRY (entry)((((CtkEntry*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((entry)), ((ctk_entry_get_type ()))))))
, cursor_names[i]);
4915
4916 return TRUE(!(0));
4917 }
4918
4919 return FALSE(0);
4920}
4921
4922static void
4923set_cursor_from_name (CtkWidget *entry,
4924 CtkWidget *widget)
4925{
4926 const gchar *name;
4927 CdkCursor *cursor;
4928
4929 name = ctk_entry_get_text (CTK_ENTRY (entry)((((CtkEntry*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((entry)), ((ctk_entry_get_type ()))))))
);
4930 cursor = cdk_cursor_new_from_name (ctk_widget_get_display (widget), name);
4931
4932 if (cursor == NULL((void*)0))
4933 {
4934 name = NULL((void*)0);
4935 cursor = cdk_cursor_new_for_display (ctk_widget_get_display (widget), CDK_BLANK_CURSOR);
4936 }
4937
4938 cdk_window_set_cursor (ctk_widget_get_window (widget), cursor);
4939 g_object_unref (cursor);
4940
4941 g_object_set_data_full (G_OBJECT (widget)((((GObject*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((widget)), (((GType) ((20) << (2))))))))
, "name", g_strdup (name)g_strdup_inline (name), g_free);
4942}
4943
4944#ifdef CDK_WINDOWING_X11
4945#include "x11/cdkx.h"
4946#endif
4947#ifdef CDK_WINDOWING_WAYLAND
4948#include "wayland/cdkwayland.h"
4949#endif
4950
4951static void
4952change_cursor_theme (CtkWidget *widget,
4953 gpointer data)
4954{
4955#if defined(CDK_WINDOWING_X11) || defined (CDK_WINDOWING_WAYLAND)
4956 const gchar *theme;
4957 gint size;
4958 GList *children;
4959 CdkDisplay *display;
4960
4961 children = ctk_container_get_children (CTK_CONTAINER (data)((((CtkContainer*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((data)), ((ctk_container_get_type ()))))))
);
4962
4963 theme = ctk_entry_get_text (CTK_ENTRY (children->next->data)((((CtkEntry*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((children->next->data)), ((ctk_entry_get_type ())))
)))
);
4964 size = (gint) ctk_spin_button_get_value (CTK_SPIN_BUTTON (children->next->next->data)((((CtkSpinButton*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((children->next->next->data)), ((ctk_spin_button_get_type
()))))))
);
4965
4966 g_list_free (children);
4967
4968 display = ctk_widget_get_display (widget);
4969#ifdef CDK_WINDOWING_X11
4970 if (CDK_IS_X11_DISPLAY (display)(((__extension__ ({ GTypeInstance *__inst = (GTypeInstance*) (
(display)); GType __t = ((cdk_x11_display_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; }))))
)
4971 cdk_x11_display_set_cursor_theme (display, theme, size);
4972#endif
4973#ifdef CDK_WINDOWING_WAYLAND
4974 if (CDK_IS_WAYLAND_DISPLAY (display)(((__extension__ ({ GTypeInstance *__inst = (GTypeInstance*) (
(display)); GType __t = ((cdk_wayland_display_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; }))))
)
4975 cdk_wayland_display_set_cursor_theme (display, theme, size);
4976#endif
4977#endif
4978}
4979
4980
4981static void
4982create_cursors (CtkWidget *widget)
4983{
4984 static CtkWidget *window = NULL((void*)0);
4985 CtkWidget *frame;
4986 CtkWidget *hbox;
4987 CtkWidget *main_vbox;
4988 CtkWidget *vbox;
4989 CtkWidget *darea;
4990 CtkWidget *button;
4991 CtkWidget *label;
4992 CtkWidget *any;
4993 CtkWidget *entry;
4994 CtkWidget *size;
4995 CtkEntryCompletion *completion;
4996 CtkTreeModel *model;
4997 gboolean cursor_demo = FALSE(0);
4998
4999 if (!window)
5000 {
5001 window = ctk_window_new (CTK_WINDOW_TOPLEVEL);
5002 ctk_window_set_screen (CTK_WINDOW (window)((((CtkWindow*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((window)), ((ctk_window_get_type ()))))))
,
5003 ctk_widget_get_screen (widget));
5004
5005 g_signal_connect (window, "destroy",g_signal_connect_data ((window), ("destroy"), (((GCallback) (
ctk_widget_destroyed))), (&window), ((void*)0), (GConnectFlags
) 0)
5006 G_CALLBACK (ctk_widget_destroyed),g_signal_connect_data ((window), ("destroy"), (((GCallback) (
ctk_widget_destroyed))), (&window), ((void*)0), (GConnectFlags
) 0)
5007 &window)g_signal_connect_data ((window), ("destroy"), (((GCallback) (
ctk_widget_destroyed))), (&window), ((void*)0), (GConnectFlags
) 0)
;
5008
5009 ctk_window_set_title (CTK_WINDOW (window)((((CtkWindow*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((window)), ((ctk_window_get_type ()))))))
, "Cursors");
5010
5011 main_vbox = ctk_box_new (CTK_ORIENTATION_VERTICAL, 5);
5012 ctk_container_set_border_width (CTK_CONTAINER (main_vbox)((((CtkContainer*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((main_vbox)), ((ctk_container_get_type ()))))))
, 0);
5013 ctk_container_add (CTK_CONTAINER (window)((((CtkContainer*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((window)), ((ctk_container_get_type ()))))))
, main_vbox);
5014
5015 vbox =
5016 g_object_new (CTK_TYPE_BOX(ctk_box_get_type ()),
5017 "orientation", CTK_ORIENTATION_VERTICAL,
5018 "CtkBox::homogeneous", FALSE(0),
5019 "CtkBox::spacing", 5,
5020 "CtkContainer::border_width", 10,
5021 "CtkWidget::parent", main_vbox,
5022 "CtkWidget::visible", TRUE(!(0)),
5023 NULL((void*)0));
5024
5025#ifdef CDK_WINDOWING_X11
5026 if (CDK_IS_X11_DISPLAY (ctk_widget_get_display (vbox))(((__extension__ ({ GTypeInstance *__inst = (GTypeInstance*) (
(ctk_widget_get_display (vbox))); GType __t = ((cdk_x11_display_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; }))))
)
5027 cursor_demo = TRUE(!(0));
5028#endif
5029#ifdef CDK_WINDOWING_WAYLAND
5030 if (CDK_IS_WAYLAND_DISPLAY (ctk_widget_get_display (vbox))(((__extension__ ({ GTypeInstance *__inst = (GTypeInstance*) (
(ctk_widget_get_display (vbox))); GType __t = ((cdk_wayland_display_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; }))))
)
5031 cursor_demo = TRUE(!(0));
5032#endif
5033
5034 if (cursor_demo)
5035 {
5036 guint w, h;
5037
5038 hbox = ctk_box_new (CTK_ORIENTATION_HORIZONTAL, 6);
5039 ctk_container_set_border_width (CTK_CONTAINER (hbox)((((CtkContainer*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((hbox)), ((ctk_container_get_type ()))))))
, 5);
5040 ctk_box_pack_start (CTK_BOX (vbox)((((CtkBox*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((vbox)), ((ctk_box_get_type ()))))))
, hbox, FALSE(0), TRUE(!(0)), 0);
5041
5042 label = ctk_label_new ("Cursor Theme:");
5043 ctk_widget_set_halign (label, CTK_ALIGN_START);
5044 ctk_widget_set_valign (label, CTK_ALIGN_CENTER);
5045 ctk_box_pack_start (CTK_BOX (hbox)((((CtkBox*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((hbox)), ((ctk_box_get_type ()))))))
, label, FALSE(0), TRUE(!(0)), 0);
5046
5047 entry = ctk_entry_new ();
5048 ctk_entry_set_text (CTK_ENTRY (entry)((((CtkEntry*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((entry)), ((ctk_entry_get_type ()))))))
, "default");
5049 ctk_box_pack_start (CTK_BOX (hbox)((((CtkBox*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((hbox)), ((ctk_box_get_type ()))))))
, entry, FALSE(0), TRUE(!(0)), 0);
5050
5051 cdk_display_get_maximal_cursor_size (ctk_widget_get_display (vbox), &w, &h);
5052 size = ctk_spin_button_new_with_range (1.0, MIN (w, h)(((w) < (h)) ? (w) : (h)), 1.0);
5053 ctk_spin_button_set_value (CTK_SPIN_BUTTON (size)((((CtkSpinButton*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((size)), ((ctk_spin_button_get_type ()))))))
, 24.0);
5054 ctk_box_pack_start (CTK_BOX (hbox)((((CtkBox*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((hbox)), ((ctk_box_get_type ()))))))
, size, TRUE(!(0)), TRUE(!(0)), 0);
5055
5056 g_signal_connect (entry, "changed",g_signal_connect_data ((entry), ("changed"), (((GCallback) (change_cursor_theme
))), (hbox), ((void*)0), (GConnectFlags) 0)
5057 G_CALLBACK (change_cursor_theme), hbox)g_signal_connect_data ((entry), ("changed"), (((GCallback) (change_cursor_theme
))), (hbox), ((void*)0), (GConnectFlags) 0)
;
5058 g_signal_connect (size, "value-changed",g_signal_connect_data ((size), ("value-changed"), (((GCallback
) (change_cursor_theme))), (hbox), ((void*)0), (GConnectFlags
) 0)
5059 G_CALLBACK (change_cursor_theme), hbox)g_signal_connect_data ((size), ("value-changed"), (((GCallback
) (change_cursor_theme))), (hbox), ((void*)0), (GConnectFlags
) 0)
;
5060 }
5061
5062 hbox = ctk_box_new (CTK_ORIENTATION_HORIZONTAL, 6);
5063 ctk_container_set_border_width (CTK_CONTAINER (hbox)((((CtkContainer*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((hbox)), ((ctk_container_get_type ()))))))
, 5);
5064 ctk_box_pack_start (CTK_BOX (vbox)((((CtkBox*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((vbox)), ((ctk_box_get_type ()))))))
, hbox, FALSE(0), TRUE(!(0)), 0);
5065
5066 label = ctk_label_new ("Cursor Name:");
5067 ctk_widget_set_halign (label, CTK_ALIGN_START);
5068 ctk_widget_set_valign (label, CTK_ALIGN_CENTER);
5069 ctk_box_pack_start (CTK_BOX (hbox)((((CtkBox*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((hbox)), ((ctk_box_get_type ()))))))
, label, FALSE(0), TRUE(!(0)), 0);
5070
5071 entry = ctk_entry_new ();
5072 completion = ctk_entry_completion_new ();
5073 model = cursor_model ();
5074 ctk_entry_completion_set_model (completion, model);
5075 ctk_entry_completion_set_text_column (completion, 0);
5076 ctk_entry_set_completion (CTK_ENTRY (entry)((((CtkEntry*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((entry)), ((ctk_entry_get_type ()))))))
, completion);
5077 g_object_unref (model);
5078 ctk_box_pack_start (CTK_BOX (hbox)((((CtkBox*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((hbox)), ((ctk_box_get_type ()))))))
, entry, TRUE(!(0)), TRUE(!(0)), 0);
5079
5080 frame =
5081 g_object_new (ctk_frame_get_type (),
5082 "CtkFrame::label_xalign", 0.5,
5083 "CtkFrame::label", "Cursor Area",
5084 "CtkContainer::border_width", 10,
5085 "CtkWidget::parent", vbox,
5086 "CtkWidget::visible", TRUE(!(0)),
5087 NULL((void*)0));
5088
5089 darea = ctk_drawing_area_new ();
5090 ctk_widget_set_size_request (darea, 80, 80);
5091 ctk_container_add (CTK_CONTAINER (frame)((((CtkContainer*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((frame)), ((ctk_container_get_type ()))))))
, darea);
5092 g_signal_connect (darea,g_signal_connect_data ((darea), ("draw"), (((GCallback) (cursor_draw
))), (((void*)0)), ((void*)0), (GConnectFlags) 0)
5093 "draw",g_signal_connect_data ((darea), ("draw"), (((GCallback) (cursor_draw
))), (((void*)0)), ((void*)0), (GConnectFlags) 0)
5094 G_CALLBACK (cursor_draw),g_signal_connect_data ((darea), ("draw"), (((GCallback) (cursor_draw
))), (((void*)0)), ((void*)0), (GConnectFlags) 0)
5095 NULL)g_signal_connect_data ((darea), ("draw"), (((GCallback) (cursor_draw
))), (((void*)0)), ((void*)0), (GConnectFlags) 0)
;
5096 ctk_widget_set_events (darea, CDK_EXPOSURE_MASK | CDK_BUTTON_PRESS_MASK);
5097 g_signal_connect (darea, "button_press_event",g_signal_connect_data ((darea), ("button_press_event"), (((GCallback
) (cursor_event))), (entry), ((void*)0), (GConnectFlags) 0)
5098 G_CALLBACK (cursor_event), entry)g_signal_connect_data ((darea), ("button_press_event"), (((GCallback
) (cursor_event))), (entry), ((void*)0), (GConnectFlags) 0)
;
5099 ctk_widget_show (darea);
5100
5101 g_signal_connect (entry, "changed",g_signal_connect_data ((entry), ("changed"), (((GCallback) (set_cursor_from_name
))), (darea), ((void*)0), (GConnectFlags) 0)
5102 G_CALLBACK (set_cursor_from_name), darea)g_signal_connect_data ((entry), ("changed"), (((GCallback) (set_cursor_from_name
))), (darea), ((void*)0), (GConnectFlags) 0)
;
5103
5104
5105 any = ctk_separator_new (CTK_ORIENTATION_HORIZONTAL);
5106 ctk_box_pack_start (CTK_BOX (main_vbox)((((CtkBox*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((main_vbox)), ((ctk_box_get_type ()))))))
, any, FALSE(0), TRUE(!(0)), 0);
5107
5108 hbox = ctk_box_new (CTK_ORIENTATION_HORIZONTAL, 0);
5109 ctk_container_set_border_width (CTK_CONTAINER (hbox)((((CtkContainer*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((hbox)), ((ctk_container_get_type ()))))))
, 10);
5110 ctk_box_pack_start (CTK_BOX (main_vbox)((((CtkBox*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((main_vbox)), ((ctk_box_get_type ()))))))
, hbox, FALSE(0), TRUE(!(0)), 0);
5111
5112 button = ctk_button_new_with_label ("Close");
5113 g_signal_connect_swapped (button, "clicked",g_signal_connect_data ((button), ("clicked"), (((GCallback) (
ctk_widget_destroy))), (window), ((void*)0), G_CONNECT_SWAPPED
)
5114 G_CALLBACK (ctk_widget_destroy),g_signal_connect_data ((button), ("clicked"), (((GCallback) (
ctk_widget_destroy))), (window), ((void*)0), G_CONNECT_SWAPPED
)
5115 window)g_signal_connect_data ((button), ("clicked"), (((GCallback) (
ctk_widget_destroy))), (window), ((void*)0), G_CONNECT_SWAPPED
)
;
5116 ctk_box_pack_start (CTK_BOX (hbox)((((CtkBox*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((hbox)), ((ctk_box_get_type ()))))))
, button, TRUE(!(0)), TRUE(!(0)), 5);
5117
5118 ctk_widget_show_all (window);
5119
5120 ctk_entry_set_text (CTK_ENTRY (entry)((((CtkEntry*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((entry)), ((ctk_entry_get_type ()))))))
, "arrow");
5121 }
5122 else
5123 ctk_widget_destroy (window);
5124}
5125
5126/*
5127 * CtkColorSelection
5128 */
5129
5130void
5131create_color_selection (CtkWidget *widget)
5132{
5133 static CtkWidget *window = NULL((void*)0);
5134
5135 if (!window)
5136 {
5137 CtkWidget *picker;
5138 CtkWidget *hbox;
5139 CtkWidget *label;
5140
5141 window = ctk_window_new (CTK_WINDOW_TOPLEVEL);
5142 ctk_window_set_screen (CTK_WINDOW (window)((((CtkWindow*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((window)), ((ctk_window_get_type ()))))))
,
5143 ctk_widget_get_screen (widget));
5144
5145 g_signal_connect (window, "destroy",g_signal_connect_data ((window), ("destroy"), (((GCallback) (
ctk_widget_destroyed))), (&window), ((void*)0), (GConnectFlags
) 0)
5146 G_CALLBACK (ctk_widget_destroyed),g_signal_connect_data ((window), ("destroy"), (((GCallback) (
ctk_widget_destroyed))), (&window), ((void*)0), (GConnectFlags
) 0)
5147 &window)g_signal_connect_data ((window), ("destroy"), (((GCallback) (
ctk_widget_destroyed))), (&window), ((void*)0), (GConnectFlags
) 0)
;
5148
5149 ctk_window_set_title (CTK_WINDOW (window)((((CtkWindow*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((window)), ((ctk_window_get_type ()))))))
, "CtkColorButton");
5150 ctk_container_set_border_width (CTK_CONTAINER (window)((((CtkContainer*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((window)), ((ctk_container_get_type ()))))))
, 0);
5151
5152 hbox = ctk_box_new (CTK_ORIENTATION_HORIZONTAL, 8);
5153 ctk_container_set_border_width (CTK_CONTAINER (hbox)((((CtkContainer*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((hbox)), ((ctk_container_get_type ()))))))
, 8);
5154 ctk_container_add (CTK_CONTAINER (window)((((CtkContainer*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((window)), ((ctk_container_get_type ()))))))
, hbox);
5155
5156 label = ctk_label_new ("Pick a color");
5157 ctk_container_add (CTK_CONTAINER (hbox)((((CtkContainer*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((hbox)), ((ctk_container_get_type ()))))))
, label);
5158
5159 picker = ctk_color_button_new ();
5160 ctk_color_chooser_set_use_alpha (CTK_COLOR_CHOOSER (picker)((((CtkColorChooser*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((picker)), ((ctk_color_chooser_get_type ()))))))
, TRUE(!(0)));
5161 ctk_container_add (CTK_CONTAINER (hbox)((((CtkContainer*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((hbox)), ((ctk_container_get_type ()))))))
, picker);
5162 }
5163
5164 if (!ctk_widget_get_visible (window))
5165 ctk_widget_show_all (window);
5166 else
5167 ctk_widget_destroy (window);
5168}
5169
5170void
5171flipping_toggled_cb (CtkWidget *widget,
5172 gpointer data G_GNUC_UNUSED__attribute__ ((__unused__)))
5173{
5174 int state = ctk_toggle_button_get_active (CTK_TOGGLE_BUTTON (widget)((((CtkToggleButton*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((widget)), ((ctk_toggle_button_get_type ()))))))
);
5175 int new_direction = state ? CTK_TEXT_DIR_RTL : CTK_TEXT_DIR_LTR;
5176
5177 ctk_widget_set_default_direction (new_direction);
5178}
5179
5180static void
5181orientable_toggle_orientation (CtkOrientable *orientable)
5182{
5183 CtkOrientation orientation;
5184
5185 orientation = ctk_orientable_get_orientation (orientable);
5186 ctk_orientable_set_orientation (orientable,
5187 orientation == CTK_ORIENTATION_HORIZONTAL ?
5188 CTK_ORIENTATION_VERTICAL :
5189 CTK_ORIENTATION_HORIZONTAL);
5190
5191 if (CTK_IS_CONTAINER (orientable)(((__extension__ ({ GTypeInstance *__inst = (GTypeInstance*) (
(orientable)); GType __t = ((ctk_container_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; }))))
)
5192 {
5193 GList *children;
5194 GList *child;
5195
5196 children = ctk_container_get_children (CTK_CONTAINER (orientable)((((CtkContainer*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((orientable)), ((ctk_container_get_type ()))))))
);
5197
5198 for (child = children; child; child = child->next)
5199 {
5200 if (CTK_IS_ORIENTABLE (child->data)(((__extension__ ({ GTypeInstance *__inst = (GTypeInstance*) (
(child->data)); GType __t = ((ctk_orientable_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; }
))))
)
5201 orientable_toggle_orientation (child->data);
5202 }
5203
5204 g_list_free (children);
5205 }
5206}
5207
5208void
5209flipping_orientation_toggled_cb (CtkWidget *widget,
5210 gpointer data G_GNUC_UNUSED__attribute__ ((__unused__)))
5211{
5212 CtkWidget *content_area;
5213 CtkWidget *toplevel;
5214
5215 toplevel = ctk_widget_get_toplevel (widget);
5216 content_area = ctk_dialog_get_content_area (CTK_DIALOG (toplevel)((((CtkDialog*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((toplevel)), ((ctk_dialog_get_type ()))))))
);
5217 orientable_toggle_orientation (CTK_ORIENTABLE (content_area)((((CtkOrientable*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((content_area)), ((ctk_orientable_get_type ()))))))
);
5218}
5219
5220static void
5221set_direction_recurse (CtkWidget *widget,
5222 gpointer data)
5223{
5224 CtkTextDirection *dir = data;
5225
5226 ctk_widget_set_direction (widget, *dir);
5227 if (CTK_IS_CONTAINER (widget)(((__extension__ ({ GTypeInstance *__inst = (GTypeInstance*) (
(widget)); GType __t = ((ctk_container_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; }))))
)
5228 ctk_container_foreach (CTK_CONTAINER (widget)((((CtkContainer*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((widget)), ((ctk_container_get_type ()))))))
,
5229 set_direction_recurse,
5230 data);
5231}
5232
5233static CtkWidget *
5234create_forward_back (const char *title,
5235 CtkTextDirection text_dir)
5236{
5237 CtkWidget *frame = ctk_frame_new (title);
5238 CtkWidget *bbox = ctk_button_box_new (CTK_ORIENTATION_HORIZONTAL);
5239 CtkWidget *back_button = ctk_button_new_with_label ("Back");
5240 CtkWidget *forward_button = ctk_button_new_with_label ("Forward");
5241
5242 ctk_container_set_border_width (CTK_CONTAINER (bbox)((((CtkContainer*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((bbox)), ((ctk_container_get_type ()))))))
, 5);
5243
5244 ctk_container_add (CTK_CONTAINER (frame)((((CtkContainer*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((frame)), ((ctk_container_get_type ()))))))
, bbox);
5245 ctk_container_add (CTK_CONTAINER (bbox)((((CtkContainer*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((bbox)), ((ctk_container_get_type ()))))))
, back_button);
5246 ctk_container_add (CTK_CONTAINER (bbox)((((CtkContainer*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((bbox)), ((ctk_container_get_type ()))))))
, forward_button);
5247
5248 set_direction_recurse (frame, &text_dir);
5249
5250 return frame;
5251}
5252
5253void
5254create_flipping (CtkWidget *widget)
5255{
5256 static CtkWidget *window = NULL((void*)0);
5257
5258 if (!window)
5259 {
5260 CtkWidget *check_button;
5261 CtkWidget *content_area;
5262
5263 window = ctk_dialog_new ();
5264
5265 ctk_window_set_screen (CTK_WINDOW (window)((((CtkWindow*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((window)), ((ctk_window_get_type ()))))))
,
5266 ctk_widget_get_screen (widget));
5267
5268 g_signal_connect (window, "destroy",g_signal_connect_data ((window), ("destroy"), (((GCallback) (
ctk_widget_destroyed))), (&window), ((void*)0), (GConnectFlags
) 0)
5269 G_CALLBACK (ctk_widget_destroyed),g_signal_connect_data ((window), ("destroy"), (((GCallback) (
ctk_widget_destroyed))), (&window), ((void*)0), (GConnectFlags
) 0)
5270 &window)g_signal_connect_data ((window), ("destroy"), (((GCallback) (
ctk_widget_destroyed))), (&window), ((void*)0), (GConnectFlags
) 0)
;
5271
5272 content_area = ctk_dialog_get_content_area (CTK_DIALOG (window)((((CtkDialog*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((window)), ((ctk_dialog_get_type ()))))))
);
5273
5274 ctk_window_set_title (CTK_WINDOW (window)((((CtkWindow*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((window)), ((ctk_window_get_type ()))))))
, "Bidirectional Flipping");
5275
5276 check_button = ctk_check_button_new_with_label ("Right-to-left global direction");
5277 ctk_container_set_border_width (CTK_CONTAINER (check_button)((((CtkContainer*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((check_button)), ((ctk_container_get_type ()))))))
, 10);
5278 ctk_box_pack_start (CTK_BOX (content_area)((((CtkBox*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((content_area)), ((ctk_box_get_type ()))))))
, check_button, TRUE(!(0)), TRUE(!(0)), 0);
5279
5280 if (ctk_widget_get_default_direction () == CTK_TEXT_DIR_RTL)
5281 ctk_toggle_button_set_active (CTK_TOGGLE_BUTTON (check_button)((((CtkToggleButton*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((check_button)), ((ctk_toggle_button_get_type ()))))))
, TRUE(!(0)));
5282
5283 g_signal_connect (check_button, "toggled",g_signal_connect_data ((check_button), ("toggled"), (((GCallback
) (flipping_toggled_cb))), (((void*)0)), ((void*)0), (GConnectFlags
) 0)
5284 G_CALLBACK (flipping_toggled_cb), NULL)g_signal_connect_data ((check_button), ("toggled"), (((GCallback
) (flipping_toggled_cb))), (((void*)0)), ((void*)0), (GConnectFlags
) 0)
;
5285
5286 check_button = ctk_check_button_new_with_label ("Toggle orientation of all boxes");
5287 ctk_container_set_border_width (CTK_CONTAINER (check_button)((((CtkContainer*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((check_button)), ((ctk_container_get_type ()))))))
, 10);
5288 ctk_box_pack_start (CTK_BOX (content_area)((((CtkBox*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((content_area)), ((ctk_box_get_type ()))))))
, check_button, TRUE(!(0)), TRUE(!(0)), 0);
5289
5290 g_signal_connect (check_button, "toggled",g_signal_connect_data ((check_button), ("toggled"), (((GCallback
) (flipping_orientation_toggled_cb))), (((void*)0)), ((void*)
0), (GConnectFlags) 0)
5291 G_CALLBACK (flipping_orientation_toggled_cb), NULL)g_signal_connect_data ((check_button), ("toggled"), (((GCallback
) (flipping_orientation_toggled_cb))), (((void*)0)), ((void*)
0), (GConnectFlags) 0)
;
5292
5293 ctk_box_pack_start (CTK_BOX (content_area)((((CtkBox*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((content_area)), ((ctk_box_get_type ()))))))
,
5294 create_forward_back ("Default", CTK_TEXT_DIR_NONE),
5295 TRUE(!(0)), TRUE(!(0)), 0);
5296
5297 ctk_box_pack_start (CTK_BOX (content_area)((((CtkBox*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((content_area)), ((ctk_box_get_type ()))))))
,
5298 create_forward_back ("Left-to-Right", CTK_TEXT_DIR_LTR),
5299 TRUE(!(0)), TRUE(!(0)), 0);
5300
5301 ctk_box_pack_start (CTK_BOX (content_area)((((CtkBox*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((content_area)), ((ctk_box_get_type ()))))))
,
5302 create_forward_back ("Right-to-Left", CTK_TEXT_DIR_RTL),
5303 TRUE(!(0)), TRUE(!(0)), 0);
5304
5305 ctk_dialog_add_button (CTK_DIALOG (window)((((CtkDialog*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((window)), ((ctk_dialog_get_type ()))))))
, "Close", CTK_RESPONSE_CLOSE);
5306 g_signal_connect (window, "response", G_CALLBACK (ctk_widget_destroy), NULL)g_signal_connect_data ((window), ("response"), (((GCallback) (
ctk_widget_destroy))), (((void*)0)), ((void*)0), (GConnectFlags
) 0)
;
5307 }
5308
5309 if (!ctk_widget_get_visible (window))
5310 ctk_widget_show_all (window);
5311 else
5312 ctk_widget_destroy (window);
5313}
5314
5315/*
5316 * Focus test
5317 */
5318
5319static CtkWidget*
5320make_focus_table (GList **list)
5321{
5322 CtkWidget *grid;
5323 gint i, j;
5324
5325 grid = ctk_grid_new ();
5326
5327 ctk_grid_set_row_spacing (CTK_GRID (grid)((((CtkGrid*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((grid)), ((ctk_grid_get_type ()))))))
, 10);
5328 ctk_grid_set_column_spacing (CTK_GRID (grid)((((CtkGrid*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((grid)), ((ctk_grid_get_type ()))))))
, 10);
5329
5330 for (i = 0; i < 5; i++)
5331 {
5332 for (j = 0; j < 5; j++)
5333 {
5334 CtkWidget *widget;
5335
5336 if ((i + j) % 2)
5337 widget = ctk_entry_new ();
5338 else
5339 widget = ctk_button_new_with_label ("Foo");
5340
5341 *list = g_list_prepend (*list, widget);
5342
5343 ctk_widget_set_hexpand (widget, TRUE(!(0)));
5344 ctk_widget_set_vexpand (widget, TRUE(!(0)));
5345
5346 ctk_grid_attach (CTK_GRID (grid)((((CtkGrid*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((grid)), ((ctk_grid_get_type ()))))))
, widget, i, j, 1, 1);
5347 }
5348 }
5349
5350 *list = g_list_reverse (*list);
5351
5352 return grid;
5353}
5354
5355static void
5356create_focus (CtkWidget *widget)
5357{
5358 static CtkWidget *window = NULL((void*)0);
5359
5360 if (!window)
5361 {
5362 CtkWidget *content_area;
5363 CtkWidget *table;
5364 CtkWidget *frame;
5365 GList *list = NULL((void*)0);
5366
5367 window = ctk_dialog_new_with_buttons ("Keyboard focus navigation",
5368 NULL((void*)0), 0,
5369 "_Close",
5370 CTK_RESPONSE_NONE,
5371 NULL((void*)0));
5372
5373 ctk_window_set_screen (CTK_WINDOW (window)((((CtkWindow*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((window)), ((ctk_window_get_type ()))))))
,
5374 ctk_widget_get_screen (widget));
5375
5376 g_signal_connect (window, "destroy",g_signal_connect_data ((window), ("destroy"), (((GCallback) (
ctk_widget_destroyed))), (&window), ((void*)0), (GConnectFlags
) 0)
5377 G_CALLBACK (ctk_widget_destroyed),g_signal_connect_data ((window), ("destroy"), (((GCallback) (
ctk_widget_destroyed))), (&window), ((void*)0), (GConnectFlags
) 0)
5378 &window)g_signal_connect_data ((window), ("destroy"), (((GCallback) (
ctk_widget_destroyed))), (&window), ((void*)0), (GConnectFlags
) 0)
;
5379
5380 g_signal_connect (window, "response",g_signal_connect_data ((window), ("response"), (((GCallback) (
ctk_widget_destroy))), (((void*)0)), ((void*)0), (GConnectFlags
) 0)
5381 G_CALLBACK (ctk_widget_destroy),g_signal_connect_data ((window), ("response"), (((GCallback) (
ctk_widget_destroy))), (((void*)0)), ((void*)0), (GConnectFlags
) 0)
5382 NULL)g_signal_connect_data ((window), ("response"), (((GCallback) (
ctk_widget_destroy))), (((void*)0)), ((void*)0), (GConnectFlags
) 0)
;
5383
5384 content_area = ctk_dialog_get_content_area (CTK_DIALOG (window)((((CtkDialog*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((window)), ((ctk_dialog_get_type ()))))))
);
5385
5386 ctk_window_set_title (CTK_WINDOW (window)((((CtkWindow*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((window)), ((ctk_window_get_type ()))))))
, "Keyboard Focus Navigation");
5387
5388 frame = ctk_frame_new ("Weird tab focus chain");
5389
5390 ctk_box_pack_start (CTK_BOX (content_area)((((CtkBox*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((content_area)), ((ctk_box_get_type ()))))))
, frame, TRUE(!(0)), TRUE(!(0)), 0);
5391
5392 table = make_focus_table (&list);
5393
5394 ctk_container_add (CTK_CONTAINER (frame)((((CtkContainer*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((frame)), ((ctk_container_get_type ()))))))
, table);
5395
5396 ctk_container_set_focus_chain (CTK_CONTAINER (table)((((CtkContainer*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((table)), ((ctk_container_get_type ()))))))
,
5397 list);
5398
5399 g_list_free (list);
5400
5401 frame = ctk_frame_new ("Default tab focus chain");
5402
5403 ctk_box_pack_start (CTK_BOX (content_area)((((CtkBox*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((content_area)), ((ctk_box_get_type ()))))))
, frame, TRUE(!(0)), TRUE(!(0)), 0);
5404
5405 list = NULL((void*)0);
5406 table = make_focus_table (&list);
5407
5408 g_list_free (list);
5409
5410 ctk_container_add (CTK_CONTAINER (frame)((((CtkContainer*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((frame)), ((ctk_container_get_type ()))))))
, table);
5411 }
5412
5413 if (!ctk_widget_get_visible (window))
5414 ctk_widget_show_all (window);
5415 else
5416 ctk_widget_destroy (window);
5417}
5418
5419/*
5420 * CtkFontSelection
5421 */
5422
5423void
5424create_font_selection (CtkWidget *widget)
5425{
5426 static CtkWidget *window = NULL((void*)0);
5427
5428 if (!window)
5429 {
5430 CtkWidget *picker;
5431 CtkWidget *hbox;
5432 CtkWidget *label;
5433
5434 window = ctk_window_new (CTK_WINDOW_TOPLEVEL);
5435 ctk_window_set_screen (CTK_WINDOW (window)((((CtkWindow*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((window)), ((ctk_window_get_type ()))))))
,
5436 ctk_widget_get_screen (widget));
5437
5438 g_signal_connect (window, "destroy",g_signal_connect_data ((window), ("destroy"), (((GCallback) (
ctk_widget_destroyed))), (&window), ((void*)0), (GConnectFlags
) 0)
5439 G_CALLBACK (ctk_widget_destroyed),g_signal_connect_data ((window), ("destroy"), (((GCallback) (
ctk_widget_destroyed))), (&window), ((void*)0), (GConnectFlags
) 0)
5440 &window)g_signal_connect_data ((window), ("destroy"), (((GCallback) (
ctk_widget_destroyed))), (&window), ((void*)0), (GConnectFlags
) 0)
;
5441
5442 ctk_window_set_title (CTK_WINDOW (window)((((CtkWindow*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((window)), ((ctk_window_get_type ()))))))
, "CtkFontButton");
5443 ctk_container_set_border_width (CTK_CONTAINER (window)((((CtkContainer*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((window)), ((ctk_container_get_type ()))))))
, 0);
5444
5445 hbox = ctk_box_new (CTK_ORIENTATION_HORIZONTAL, 8);
5446 ctk_container_set_border_width (CTK_CONTAINER (hbox)((((CtkContainer*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((hbox)), ((ctk_container_get_type ()))))))
, 8);
5447 ctk_container_add (CTK_CONTAINER (window)((((CtkContainer*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((window)), ((ctk_container_get_type ()))))))
, hbox);
5448
5449 label = ctk_label_new ("Pick a font");
5450 ctk_container_add (CTK_CONTAINER (hbox)((((CtkContainer*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((hbox)), ((ctk_container_get_type ()))))))
, label);
5451
5452 picker = ctk_font_button_new ();
5453 ctk_font_button_set_use_font (CTK_FONT_BUTTON (picker)((((CtkFontButton*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((picker)), ((ctk_font_button_get_type ()))))))
, TRUE(!(0)));
5454 ctk_container_add (CTK_CONTAINER (hbox)((((CtkContainer*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((hbox)), ((ctk_container_get_type ()))))))
, picker);
5455 }
5456
5457 if (!ctk_widget_get_visible (window))
5458 ctk_widget_show_all (window);
5459 else
5460 ctk_widget_destroy (window);
5461}
5462
5463/*
5464 * CtkDialog
5465 */
5466
5467static CtkWidget *dialog_window = NULL((void*)0);
5468
5469static void
5470dialog_response_cb (CtkWidget *widget G_GNUC_UNUSED__attribute__ ((__unused__)),
5471 gint response,
5472 gpointer unused G_GNUC_UNUSED__attribute__ ((__unused__)))
5473{
5474 if (response == CTK_RESPONSE_APPLY)
5475 {
5476 GList *l, *children;
5477 CtkWidget *content_area;
5478
5479 content_area = ctk_dialog_get_content_area (CTK_DIALOG (dialog_window)((((CtkDialog*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((dialog_window)), ((ctk_dialog_get_type ()))))))
);
5480 children = ctk_container_get_children (CTK_CONTAINER (content_area)((((CtkContainer*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((content_area)), ((ctk_container_get_type ()))))))
);
5481
5482 for (l = children; l; l = l->next)
5483 {
5484 if (CTK_IS_LABEL (l->data)(((__extension__ ({ GTypeInstance *__inst = (GTypeInstance*) (
(l->data)); 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; }))))
)
5485 {
5486 ctk_container_remove (CTK_CONTAINER (content_area)((((CtkContainer*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((content_area)), ((ctk_container_get_type ()))))))
, l->data);
5487 break;
5488 }
5489 }
5490
5491 /* no label removed, so add one */
5492 if (l == NULL((void*)0))
5493 {
5494 CtkWidget *label;
5495
5496 label = ctk_label_new ("Dialog Test");
5497 g_object_set (label, "margin", 10, NULL((void*)0));
5498 ctk_box_pack_start (CTK_BOX (content_area)((((CtkBox*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((content_area)), ((ctk_box_get_type ()))))))
,
5499 label, TRUE(!(0)), TRUE(!(0)), 0);
5500 ctk_widget_show (label);
5501 }
5502
5503 g_list_free (children);
5504 }
5505}
5506
5507static void
5508create_dialog (CtkWidget *widget)
5509{
5510 if (!dialog_window)
5511 {
5512 /* This is a terrible example; it's much simpler to create
5513 * dialogs than this. Don't use testctk for example code,
5514 * use ctk-demo ;-)
5515 */
5516
5517 dialog_window = ctk_dialog_new ();
5518 ctk_window_set_screen (CTK_WINDOW (dialog_window)((((CtkWindow*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((dialog_window)), ((ctk_window_get_type ()))))))
,
5519 ctk_widget_get_screen (widget));
5520
5521 g_signal_connect (dialog_window, "destroy",g_signal_connect_data ((dialog_window), ("destroy"), (((GCallback
) (ctk_widget_destroyed))), (&dialog_window), ((void*)0),
(GConnectFlags) 0)
5522 G_CALLBACK (ctk_widget_destroyed),g_signal_connect_data ((dialog_window), ("destroy"), (((GCallback
) (ctk_widget_destroyed))), (&dialog_window), ((void*)0),
(GConnectFlags) 0)
5523 &dialog_window)g_signal_connect_data ((dialog_window), ("destroy"), (((GCallback
) (ctk_widget_destroyed))), (&dialog_window), ((void*)0),
(GConnectFlags) 0)
;
5524
5525
5526 ctk_window_set_title (CTK_WINDOW (dialog_window)((((CtkWindow*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((dialog_window)), ((ctk_window_get_type ()))))))
, "CtkDialog");
5527 ctk_container_set_border_width (CTK_CONTAINER (dialog_window)((((CtkContainer*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((dialog_window)), ((ctk_container_get_type ()))))))
, 0);
5528
5529 ctk_dialog_add_button (CTK_DIALOG (dialog_window)((((CtkDialog*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((dialog_window)), ((ctk_dialog_get_type ()))))))
,
5530 "OK",
5531 CTK_RESPONSE_OK);
5532
5533 ctk_dialog_add_button (CTK_DIALOG (dialog_window)((((CtkDialog*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((dialog_window)), ((ctk_dialog_get_type ()))))))
,
5534 "Toggle",
5535 CTK_RESPONSE_APPLY);
5536
5537 g_signal_connect (dialog_window, "response",g_signal_connect_data ((dialog_window), ("response"), (((GCallback
) (dialog_response_cb))), (((void*)0)), ((void*)0), (GConnectFlags
) 0)
5538 G_CALLBACK (dialog_response_cb),g_signal_connect_data ((dialog_window), ("response"), (((GCallback
) (dialog_response_cb))), (((void*)0)), ((void*)0), (GConnectFlags
) 0)
5539 NULL)g_signal_connect_data ((dialog_window), ("response"), (((GCallback
) (dialog_response_cb))), (((void*)0)), ((void*)0), (GConnectFlags
) 0)
;
5540 }
5541
5542 if (!ctk_widget_get_visible (dialog_window))
5543 ctk_widget_show (dialog_window);
5544 else
5545 ctk_widget_destroy (dialog_window);
5546}
5547
5548/* Display & Screen test
5549 */
5550
5551typedef struct
5552{
5553 CtkWidget *combo;
5554 CtkWidget *entry;
5555 CtkWidget *toplevel;
5556 CtkWidget *dialog_window;
5557} ScreenDisplaySelection;
5558
5559static void
5560screen_display_check (CtkWidget *widget, ScreenDisplaySelection *data)
5561{
5562 const gchar *display_name;
5563 CdkDisplay *display;
5564 CdkScreen *new_screen = NULL((void*)0);
5565 CdkScreen *current_screen = ctk_widget_get_screen (widget);
5566
5567 display_name = ctk_entry_get_text (CTK_ENTRY (data->entry)((((CtkEntry*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((data->entry)), ((ctk_entry_get_type ()))))))
);
5568 display = cdk_display_open (display_name);
5569
5570 if (!display)
5571 {
5572 CtkWidget *dialog;
5573
5574 dialog = ctk_message_dialog_new (CTK_WINDOW (ctk_widget_get_toplevel (widget))((((CtkWindow*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((ctk_widget_get_toplevel (widget))), ((ctk_window_get_type
()))))))
,
5575 CTK_DIALOG_DESTROY_WITH_PARENT,
5576 CTK_MESSAGE_ERROR,
5577 CTK_BUTTONS_OK,
5578 "The display :\n%s\ncannot be opened",
5579 display_name);
5580 ctk_window_set_screen (CTK_WINDOW (dialog)((((CtkWindow*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((dialog)), ((ctk_window_get_type ()))))))
, current_screen);
5581 ctk_widget_show (dialog);
5582 g_signal_connect (dialog, "response",g_signal_connect_data ((dialog), ("response"), (((GCallback) (
ctk_widget_destroy))), (((void*)0)), ((void*)0), (GConnectFlags
) 0)
5583 G_CALLBACK (ctk_widget_destroy),g_signal_connect_data ((dialog), ("response"), (((GCallback) (
ctk_widget_destroy))), (((void*)0)), ((void*)0), (GConnectFlags
) 0)
5584 NULL)g_signal_connect_data ((dialog), ("response"), (((GCallback) (
ctk_widget_destroy))), (((void*)0)), ((void*)0), (GConnectFlags
) 0)
;
5585 }
5586 else
5587 {
5588 CtkTreeModel *model = ctk_combo_box_get_model (CTK_COMBO_BOX (data->combo)((((CtkComboBox*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((data->combo)), ((ctk_combo_box_get_type ()))))))
);
5589 gint i = 0;
5590 CtkTreeIter iter;
5591 gboolean found = FALSE(0);
5592 while (ctk_tree_model_iter_nth_child (model, &iter, NULL((void*)0), i++))
5593 {
5594 gchar *name;
5595 ctk_tree_model_get (model, &iter, 0, &name, -1);
5596 found = !g_ascii_strcasecmp (display_name, name);
5597 g_free (name);
5598
5599 if (found)
5600 break;
5601 }
5602 if (!found)
5603 ctk_combo_box_text_append_text (CTK_COMBO_BOX_TEXT (data->combo)((((CtkComboBoxText*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((data->combo)), ((ctk_combo_box_text_get_type ()))))))
, display_name);
5604 new_screen = cdk_display_get_default_screen (display);
5605
5606 ctk_window_set_screen (CTK_WINDOW (data->toplevel)((((CtkWindow*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((data->toplevel)), ((ctk_window_get_type ()))))))
, new_screen);
5607 ctk_widget_destroy (data->dialog_window);
5608 }
5609}
5610
5611void
5612screen_display_destroy_diag (CtkWidget *widget G_GNUC_UNUSED__attribute__ ((__unused__)),
5613 CtkWidget *data)
5614{
5615 ctk_widget_destroy (data);
5616}
5617
5618void
5619create_display_screen (CtkWidget *widget)
5620{
5621 CtkWidget *grid, *frame, *window, *combo_dpy, *vbox;
5622 CtkWidget *label_dpy, *applyb, *cancelb;
5623 CtkWidget *bbox;
5624 ScreenDisplaySelection *scr_dpy_data;
5625 CdkScreen *screen = ctk_widget_get_screen (widget);
5626
5627 window = g_object_new (ctk_window_get_type (),
5628 "screen", screen,
5629 "type", CTK_WINDOW_TOPLEVEL,
5630 "title", "Screen or Display selection",
5631 "border_width",
5632 10, NULL((void*)0));
5633 g_signal_connect (window, "destroy",g_signal_connect_data ((window), ("destroy"), (((GCallback) (
ctk_widget_destroy))), (((void*)0)), ((void*)0), (GConnectFlags
) 0)
5634 G_CALLBACK (ctk_widget_destroy), NULL)g_signal_connect_data ((window), ("destroy"), (((GCallback) (
ctk_widget_destroy))), (((void*)0)), ((void*)0), (GConnectFlags
) 0)
;
5635
5636 vbox = ctk_box_new (CTK_ORIENTATION_VERTICAL, 3);
5637 ctk_container_add (CTK_CONTAINER (window)((((CtkContainer*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((window)), ((ctk_container_get_type ()))))))
, vbox);
5638
5639 frame = ctk_frame_new ("Select display");
5640 ctk_container_add (CTK_CONTAINER (vbox)((((CtkContainer*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((vbox)), ((ctk_container_get_type ()))))))
, frame);
5641
5642 grid = ctk_grid_new ();
5643 ctk_grid_set_row_spacing (CTK_GRID (grid)((((CtkGrid*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((grid)), ((ctk_grid_get_type ()))))))
, 3);
5644 ctk_grid_set_column_spacing (CTK_GRID (grid)((((CtkGrid*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((grid)), ((ctk_grid_get_type ()))))))
, 3);
5645
5646 ctk_container_add (CTK_CONTAINER (frame)((((CtkContainer*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((frame)), ((ctk_container_get_type ()))))))
, grid);
5647
5648 label_dpy = ctk_label_new ("move to another X display");
5649 combo_dpy = ctk_combo_box_text_new_with_entry ();
5650 ctk_widget_set_hexpand (combo_dpy, TRUE(!(0)));
5651 ctk_combo_box_text_append_text (CTK_COMBO_BOX_TEXT (combo_dpy)((((CtkComboBoxText*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((combo_dpy)), ((ctk_combo_box_text_get_type ()))))))
, "diabolo:0.0");
5652 ctk_entry_set_text (CTK_ENTRY (ctk_bin_get_child (CTK_BIN (combo_dpy)))((((CtkEntry*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((ctk_bin_get_child (((((CtkBin*) (void *) g_type_check_instance_cast
((GTypeInstance*) ((combo_dpy)), ((ctk_bin_get_type ()))))))
))), ((ctk_entry_get_type ()))))))
,
5653 "<hostname>:<X Server Num>.<Screen Num>");
5654
5655 ctk_grid_attach (CTK_GRID (grid)((((CtkGrid*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((grid)), ((ctk_grid_get_type ()))))))
, label_dpy, 0, 0, 1, 1);
5656 ctk_grid_attach (CTK_GRID (grid)((((CtkGrid*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((grid)), ((ctk_grid_get_type ()))))))
, combo_dpy, 0, 1, 1, 1);
5657
5658 bbox = ctk_button_box_new (CTK_ORIENTATION_HORIZONTAL);
5659 applyb = ctk_button_new_with_label ("_Apply");
5660 cancelb = ctk_button_new_with_label ("_Cancel");
5661
5662 ctk_container_add (CTK_CONTAINER (vbox)((((CtkContainer*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((vbox)), ((ctk_container_get_type ()))))))
, bbox);
5663
5664 ctk_container_add (CTK_CONTAINER (bbox)((((CtkContainer*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((bbox)), ((ctk_container_get_type ()))))))
, applyb);
5665 ctk_container_add (CTK_CONTAINER (bbox)((((CtkContainer*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((bbox)), ((ctk_container_get_type ()))))))
, cancelb);
5666
5667 scr_dpy_data = g_new0 (ScreenDisplaySelection, 1)((ScreenDisplaySelection *) g_malloc0_n ((1), sizeof (ScreenDisplaySelection
)))
;
5668
5669 scr_dpy_data->entry = ctk_bin_get_child (CTK_BIN (combo_dpy)((((CtkBin*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((combo_dpy)), ((ctk_bin_get_type ()))))))
);
5670 scr_dpy_data->toplevel = ctk_widget_get_toplevel (widget);
5671 scr_dpy_data->dialog_window = window;
5672
5673 g_signal_connect (cancelb, "clicked",g_signal_connect_data ((cancelb), ("clicked"), (((GCallback) (
screen_display_destroy_diag))), (window), ((void*)0), (GConnectFlags
) 0)
5674 G_CALLBACK (screen_display_destroy_diag), window)g_signal_connect_data ((cancelb), ("clicked"), (((GCallback) (
screen_display_destroy_diag))), (window), ((void*)0), (GConnectFlags
) 0)
;
5675 g_signal_connect (applyb, "clicked",g_signal_connect_data ((applyb), ("clicked"), (((GCallback) (
screen_display_check))), (scr_dpy_data), ((void*)0), (GConnectFlags
) 0)
5676 G_CALLBACK (screen_display_check), scr_dpy_data)g_signal_connect_data ((applyb), ("clicked"), (((GCallback) (
screen_display_check))), (scr_dpy_data), ((void*)0), (GConnectFlags
) 0)
;
5677 ctk_widget_show_all (window);
5678}
5679
5680/* Event Watcher
5681 */
5682static gulong event_watcher_enter_id = 0;
5683static gulong event_watcher_leave_id = 0;
5684
5685static gboolean
5686event_watcher (GSignalInvocationHint *ihint,
5687 guint n_param_values G_GNUC_UNUSED__attribute__ ((__unused__)),
5688 const GValue *param_values,
5689 gpointer data G_GNUC_UNUSED__attribute__ ((__unused__)))
5690{
5691 g_print ("Watch: \"%s\" emitted for %s\n",
5692 g_signal_name (ihint->signal_id),
5693 G_OBJECT_TYPE_NAME (g_value_get_object (param_values + 0))(g_type_name ((((((GTypeClass*) (((GTypeInstance*) (g_value_get_object
(param_values + 0)))->g_class))->g_type)))))
);
5694
5695 return TRUE(!(0));
5696}
5697
5698static void
5699event_watcher_down (void)
5700{
5701 if (event_watcher_enter_id)
5702 {
5703 guint signal_id;
5704
5705 signal_id = g_signal_lookup ("enter_notify_event", CTK_TYPE_WIDGET(ctk_widget_get_type ()));
5706 g_signal_remove_emission_hook (signal_id, event_watcher_enter_id);
5707 event_watcher_enter_id = 0;
5708 signal_id = g_signal_lookup ("leave_notify_event", CTK_TYPE_WIDGET(ctk_widget_get_type ()));
5709 g_signal_remove_emission_hook (signal_id, event_watcher_leave_id);
5710 event_watcher_leave_id = 0;
5711 }
5712}
5713
5714static void
5715event_watcher_toggle (void)
5716{
5717 if (event_watcher_enter_id)
5718 event_watcher_down ();
5719 else
5720 {
5721 guint signal_id;
5722
5723 signal_id = g_signal_lookup ("enter_notify_event", CTK_TYPE_WIDGET(ctk_widget_get_type ()));
5724 event_watcher_enter_id = g_signal_add_emission_hook (signal_id, 0, event_watcher, NULL((void*)0), NULL((void*)0));
5725 signal_id = g_signal_lookup ("leave_notify_event", CTK_TYPE_WIDGET(ctk_widget_get_type ()));
5726 event_watcher_leave_id = g_signal_add_emission_hook (signal_id, 0, event_watcher, NULL((void*)0), NULL((void*)0));
5727 }
5728}
5729
5730static void
5731create_event_watcher (CtkWidget *widget)
5732{
5733 if (!dialog_window)
5734 {
5735 CtkWidget *content_area;
5736 CtkWidget *button;
5737
5738 dialog_window = ctk_dialog_new ();
5739 ctk_window_set_screen (CTK_WINDOW (dialog_window)((((CtkWindow*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((dialog_window)), ((ctk_window_get_type ()))))))
,
5740 ctk_widget_get_screen (widget));
5741
5742 g_signal_connect (dialog_window, "destroy",g_signal_connect_data ((dialog_window), ("destroy"), (((GCallback
) (ctk_widget_destroyed))), (&dialog_window), ((void*)0),
(GConnectFlags) 0)
5743 G_CALLBACK (ctk_widget_destroyed),g_signal_connect_data ((dialog_window), ("destroy"), (((GCallback
) (ctk_widget_destroyed))), (&dialog_window), ((void*)0),
(GConnectFlags) 0)
5744 &dialog_window)g_signal_connect_data ((dialog_window), ("destroy"), (((GCallback
) (ctk_widget_destroyed))), (&dialog_window), ((void*)0),
(GConnectFlags) 0)
;
5745 g_signal_connect (dialog_window, "destroy",g_signal_connect_data ((dialog_window), ("destroy"), (((GCallback
) (event_watcher_down))), (((void*)0)), ((void*)0), (GConnectFlags
) 0)
5746 G_CALLBACK (event_watcher_down),g_signal_connect_data ((dialog_window), ("destroy"), (((GCallback
) (event_watcher_down))), (((void*)0)), ((void*)0), (GConnectFlags
) 0)
5747 NULL)g_signal_connect_data ((dialog_window), ("destroy"), (((GCallback
) (event_watcher_down))), (((void*)0)), ((void*)0), (GConnectFlags
) 0)
;
5748
5749 content_area = ctk_dialog_get_content_area (CTK_DIALOG (dialog_window)((((CtkDialog*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((dialog_window)), ((ctk_dialog_get_type ()))))))
);
5750
5751 ctk_window_set_title (CTK_WINDOW (dialog_window)((((CtkWindow*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((dialog_window)), ((ctk_window_get_type ()))))))
, "Event Watcher");
5752 ctk_container_set_border_width (CTK_CONTAINER (dialog_window)((((CtkContainer*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((dialog_window)), ((ctk_container_get_type ()))))))
, 0);
5753 ctk_widget_set_size_request (dialog_window, 200, 110);
5754
5755 button = ctk_toggle_button_new_with_label ("Activate Watch");
5756 g_signal_connect (button, "clicked",g_signal_connect_data ((button), ("clicked"), (((GCallback) (
event_watcher_toggle))), (((void*)0)), ((void*)0), (GConnectFlags
) 0)
5757 G_CALLBACK (event_watcher_toggle),g_signal_connect_data ((button), ("clicked"), (((GCallback) (
event_watcher_toggle))), (((void*)0)), ((void*)0), (GConnectFlags
) 0)
5758 NULL)g_signal_connect_data ((button), ("clicked"), (((GCallback) (
event_watcher_toggle))), (((void*)0)), ((void*)0), (GConnectFlags
) 0)
;
5759 ctk_container_set_border_width (CTK_CONTAINER (button)((((CtkContainer*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((button)), ((ctk_container_get_type ()))))))
, 10);
5760 ctk_box_pack_start (CTK_BOX (content_area)((((CtkBox*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((content_area)), ((ctk_box_get_type ()))))))
, button, TRUE(!(0)), TRUE(!(0)), 0);
5761 ctk_widget_show (button);
5762
5763 ctk_dialog_add_button (CTK_DIALOG (dialog_window)((((CtkDialog*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((dialog_window)), ((ctk_dialog_get_type ()))))))
, "Close", CTK_RESPONSE_CLOSE);
5764 g_signal_connect (dialog_window, "response", G_CALLBACK (ctk_widget_destroy), NULL)g_signal_connect_data ((dialog_window), ("response"), (((GCallback
) (ctk_widget_destroy))), (((void*)0)), ((void*)0), (GConnectFlags
) 0)
;
5765 }
5766
5767 if (!ctk_widget_get_visible (dialog_window))
5768 ctk_widget_show (dialog_window);
5769 else
5770 ctk_widget_destroy (dialog_window);
5771}
5772
5773/*
5774 * CtkRange
5775 */
5776
5777static gchar*
5778reformat_value (CtkScale *scale,
5779 gdouble value)
5780{
5781 return g_strdup_printf ("-->%0.*g<--",
5782 ctk_scale_get_digits (scale), value);
5783}
5784
5785static void
5786create_range_controls (CtkWidget *widget)
5787{
5788 static CtkWidget *window = NULL((void*)0);
5789
5790 if (!window)
5791 {
5792 CtkWidget *box1;
5793 CtkWidget *box2;
5794 CtkWidget *button;
5795 CtkWidget *scrollbar;
5796 CtkWidget *scale;
5797 CtkWidget *separator;
5798 CtkAdjustment *adjustment;
5799 CtkWidget *hbox;
5800
5801 window = ctk_window_new (CTK_WINDOW_TOPLEVEL);
5802
5803 ctk_window_set_screen (CTK_WINDOW (window)((((CtkWindow*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((window)), ((ctk_window_get_type ()))))))
,
5804 ctk_widget_get_screen (widget));
5805
5806 g_signal_connect (window, "destroy",g_signal_connect_data ((window), ("destroy"), (((GCallback) (
ctk_widget_destroyed))), (&window), ((void*)0), (GConnectFlags
) 0)
5807 G_CALLBACK (ctk_widget_destroyed),g_signal_connect_data ((window), ("destroy"), (((GCallback) (
ctk_widget_destroyed))), (&window), ((void*)0), (GConnectFlags
) 0)
5808 &window)g_signal_connect_data ((window), ("destroy"), (((GCallback) (
ctk_widget_destroyed))), (&window), ((void*)0), (GConnectFlags
) 0)
;
5809
5810 ctk_window_set_title (CTK_WINDOW (window)((((CtkWindow*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((window)), ((ctk_window_get_type ()))))))
, "range controls");
5811 ctk_container_set_border_width (CTK_CONTAINER (window)((((CtkContainer*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((window)), ((ctk_container_get_type ()))))))
, 0);
5812
5813
5814 box1 = ctk_box_new (CTK_ORIENTATION_VERTICAL, 0);
5815 ctk_container_add (CTK_CONTAINER (window)((((CtkContainer*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((window)), ((ctk_container_get_type ()))))))
, box1);
5816 ctk_widget_show (box1);
5817
5818
5819 box2 = ctk_box_new (CTK_ORIENTATION_VERTICAL, 10);
5820 ctk_container_set_border_width (CTK_CONTAINER (box2)((((CtkContainer*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((box2)), ((ctk_container_get_type ()))))))
, 10);
5821 ctk_box_pack_start (CTK_BOX (box1)((((CtkBox*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((box1)), ((ctk_box_get_type ()))))))
, box2, TRUE(!(0)), TRUE(!(0)), 0);
5822 ctk_widget_show (box2);
5823
5824
5825 adjustment = ctk_adjustment_new (0.0, 0.0, 101.0, 0.1, 1.0, 1.0);
5826
5827 scale = ctk_scale_new (CTK_ORIENTATION_HORIZONTAL, CTK_ADJUSTMENT (adjustment)((((CtkAdjustment*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((adjustment)), ((ctk_adjustment_get_type ()))))))
);
5828 ctk_widget_set_size_request (CTK_WIDGET (scale)((((CtkWidget*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((scale)), ((ctk_widget_get_type ()))))))
, 150, -1);
5829 ctk_scale_set_digits (CTK_SCALE (scale)((((CtkScale*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((scale)), ((ctk_scale_get_type ()))))))
, 1);
5830 ctk_scale_set_draw_value (CTK_SCALE (scale)((((CtkScale*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((scale)), ((ctk_scale_get_type ()))))))
, TRUE(!(0)));
5831 ctk_box_pack_start (CTK_BOX (box2)((((CtkBox*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((box2)), ((ctk_box_get_type ()))))))
, scale, TRUE(!(0)), TRUE(!(0)), 0);
5832 ctk_widget_show (scale);
5833
5834 scrollbar = ctk_scrollbar_new (CTK_ORIENTATION_HORIZONTAL, CTK_ADJUSTMENT (adjustment)((((CtkAdjustment*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((adjustment)), ((ctk_adjustment_get_type ()))))))
);
5835 ctk_box_pack_start (CTK_BOX (box2)((((CtkBox*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((box2)), ((ctk_box_get_type ()))))))
, scrollbar, TRUE(!(0)), TRUE(!(0)), 0);
5836 ctk_widget_show (scrollbar);
5837
5838 scale = ctk_scale_new (CTK_ORIENTATION_HORIZONTAL, CTK_ADJUSTMENT (adjustment)((((CtkAdjustment*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((adjustment)), ((ctk_adjustment_get_type ()))))))
);
5839 ctk_scale_set_draw_value (CTK_SCALE (scale)((((CtkScale*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((scale)), ((ctk_scale_get_type ()))))))
, TRUE(!(0)));
5840 g_signal_connect (scale,g_signal_connect_data ((scale), ("format_value"), (((GCallback
) (reformat_value))), (((void*)0)), ((void*)0), (GConnectFlags
) 0)
5841 "format_value",g_signal_connect_data ((scale), ("format_value"), (((GCallback
) (reformat_value))), (((void*)0)), ((void*)0), (GConnectFlags
) 0)
5842 G_CALLBACK (reformat_value),g_signal_connect_data ((scale), ("format_value"), (((GCallback
) (reformat_value))), (((void*)0)), ((void*)0), (GConnectFlags
) 0)
5843 NULL)g_signal_connect_data ((scale), ("format_value"), (((GCallback
) (reformat_value))), (((void*)0)), ((void*)0), (GConnectFlags
) 0)
;
5844 ctk_box_pack_start (CTK_BOX (box2)((((CtkBox*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((box2)), ((ctk_box_get_type ()))))))
, scale, TRUE(!(0)), TRUE(!(0)), 0);
5845 ctk_widget_show (scale);
5846
5847 hbox = ctk_box_new (CTK_ORIENTATION_HORIZONTAL, 0);
5848
5849 scale = ctk_scale_new (CTK_ORIENTATION_VERTICAL, CTK_ADJUSTMENT (adjustment)((((CtkAdjustment*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((adjustment)), ((ctk_adjustment_get_type ()))))))
);
5850 ctk_widget_set_size_request (scale, -1, 200);
5851 ctk_scale_set_digits (CTK_SCALE (scale)((((CtkScale*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((scale)), ((ctk_scale_get_type ()))))))
, 2);
5852 ctk_scale_set_draw_value (CTK_SCALE (scale)((((CtkScale*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((scale)), ((ctk_scale_get_type ()))))))
, TRUE(!(0)));
5853 ctk_box_pack_start (CTK_BOX (hbox)((((CtkBox*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((hbox)), ((ctk_box_get_type ()))))))
, scale, TRUE(!(0)), TRUE(!(0)), 0);
5854 ctk_widget_show (scale);
5855
5856 scale = ctk_scale_new (CTK_ORIENTATION_VERTICAL, CTK_ADJUSTMENT (adjustment)((((CtkAdjustment*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((adjustment)), ((ctk_adjustment_get_type ()))))))
);
5857 ctk_widget_set_size_request (scale, -1, 200);
5858 ctk_scale_set_digits (CTK_SCALE (scale)((((CtkScale*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((scale)), ((ctk_scale_get_type ()))))))
, 2);
5859 ctk_scale_set_draw_value (CTK_SCALE (scale)((((CtkScale*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((scale)), ((ctk_scale_get_type ()))))))
, TRUE(!(0)));
5860 ctk_range_set_inverted (CTK_RANGE (scale)((((CtkRange*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((scale)), ((ctk_range_get_type ()))))))
, TRUE(!(0)));
5861 ctk_box_pack_start (CTK_BOX (hbox)((((CtkBox*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((hbox)), ((ctk_box_get_type ()))))))
, scale, TRUE(!(0)), TRUE(!(0)), 0);
5862 ctk_widget_show (scale);
5863
5864 scale = ctk_scale_new (CTK_ORIENTATION_VERTICAL, CTK_ADJUSTMENT (adjustment)((((CtkAdjustment*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((adjustment)), ((ctk_adjustment_get_type ()))))))
);
5865 ctk_scale_set_draw_value (CTK_SCALE (scale)((((CtkScale*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((scale)), ((ctk_scale_get_type ()))))))
, TRUE(!(0)));
5866 g_signal_connect (scale,g_signal_connect_data ((scale), ("format_value"), (((GCallback
) (reformat_value))), (((void*)0)), ((void*)0), (GConnectFlags
) 0)
5867 "format_value",g_signal_connect_data ((scale), ("format_value"), (((GCallback
) (reformat_value))), (((void*)0)), ((void*)0), (GConnectFlags
) 0)
5868 G_CALLBACK (reformat_value),g_signal_connect_data ((scale), ("format_value"), (((GCallback
) (reformat_value))), (((void*)0)), ((void*)0), (GConnectFlags
) 0)
5869 NULL)g_signal_connect_data ((scale), ("format_value"), (((GCallback
) (reformat_value))), (((void*)0)), ((void*)0), (GConnectFlags
) 0)
;
5870 ctk_box_pack_start (CTK_BOX (hbox)((((CtkBox*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((hbox)), ((ctk_box_get_type ()))))))
, scale, TRUE(!(0)), TRUE(!(0)), 0);
5871 ctk_widget_show (scale);
5872
5873
5874 ctk_box_pack_start (CTK_BOX (box2)((((CtkBox*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((box2)), ((ctk_box_get_type ()))))))
, hbox, TRUE(!(0)), TRUE(!(0)), 0);
5875 ctk_widget_show (hbox);
5876
5877 separator = ctk_separator_new (CTK_ORIENTATION_HORIZONTAL);
5878 ctk_box_pack_start (CTK_BOX (box1)((((CtkBox*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((box1)), ((ctk_box_get_type ()))))))
, separator, FALSE(0), TRUE(!(0)), 0);
5879 ctk_widget_show (separator);
5880
5881
5882 box2 = ctk_box_new (CTK_ORIENTATION_VERTICAL, 10);
5883 ctk_container_set_border_width (CTK_CONTAINER (box2)((((CtkContainer*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((box2)), ((ctk_container_get_type ()))))))
, 10);
5884 ctk_box_pack_start (CTK_BOX (box1)((((CtkBox*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((box1)), ((ctk_box_get_type ()))))))
, box2, FALSE(0), TRUE(!(0)), 0);
5885 ctk_widget_show (box2);
5886
5887
5888 button = ctk_button_new_with_label ("close");
5889 g_signal_connect_swapped (button, "clicked",g_signal_connect_data ((button), ("clicked"), (((GCallback) (
ctk_widget_destroy))), (window), ((void*)0), G_CONNECT_SWAPPED
)
5890 G_CALLBACK (ctk_widget_destroy),g_signal_connect_data ((button), ("clicked"), (((GCallback) (
ctk_widget_destroy))), (window), ((void*)0), G_CONNECT_SWAPPED
)
5891 window)g_signal_connect_data ((button), ("clicked"), (((GCallback) (
ctk_widget_destroy))), (window), ((void*)0), G_CONNECT_SWAPPED
)
;
5892 ctk_box_pack_start (CTK_BOX (box2)((((CtkBox*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((box2)), ((ctk_box_get_type ()))))))
, button, TRUE(!(0)), TRUE(!(0)), 0);
5893 ctk_widget_set_can_default (button, TRUE(!(0)));
5894 ctk_widget_grab_default (button);
5895 ctk_widget_show (button);
5896 }
5897
5898 if (!ctk_widget_get_visible (window))
5899 ctk_widget_show (window);
5900 else
5901 ctk_widget_destroy (window);
5902}
5903
5904struct {
5905 CdkColor color;
5906 gchar *name;
5907} text_colors[] = {
5908 { { 0, 0x0000, 0x0000, 0x0000 }, "black" },
5909 { { 0, 0xFFFF, 0xFFFF, 0xFFFF }, "white" },
5910 { { 0, 0xFFFF, 0x0000, 0x0000 }, "red" },
5911 { { 0, 0x0000, 0xFFFF, 0x0000 }, "green" },
5912 { { 0, 0x0000, 0x0000, 0xFFFF }, "blue" },
5913 { { 0, 0x0000, 0xFFFF, 0xFFFF }, "cyan" },
5914 { { 0, 0xFFFF, 0x0000, 0xFFFF }, "magenta" },
5915 { { 0, 0xFFFF, 0xFFFF, 0x0000 }, "yellow" }
5916};
5917
5918int ntext_colors = sizeof(text_colors) / sizeof(text_colors[0]);
5919
5920/*
5921 * CtkNotebook
5922 */
5923
5924static const char * book_open_xpm[] = {
5925"16 16 4 1",
5926" c None s None",
5927". c black",
5928"X c #808080",
5929"o c white",
5930" ",
5931" .. ",
5932" .Xo. ... ",
5933" .Xoo. ..oo. ",
5934" .Xooo.Xooo... ",
5935" .Xooo.oooo.X. ",
5936" .Xooo.Xooo.X. ",
5937" .Xooo.oooo.X. ",
5938" .Xooo.Xooo.X. ",
5939" .Xooo.oooo.X. ",
5940" .Xoo.Xoo..X. ",
5941" .Xo.o..ooX. ",
5942" .X..XXXXX. ",
5943" ..X....... ",
5944" .. ",
5945" "};
5946
5947static const char * book_closed_xpm[] = {
5948"16 16 6 1",
5949" c None s None",
5950". c black",
5951"X c red",
5952"o c yellow",
5953"O c #808080",
5954"# c white",
5955" ",
5956" .. ",
5957" ..XX. ",
5958" ..XXXXX. ",
5959" ..XXXXXXXX. ",
5960".ooXXXXXXXXX. ",
5961"..ooXXXXXXXXX. ",
5962".X.ooXXXXXXXXX. ",
5963".XX.ooXXXXXX.. ",
5964" .XX.ooXXX..#O ",
5965" .XX.oo..##OO. ",
5966" .XX..##OO.. ",
5967" .X.#OO.. ",
5968" ..O.. ",
5969" .. ",
5970" "};
5971
5972GdkPixbuf *book_open;
5973GdkPixbuf *book_closed;
5974CtkWidget *sample_notebook;
5975
5976static void
5977set_page_image (CtkNotebook *notebook, gint page_num, GdkPixbuf *pixbuf)
5978{
5979 CtkWidget *page_widget;
5980 CtkWidget *pixwid;
5981
5982 page_widget = ctk_notebook_get_nth_page (notebook, page_num);
5983
5984 pixwid = g_object_get_data (G_OBJECT (page_widget)((((GObject*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((page_widget)), (((GType) ((20) << (2))))))))
, "tab_pixmap");
5985 ctk_image_set_from_pixbuf (CTK_IMAGE (pixwid)((((CtkImage*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((pixwid)), ((ctk_image_get_type ()))))))
, pixbuf);
5986
5987 pixwid = g_object_get_data (G_OBJECT (page_widget)((((GObject*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((page_widget)), (((GType) ((20) << (2))))))))
, "menu_pixmap");
5988 ctk_image_set_from_pixbuf (CTK_IMAGE (pixwid)((((CtkImage*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((pixwid)), ((ctk_image_get_type ()))))))
, pixbuf);
5989}
5990
5991static void
5992page_switch (CtkWidget *widget,
5993 gpointer *page G_GNUC_UNUSED__attribute__ ((__unused__)),
5994 gint page_num)
5995{
5996 CtkNotebook *notebook = CTK_NOTEBOOK (widget)((((CtkNotebook*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((widget)), ((ctk_notebook_get_type ()))))))
;
5997 gint old_page_num = ctk_notebook_get_current_page (notebook);
5998
5999 if (page_num == old_page_num)
6000 return;
6001
6002 set_page_image (notebook, page_num, book_open);
6003
6004 if (old_page_num != -1)
6005 set_page_image (notebook, old_page_num, book_closed);
6006}
6007
6008static void
6009tab_fill (CtkToggleButton *button, CtkWidget *child)
6010{
6011 ctk_container_child_set (CTK_CONTAINER (sample_notebook)((((CtkContainer*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((sample_notebook)), ((ctk_container_get_type ()))))))
, child,
6012 "tab-fill", ctk_toggle_button_get_active (button),
6013 NULL((void*)0));
6014}
6015
6016static void
6017tab_expand (CtkToggleButton *button, CtkWidget *child)
6018{
6019 ctk_container_child_set (CTK_CONTAINER (sample_notebook)((((CtkContainer*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((sample_notebook)), ((ctk_container_get_type ()))))))
, child,
6020 "tab-expand", ctk_toggle_button_get_active (button),
6021 NULL((void*)0));
6022}
6023
6024static void
6025create_pages (CtkNotebook *notebook, gint start, gint end)
6026{
6027 gint i;
6028
6029 for (i = start; i <= end; i++)
6030 {
6031 CtkWidget *child = NULL((void*)0);
6032 CtkWidget *button;
6033 CtkWidget *label;
6034 CtkWidget *hbox;
6035 CtkWidget *vbox;
6036 CtkWidget *label_box;
6037 CtkWidget *menu_box;
6038 CtkWidget *pixwid;
6039 char buffer[32];
6040 char accel_buffer[32];
6041
6042 sprintf (buffer, "Page %d", i);
6043 sprintf (accel_buffer, "Page _%d", i);
6044
6045 child = ctk_frame_new (buffer);
6046 ctk_container_set_border_width (CTK_CONTAINER (child)((((CtkContainer*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((child)), ((ctk_container_get_type ()))))))
, 10);
6047
6048 vbox = ctk_box_new (CTK_ORIENTATION_VERTICAL, 0);
6049 ctk_box_set_homogeneous (CTK_BOX (vbox)((((CtkBox*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((vbox)), ((ctk_box_get_type ()))))))
, TRUE(!(0)));
6050 ctk_container_set_border_width (CTK_CONTAINER (vbox)((((CtkContainer*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((vbox)), ((ctk_container_get_type ()))))))
, 10);
6051 ctk_container_add (CTK_CONTAINER (child)((((CtkContainer*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((child)), ((ctk_container_get_type ()))))))
, vbox);
6052
6053 hbox = ctk_box_new (CTK_ORIENTATION_HORIZONTAL, 0);
6054 ctk_box_set_homogeneous (CTK_BOX (hbox)((((CtkBox*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((hbox)), ((ctk_box_get_type ()))))))
, TRUE(!(0)));
6055 ctk_box_pack_start (CTK_BOX (vbox)((((CtkBox*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((vbox)), ((ctk_box_get_type ()))))))
, hbox, FALSE(0), TRUE(!(0)), 5);
6056
6057 button = ctk_check_button_new_with_label ("Fill Tab");
6058 ctk_box_pack_start (CTK_BOX (hbox)((((CtkBox*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((hbox)), ((ctk_box_get_type ()))))))
, button, TRUE(!(0)), TRUE(!(0)), 5);
6059 ctk_toggle_button_set_active (CTK_TOGGLE_BUTTON (button)((((CtkToggleButton*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((button)), ((ctk_toggle_button_get_type ()))))))
, TRUE(!(0)));
6060 g_signal_connect (button, "toggled",g_signal_connect_data ((button), ("toggled"), (((GCallback) (
tab_fill))), (child), ((void*)0), (GConnectFlags) 0)
6061 G_CALLBACK (tab_fill), child)g_signal_connect_data ((button), ("toggled"), (((GCallback) (
tab_fill))), (child), ((void*)0), (GConnectFlags) 0)
;
6062
6063 button = ctk_check_button_new_with_label ("Expand Tab");
6064 ctk_box_pack_start (CTK_BOX (hbox)((((CtkBox*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((hbox)), ((ctk_box_get_type ()))))))
, button, TRUE(!(0)), TRUE(!(0)), 5);
6065 g_signal_connect (button, "toggled",g_signal_connect_data ((button), ("toggled"), (((GCallback) (
tab_expand))), (child), ((void*)0), (GConnectFlags) 0)
6066 G_CALLBACK (tab_expand), child)g_signal_connect_data ((button), ("toggled"), (((GCallback) (
tab_expand))), (child), ((void*)0), (GConnectFlags) 0)
;
6067
6068 button = ctk_button_new_with_label ("Hide Page");
6069 ctk_box_pack_end (CTK_BOX (vbox)((((CtkBox*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((vbox)), ((ctk_box_get_type ()))))))
, button, FALSE(0), FALSE(0), 5);
6070 g_signal_connect_swapped (button, "clicked",g_signal_connect_data ((button), ("clicked"), (((GCallback) (
ctk_widget_hide))), (child), ((void*)0), G_CONNECT_SWAPPED)
6071 G_CALLBACK (ctk_widget_hide),g_signal_connect_data ((button), ("clicked"), (((GCallback) (
ctk_widget_hide))), (child), ((void*)0), G_CONNECT_SWAPPED)
6072 child)g_signal_connect_data ((button), ("clicked"), (((GCallback) (
ctk_widget_hide))), (child), ((void*)0), G_CONNECT_SWAPPED)
;
6073
6074 ctk_widget_show_all (child);
6075
6076 label_box = ctk_box_new (CTK_ORIENTATION_HORIZONTAL, 0);
6077 pixwid = ctk_image_new_from_pixbuf (book_closed);
6078 g_object_set_data (G_OBJECT (child)((((GObject*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((child)), (((GType) ((20) << (2))))))))
, "tab_pixmap", pixwid);
6079
6080 ctk_box_pack_start (CTK_BOX (label_box)((((CtkBox*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((label_box)), ((ctk_box_get_type ()))))))
, pixwid, FALSE(0), TRUE(!(0)), 0);
6081 ctk_widget_set_margin_start (pixwid, 3);
6082 ctk_widget_set_margin_end (pixwid, 3);
6083 ctk_widget_set_margin_bottom (pixwid, 1);
6084 ctk_widget_set_margin_top (pixwid, 1);
6085 label = ctk_label_new_with_mnemonic (accel_buffer);
6086 ctk_box_pack_start (CTK_BOX (label_box)((((CtkBox*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((label_box)), ((ctk_box_get_type ()))))))
, label, FALSE(0), TRUE(!(0)), 0);
6087 ctk_widget_show_all (label_box);
6088
6089
6090 menu_box = ctk_box_new (CTK_ORIENTATION_HORIZONTAL, 0);
6091 pixwid = ctk_image_new_from_pixbuf (book_closed);
6092 g_object_set_data (G_OBJECT (child)((((GObject*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((child)), (((GType) ((20) << (2))))))))
, "menu_pixmap", pixwid);
6093
6094 ctk_box_pack_start (CTK_BOX (menu_box)((((CtkBox*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((menu_box)), ((ctk_box_get_type ()))))))
, pixwid, FALSE(0), TRUE(!(0)), 0);
6095 ctk_widget_set_margin_start (pixwid, 3);
6096 ctk_widget_set_margin_end (pixwid, 3);
6097 ctk_widget_set_margin_bottom (pixwid, 1);
6098 ctk_widget_set_margin_top (pixwid, 1);
6099 label = ctk_label_new (buffer);
6100 ctk_box_pack_start (CTK_BOX (menu_box)((((CtkBox*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((menu_box)), ((ctk_box_get_type ()))))))
, label, FALSE(0), TRUE(!(0)), 0);
6101 ctk_widget_show_all (menu_box);
6102
6103 ctk_notebook_append_page_menu (notebook, child, label_box, menu_box);
6104 }
6105}
6106
6107static void
6108rotate_notebook (CtkButton *button G_GNUC_UNUSED__attribute__ ((__unused__)),
6109 CtkNotebook *notebook)
6110{
6111 ctk_notebook_set_tab_pos (notebook, (ctk_notebook_get_tab_pos (notebook) + 1) % 4);
6112}
6113
6114static void
6115show_all_pages (CtkButton *button G_GNUC_UNUSED__attribute__ ((__unused__)),
6116 CtkNotebook *notebook)
6117{
6118 ctk_container_foreach (CTK_CONTAINER (notebook)((((CtkContainer*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((notebook)), ((ctk_container_get_type ()))))))
,
6119 (CtkCallback) ctk_widget_show, NULL((void*)0));
6120}
6121
6122static void
6123notebook_type_changed (CtkWidget *optionmenu,
6124 gpointer data)
6125{
6126 CtkNotebook *notebook;
6127 gint i, c;
6128
6129 enum {
6130 STANDARD,
6131 NOTABS,
6132 BORDERLESS,
6133 SCROLLABLE
6134 };
6135
6136 notebook = CTK_NOTEBOOK (data)((((CtkNotebook*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((data)), ((ctk_notebook_get_type ()))))))
;
6137
6138 c = ctk_combo_box_get_active (CTK_COMBO_BOX (optionmenu)((((CtkComboBox*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((optionmenu)), ((ctk_combo_box_get_type ()))))))
);
6139
6140 switch (c)
6141 {
6142 case STANDARD:
6143 /* standard notebook */
6144 ctk_notebook_set_show_tabs (notebook, TRUE(!(0)));
6145 ctk_notebook_set_show_border (notebook, TRUE(!(0)));
6146 ctk_notebook_set_scrollable (notebook, FALSE(0));
6147 break;
6148
6149 case NOTABS:
6150 /* notabs notebook */
6151 ctk_notebook_set_show_tabs (notebook, FALSE(0));
6152 ctk_notebook_set_show_border (notebook, TRUE(!(0)));
6153 break;
6154
6155 case BORDERLESS:
6156 /* borderless */
6157 ctk_notebook_set_show_tabs (notebook, FALSE(0));
6158 ctk_notebook_set_show_border (notebook, FALSE(0));
6159 break;
6160
6161 case SCROLLABLE:
6162 /* scrollable */
6163 ctk_notebook_set_show_tabs (notebook, TRUE(!(0)));
6164 ctk_notebook_set_show_border (notebook, TRUE(!(0)));
6165 ctk_notebook_set_scrollable (notebook, TRUE(!(0)));
6166 if (ctk_notebook_get_n_pages (notebook) == 5)
6167 create_pages (notebook, 6, 15);
6168
6169 return;
6170 break;
6171 }
6172
6173 if (ctk_notebook_get_n_pages (notebook) == 15)
6174 for (i = 0; i < 10; i++)
6175 ctk_notebook_remove_page (notebook, 5);
6176}
6177
6178static void
6179notebook_popup (CtkToggleButton *button,
6180 CtkNotebook *notebook)
6181{
6182 if (ctk_toggle_button_get_active (button))
6183 ctk_notebook_popup_enable (notebook);
6184 else
6185 ctk_notebook_popup_disable (notebook);
6186}
6187
6188static void
6189create_notebook (CtkWidget *widget)
6190{
6191 static CtkWidget *window = NULL((void*)0);
6192
6193 if (!window)
6194 {
6195 CtkWidget *box1;
6196 CtkWidget *box2;
6197 CtkWidget *button;
6198 CtkWidget *separator;
6199 CtkWidget *omenu;
6200 CtkWidget *label;
6201
6202 static gchar *items[] =
6203 {
6204 "Standard",
6205 "No tabs",
6206 "Borderless",
6207 "Scrollable"
6208 };
6209
6210 window = ctk_window_new (CTK_WINDOW_TOPLEVEL);
6211 ctk_window_set_screen (CTK_WINDOW (window)((((CtkWindow*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((window)), ((ctk_window_get_type ()))))))
,
6212 ctk_widget_get_screen (widget));
6213
6214 g_signal_connect (window, "destroy",g_signal_connect_data ((window), ("destroy"), (((GCallback) (
ctk_widget_destroyed))), (&window), ((void*)0), (GConnectFlags
) 0)
6215 G_CALLBACK (ctk_widget_destroyed),g_signal_connect_data ((window), ("destroy"), (((GCallback) (
ctk_widget_destroyed))), (&window), ((void*)0), (GConnectFlags
) 0)
6216 &window)g_signal_connect_data ((window), ("destroy"), (((GCallback) (
ctk_widget_destroyed))), (&window), ((void*)0), (GConnectFlags
) 0)
;
6217
6218 ctk_window_set_title (CTK_WINDOW (window)((((CtkWindow*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((window)), ((ctk_window_get_type ()))))))
, "notebook");
6219 ctk_container_set_border_width (CTK_CONTAINER (window)((((CtkContainer*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((window)), ((ctk_container_get_type ()))))))
, 0);
6220
6221 box1 = ctk_box_new (CTK_ORIENTATION_VERTICAL, 0);
6222 ctk_container_add (CTK_CONTAINER (window)((((CtkContainer*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((window)), ((ctk_container_get_type ()))))))
, box1);
6223
6224 sample_notebook = ctk_notebook_new ();
6225 g_signal_connect (sample_notebook, "switch_page",g_signal_connect_data ((sample_notebook), ("switch_page"), ((
(GCallback) (page_switch))), (((void*)0)), ((void*)0), (GConnectFlags
) 0)
6226 G_CALLBACK (page_switch), NULL)g_signal_connect_data ((sample_notebook), ("switch_page"), ((
(GCallback) (page_switch))), (((void*)0)), ((void*)0), (GConnectFlags
) 0)
;
6227 ctk_notebook_set_tab_pos (CTK_NOTEBOOK (sample_notebook)((((CtkNotebook*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((sample_notebook)), ((ctk_notebook_get_type ()))))))
, CTK_POS_TOP);
6228 ctk_box_pack_start (CTK_BOX (box1)((((CtkBox*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((box1)), ((ctk_box_get_type ()))))))
, sample_notebook, TRUE(!(0)), TRUE(!(0)), 0);
6229 ctk_container_set_border_width (CTK_CONTAINER (sample_notebook)((((CtkContainer*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((sample_notebook)), ((ctk_container_get_type ()))))))
, 10);
6230
6231 ctk_widget_realize (sample_notebook);
6232
6233 if (!book_open)
6234 book_open = gdk_pixbuf_new_from_xpm_data (book_open_xpm);
6235
6236 if (!book_closed)
6237 book_closed = gdk_pixbuf_new_from_xpm_data (book_closed_xpm);
6238
6239 create_pages (CTK_NOTEBOOK (sample_notebook)((((CtkNotebook*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((sample_notebook)), ((ctk_notebook_get_type ()))))))
, 1, 5);
6240
6241 separator = ctk_separator_new (CTK_ORIENTATION_HORIZONTAL);
6242 ctk_box_pack_start (CTK_BOX (box1)((((CtkBox*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((box1)), ((ctk_box_get_type ()))))))
, separator, FALSE(0), TRUE(!(0)), 10);
6243
6244 box2 = ctk_box_new (CTK_ORIENTATION_HORIZONTAL, 5);
6245 ctk_container_set_border_width (CTK_CONTAINER (box2)((((CtkContainer*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((box2)), ((ctk_container_get_type ()))))))
, 10);
6246 ctk_box_pack_start (CTK_BOX (box1)((((CtkBox*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((box1)), ((ctk_box_get_type ()))))))
, box2, FALSE(0), TRUE(!(0)), 0);
6247
6248 button = ctk_check_button_new_with_label ("popup menu");
6249 ctk_box_pack_start (CTK_BOX (box2)((((CtkBox*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((box2)), ((ctk_box_get_type ()))))))
, button, TRUE(!(0)), FALSE(0), 0);
6250 g_signal_connect (button, "clicked",g_signal_connect_data ((button), ("clicked"), (((GCallback) (
notebook_popup))), (sample_notebook), ((void*)0), (GConnectFlags
) 0)
6251 G_CALLBACK (notebook_popup),g_signal_connect_data ((button), ("clicked"), (((GCallback) (
notebook_popup))), (sample_notebook), ((void*)0), (GConnectFlags
) 0)
6252 sample_notebook)g_signal_connect_data ((button), ("clicked"), (((GCallback) (
notebook_popup))), (sample_notebook), ((void*)0), (GConnectFlags
) 0)
;
6253
6254 box2 = ctk_box_new (CTK_ORIENTATION_HORIZONTAL, 5);
6255 ctk_container_set_border_width (CTK_CONTAINER (box2)((((CtkContainer*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((box2)), ((ctk_container_get_type ()))))))
, 10);
6256 ctk_box_pack_start (CTK_BOX (box1)((((CtkBox*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((box1)), ((ctk_box_get_type ()))))))
, box2, FALSE(0), TRUE(!(0)), 0);
6257
6258 label = ctk_label_new ("Notebook Style :");
6259 ctk_box_pack_start (CTK_BOX (box2)((((CtkBox*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((box2)), ((ctk_box_get_type ()))))))
, label, FALSE(0), TRUE(!(0)), 0);
6260
6261 omenu = build_option_menu (items, G_N_ELEMENTS (items)(sizeof (items) / sizeof ((items)[0])), 0,
6262 notebook_type_changed,
6263 sample_notebook);
6264 ctk_box_pack_start (CTK_BOX (box2)((((CtkBox*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((box2)), ((ctk_box_get_type ()))))))
, omenu, FALSE(0), TRUE(!(0)), 0);
6265
6266 button = ctk_button_new_with_label ("Show all Pages");
6267 ctk_box_pack_start (CTK_BOX (box2)((((CtkBox*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((box2)), ((ctk_box_get_type ()))))))
, button, FALSE(0), TRUE(!(0)), 0);
6268 g_signal_connect (button, "clicked",g_signal_connect_data ((button), ("clicked"), (((GCallback) (
show_all_pages))), (sample_notebook), ((void*)0), (GConnectFlags
) 0)
6269 G_CALLBACK (show_all_pages), sample_notebook)g_signal_connect_data ((button), ("clicked"), (((GCallback) (
show_all_pages))), (sample_notebook), ((void*)0), (GConnectFlags
) 0)
;
6270
6271 box2 = ctk_box_new (CTK_ORIENTATION_HORIZONTAL, 10);
6272 ctk_box_set_homogeneous (CTK_BOX (box2)((((CtkBox*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((box2)), ((ctk_box_get_type ()))))))
, TRUE(!(0)));
6273 ctk_container_set_border_width (CTK_CONTAINER (box2)((((CtkContainer*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((box2)), ((ctk_container_get_type ()))))))
, 10);
6274 ctk_box_pack_start (CTK_BOX (box1)((((CtkBox*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((box1)), ((ctk_box_get_type ()))))))
, box2, FALSE(0), TRUE(!(0)), 0);
6275
6276 button = ctk_button_new_with_label ("prev");
6277 g_signal_connect_swapped (button, "clicked",g_signal_connect_data ((button), ("clicked"), (((GCallback) (
ctk_notebook_prev_page))), (sample_notebook), ((void*)0), G_CONNECT_SWAPPED
)
6278 G_CALLBACK (ctk_notebook_prev_page),g_signal_connect_data ((button), ("clicked"), (((GCallback) (
ctk_notebook_prev_page))), (sample_notebook), ((void*)0), G_CONNECT_SWAPPED
)
6279 sample_notebook)g_signal_connect_data ((button), ("clicked"), (((GCallback) (
ctk_notebook_prev_page))), (sample_notebook), ((void*)0), G_CONNECT_SWAPPED
)
;
6280 ctk_box_pack_start (CTK_BOX (box2)((((CtkBox*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((box2)), ((ctk_box_get_type ()))))))
, button, TRUE(!(0)), TRUE(!(0)), 0);
6281
6282 button = ctk_button_new_with_label ("next");
6283 g_signal_connect_swapped (button, "clicked",g_signal_connect_data ((button), ("clicked"), (((GCallback) (
ctk_notebook_next_page))), (sample_notebook), ((void*)0), G_CONNECT_SWAPPED
)
6284 G_CALLBACK (ctk_notebook_next_page),g_signal_connect_data ((button), ("clicked"), (((GCallback) (
ctk_notebook_next_page))), (sample_notebook), ((void*)0), G_CONNECT_SWAPPED
)
6285 sample_notebook)g_signal_connect_data ((button), ("clicked"), (((GCallback) (
ctk_notebook_next_page))), (sample_notebook), ((void*)0), G_CONNECT_SWAPPED
)
;
6286 ctk_box_pack_start (CTK_BOX (box2)((((CtkBox*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((box2)), ((ctk_box_get_type ()))))))
, button, TRUE(!(0)), TRUE(!(0)), 0);
6287
6288 button = ctk_button_new_with_label ("rotate");
6289 g_signal_connect (button, "clicked",g_signal_connect_data ((button), ("clicked"), (((GCallback) (
rotate_notebook))), (sample_notebook), ((void*)0), (GConnectFlags
) 0)
6290 G_CALLBACK (rotate_notebook), sample_notebook)g_signal_connect_data ((button), ("clicked"), (((GCallback) (
rotate_notebook))), (sample_notebook), ((void*)0), (GConnectFlags
) 0)
;
6291 ctk_box_pack_start (CTK_BOX (box2)((((CtkBox*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((box2)), ((ctk_box_get_type ()))))))
, button, TRUE(!(0)), TRUE(!(0)), 0);
6292
6293 separator = ctk_separator_new (CTK_ORIENTATION_HORIZONTAL);
6294 ctk_box_pack_start (CTK_BOX (box1)((((CtkBox*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((box1)), ((ctk_box_get_type ()))))))
, separator, FALSE(0), TRUE(!(0)), 5);
6295
6296 button = ctk_button_new_with_label ("close");
6297 ctk_container_set_border_width (CTK_CONTAINER (button)((((CtkContainer*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((button)), ((ctk_container_get_type ()))))))
, 5);
6298 g_signal_connect_swapped (button, "clicked",g_signal_connect_data ((button), ("clicked"), (((GCallback) (
ctk_widget_destroy))), (window), ((void*)0), G_CONNECT_SWAPPED
)
6299 G_CALLBACK (ctk_widget_destroy),g_signal_connect_data ((button), ("clicked"), (((GCallback) (
ctk_widget_destroy))), (window), ((void*)0), G_CONNECT_SWAPPED
)
6300 window)g_signal_connect_data ((button), ("clicked"), (((GCallback) (
ctk_widget_destroy))), (window), ((void*)0), G_CONNECT_SWAPPED
)
;
6301 ctk_box_pack_start (CTK_BOX (box1)((((CtkBox*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((box1)), ((ctk_box_get_type ()))))))
, button, FALSE(0), FALSE(0), 0);
6302 ctk_widget_set_can_default (button, TRUE(!(0)));
6303 ctk_widget_grab_default (button);
6304 }
6305
6306 if (!ctk_widget_get_visible (window))
6307 ctk_widget_show_all (window);
6308 else
6309 ctk_widget_destroy (window);
6310}
6311
6312/*
6313 * CtkPanes
6314 */
6315
6316void
6317toggle_resize (CtkWidget *widget G_GNUC_UNUSED__attribute__ ((__unused__)),
6318 CtkWidget *child)
6319{
6320 CtkContainer *container = CTK_CONTAINER (ctk_widget_get_parent (child))((((CtkContainer*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((ctk_widget_get_parent (child))), ((ctk_container_get_type
()))))))
;
6321 GValue value = G_VALUE_INIT{ 0, { { 0 } } };
6322 g_value_init (&value, G_TYPE_BOOLEAN((GType) ((5) << (2))));
6323 ctk_container_child_get_property (container, child, "resize", &value);
6324 g_value_set_boolean (&value, !g_value_get_boolean (&value));
6325 ctk_container_child_set_property (container, child, "resize", &value);
6326}
6327
6328void
6329toggle_shrink (CtkWidget *widget G_GNUC_UNUSED__attribute__ ((__unused__)),
6330 CtkWidget *child)
6331{
6332 CtkContainer *container = CTK_CONTAINER (ctk_widget_get_parent (child))((((CtkContainer*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((ctk_widget_get_parent (child))), ((ctk_container_get_type
()))))))
;
6333 GValue value = G_VALUE_INIT{ 0, { { 0 } } };
6334 g_value_init (&value, G_TYPE_BOOLEAN((GType) ((5) << (2))));
6335 ctk_container_child_get_property (container, child, "shrink", &value);
6336 g_value_set_boolean (&value, !g_value_get_boolean (&value));
6337 ctk_container_child_set_property (container, child, "shrink", &value);
6338}
6339
6340CtkWidget *
6341create_pane_options (CtkPaned *paned,
6342 const gchar *frame_label,
6343 const gchar *label1,
6344 const gchar *label2)
6345{
6346 CtkWidget *child1, *child2;
6347 CtkWidget *frame;
6348 CtkWidget *grid;
6349 CtkWidget *label;
6350 CtkWidget *check_button;
6351
6352 child1 = ctk_paned_get_child1 (paned);
6353 child2 = ctk_paned_get_child2 (paned);
6354
6355 frame = ctk_frame_new (frame_label);
6356 ctk_container_set_border_width (CTK_CONTAINER (frame)((((CtkContainer*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((frame)), ((ctk_container_get_type ()))))))
, 4);
6357
6358 grid = ctk_grid_new ();
6359 ctk_container_add (CTK_CONTAINER (frame)((((CtkContainer*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((frame)), ((ctk_container_get_type ()))))))
, grid);
6360
6361 label = ctk_label_new (label1);
6362 ctk_grid_attach (CTK_GRID (grid)((((CtkGrid*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((grid)), ((ctk_grid_get_type ()))))))
, label, 0, 0, 1, 1);
6363
6364 check_button = ctk_check_button_new_with_label ("Resize");
6365 ctk_grid_attach (CTK_GRID (grid)((((CtkGrid*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((grid)), ((ctk_grid_get_type ()))))))
, check_button, 0, 1, 1, 1);
6366 g_signal_connect (check_button, "toggled",g_signal_connect_data ((check_button), ("toggled"), (((GCallback
) (toggle_resize))), (child1), ((void*)0), (GConnectFlags) 0)
6367 G_CALLBACK (toggle_resize),g_signal_connect_data ((check_button), ("toggled"), (((GCallback
) (toggle_resize))), (child1), ((void*)0), (GConnectFlags) 0)
6368 child1)g_signal_connect_data ((check_button), ("toggled"), (((GCallback
) (toggle_resize))), (child1), ((void*)0), (GConnectFlags) 0)
;
6369
6370 check_button = ctk_check_button_new_with_label ("Shrink");
6371 ctk_grid_attach (CTK_GRID (grid)((((CtkGrid*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((grid)), ((ctk_grid_get_type ()))))))
, check_button, 0, 2, 1, 1);
6372 ctk_toggle_button_set_active (CTK_TOGGLE_BUTTON (check_button)((((CtkToggleButton*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((check_button)), ((ctk_toggle_button_get_type ()))))))
,
6373 TRUE(!(0)));
6374 g_signal_connect (check_button, "toggled",g_signal_connect_data ((check_button), ("toggled"), (((GCallback
) (toggle_shrink))), (child1), ((void*)0), (GConnectFlags) 0)
6375 G_CALLBACK (toggle_shrink),g_signal_connect_data ((check_button), ("toggled"), (((GCallback
) (toggle_shrink))), (child1), ((void*)0), (GConnectFlags) 0)
6376 child1)g_signal_connect_data ((check_button), ("toggled"), (((GCallback
) (toggle_shrink))), (child1), ((void*)0), (GConnectFlags) 0)
;
6377
6378 label = ctk_label_new (label2);
6379 ctk_grid_attach (CTK_GRID (grid)((((CtkGrid*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((grid)), ((ctk_grid_get_type ()))))))
, label, 1, 0, 1, 1);
6380
6381 check_button = ctk_check_button_new_with_label ("Resize");
6382 ctk_grid_attach (CTK_GRID (grid)((((CtkGrid*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((grid)), ((ctk_grid_get_type ()))))))
, check_button, 1, 1, 1, 1);
6383 ctk_toggle_button_set_active (CTK_TOGGLE_BUTTON (check_button)((((CtkToggleButton*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((check_button)), ((ctk_toggle_button_get_type ()))))))
,
6384 TRUE(!(0)));
6385 g_signal_connect (check_button, "toggled",g_signal_connect_data ((check_button), ("toggled"), (((GCallback
) (toggle_resize))), (child2), ((void*)0), (GConnectFlags) 0)
6386 G_CALLBACK (toggle_resize),g_signal_connect_data ((check_button), ("toggled"), (((GCallback
) (toggle_resize))), (child2), ((void*)0), (GConnectFlags) 0)
6387 child2)g_signal_connect_data ((check_button), ("toggled"), (((GCallback
) (toggle_resize))), (child2), ((void*)0), (GConnectFlags) 0)
;
6388
6389 check_button = ctk_check_button_new_with_label ("Shrink");
6390 ctk_grid_attach (CTK_GRID (grid)((((CtkGrid*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((grid)), ((ctk_grid_get_type ()))))))
, check_button, 1, 2, 1, 1);
6391 ctk_toggle_button_set_active (CTK_TOGGLE_BUTTON (check_button)((((CtkToggleButton*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((check_button)), ((ctk_toggle_button_get_type ()))))))
,
6392 TRUE(!(0)));
6393 g_signal_connect (check_button, "toggled",g_signal_connect_data ((check_button), ("toggled"), (((GCallback
) (toggle_shrink))), (child2), ((void*)0), (GConnectFlags) 0)
6394 G_CALLBACK (toggle_shrink),g_signal_connect_data ((check_button), ("toggled"), (((GCallback
) (toggle_shrink))), (child2), ((void*)0), (GConnectFlags) 0)
6395 child2)g_signal_connect_data ((check_button), ("toggled"), (((GCallback
) (toggle_shrink))), (child2), ((void*)0), (GConnectFlags) 0)
;
6396
6397 return frame;
6398}
6399
6400void
6401create_panes (CtkWidget *widget)
6402{
6403 static CtkWidget *window = NULL((void*)0);
6404
6405 if (!window)
6406 {
6407 CtkWidget *frame;
6408 CtkWidget *hpaned;
6409 CtkWidget *vpaned;
6410 CtkWidget *button;
6411 CtkWidget *vbox;
6412
6413 window = ctk_window_new (CTK_WINDOW_TOPLEVEL);
6414
6415 ctk_window_set_screen (CTK_WINDOW (window)((((CtkWindow*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((window)), ((ctk_window_get_type ()))))))
,
6416 ctk_widget_get_screen (widget));
6417
6418 g_signal_connect (window, "destroy",g_signal_connect_data ((window), ("destroy"), (((GCallback) (
ctk_widget_destroyed))), (&window), ((void*)0), (GConnectFlags
) 0)
6419 G_CALLBACK (ctk_widget_destroyed),g_signal_connect_data ((window), ("destroy"), (((GCallback) (
ctk_widget_destroyed))), (&window), ((void*)0), (GConnectFlags
) 0)
6420 &window)g_signal_connect_data ((window), ("destroy"), (((GCallback) (
ctk_widget_destroyed))), (&window), ((void*)0), (GConnectFlags
) 0)
;
6421
6422 ctk_window_set_title (CTK_WINDOW (window)((((CtkWindow*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((window)), ((ctk_window_get_type ()))))))
, "Panes");
6423 ctk_container_set_border_width (CTK_CONTAINER (window)((((CtkContainer*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((window)), ((ctk_container_get_type ()))))))
, 0);
6424
6425 vbox = ctk_box_new (CTK_ORIENTATION_VERTICAL, 0);
6426 ctk_container_add (CTK_CONTAINER (window)((((CtkContainer*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((window)), ((ctk_container_get_type ()))))))
, vbox);
6427
6428 vpaned = ctk_paned_new (CTK_ORIENTATION_VERTICAL);
6429 ctk_box_pack_start (CTK_BOX (vbox)((((CtkBox*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((vbox)), ((ctk_box_get_type ()))))))
, vpaned, TRUE(!(0)), TRUE(!(0)), 0);
6430 ctk_container_set_border_width (CTK_CONTAINER(vpaned)((((CtkContainer*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((vpaned)), ((ctk_container_get_type ()))))))
, 5);
6431
6432 hpaned = ctk_paned_new (CTK_ORIENTATION_HORIZONTAL);
6433 ctk_paned_add1 (CTK_PANED (vpaned)((((CtkPaned*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((vpaned)), ((ctk_paned_get_type ()))))))
, hpaned);
6434
6435 frame = ctk_frame_new (NULL((void*)0));
6436 ctk_frame_set_shadow_type (CTK_FRAME(frame)((((CtkFrame*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((frame)), ((ctk_frame_get_type ()))))))
, CTK_SHADOW_IN);
6437 ctk_widget_set_size_request (frame, 60, 60);
6438 ctk_paned_add1 (CTK_PANED (hpaned)((((CtkPaned*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((hpaned)), ((ctk_paned_get_type ()))))))
, frame);
6439
6440 button = ctk_button_new_with_label ("Hi there");
6441 ctk_container_add (CTK_CONTAINER(frame)((((CtkContainer*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((frame)), ((ctk_container_get_type ()))))))
, button);
6442
6443 frame = ctk_frame_new (NULL((void*)0));
6444 ctk_frame_set_shadow_type (CTK_FRAME(frame)((((CtkFrame*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((frame)), ((ctk_frame_get_type ()))))))
, CTK_SHADOW_IN);
6445 ctk_widget_set_size_request (frame, 80, 60);
6446 ctk_paned_add2 (CTK_PANED (hpaned)((((CtkPaned*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((hpaned)), ((ctk_paned_get_type ()))))))
, frame);
6447
6448 frame = ctk_frame_new (NULL((void*)0));
6449 ctk_frame_set_shadow_type (CTK_FRAME(frame)((((CtkFrame*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((frame)), ((ctk_frame_get_type ()))))))
, CTK_SHADOW_IN);
6450 ctk_widget_set_size_request (frame, 60, 80);
6451 ctk_paned_add2 (CTK_PANED (vpaned)((((CtkPaned*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((vpaned)), ((ctk_paned_get_type ()))))))
, frame);
6452
6453 /* Now create toggle buttons to control sizing */
6454
6455 ctk_box_pack_start (CTK_BOX (vbox)((((CtkBox*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((vbox)), ((ctk_box_get_type ()))))))
,
6456 create_pane_options (CTK_PANED (hpaned)((((CtkPaned*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((hpaned)), ((ctk_paned_get_type ()))))))
,
6457 "Horizontal",
6458 "Left",
6459 "Right"),
6460 FALSE(0), FALSE(0), 0);
6461
6462 ctk_box_pack_start (CTK_BOX (vbox)((((CtkBox*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((vbox)), ((ctk_box_get_type ()))))))
,
6463 create_pane_options (CTK_PANED (vpaned)((((CtkPaned*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((vpaned)), ((ctk_paned_get_type ()))))))
,
6464 "Vertical",
6465 "Top",
6466 "Bottom"),
6467 FALSE(0), FALSE(0), 0);
6468
6469 ctk_widget_show_all (vbox);
6470 }
6471
6472 if (!ctk_widget_get_visible (window))
6473 ctk_widget_show (window);
6474 else
6475 ctk_widget_destroy (window);
6476}
6477
6478/*
6479 * Paned keyboard navigation
6480 */
6481
6482static CtkWidget*
6483paned_keyboard_window1 (CtkWidget *widget)
6484{
6485 CtkWidget *window1;
6486 CtkWidget *hpaned1;
6487 CtkWidget *frame1;
6488 CtkWidget *vbox1;
6489 CtkWidget *button7;
6490 CtkWidget *button8;
6491 CtkWidget *button9;
6492 CtkWidget *vpaned1;
6493 CtkWidget *frame2;
6494 CtkWidget *frame5;
6495 CtkWidget *hbox1;
6496 CtkWidget *button5;
6497 CtkWidget *button6;
6498 CtkWidget *frame3;
6499 CtkWidget *frame4;
6500 CtkWidget *grid1;
6501 CtkWidget *button1;
6502 CtkWidget *button2;
6503 CtkWidget *button3;
6504 CtkWidget *button4;
6505
6506 window1 = ctk_window_new (CTK_WINDOW_TOPLEVEL);
6507 ctk_window_set_title (CTK_WINDOW (window1)((((CtkWindow*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((window1)), ((ctk_window_get_type ()))))))
, "Basic paned navigation");
6508 ctk_window_set_screen (CTK_WINDOW (window1)((((CtkWindow*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((window1)), ((ctk_window_get_type ()))))))
,
6509 ctk_widget_get_screen (widget));
6510
6511 hpaned1 = ctk_paned_new (CTK_ORIENTATION_HORIZONTAL);
6512 ctk_container_add (CTK_CONTAINER (window1)((((CtkContainer*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((window1)), ((ctk_container_get_type ()))))))
, hpaned1);
6513
6514 frame1 = ctk_frame_new (NULL((void*)0));
6515 ctk_paned_pack1 (CTK_PANED (hpaned1)((((CtkPaned*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((hpaned1)), ((ctk_paned_get_type ()))))))
, frame1, FALSE(0), TRUE(!(0)));
6516 ctk_frame_set_shadow_type (CTK_FRAME (frame1)((((CtkFrame*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((frame1)), ((ctk_frame_get_type ()))))))
, CTK_SHADOW_IN);
6517
6518 vbox1 = ctk_box_new (CTK_ORIENTATION_VERTICAL, 0);
6519 ctk_container_add (CTK_CONTAINER (frame1)((((CtkContainer*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((frame1)), ((ctk_container_get_type ()))))))
, vbox1);
6520
6521 button7 = ctk_button_new_with_label ("button7");
6522 ctk_box_pack_start (CTK_BOX (vbox1)((((CtkBox*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((vbox1)), ((ctk_box_get_type ()))))))
, button7, FALSE(0), FALSE(0), 0);
6523
6524 button8 = ctk_button_new_with_label ("button8");
6525 ctk_box_pack_start (CTK_BOX (vbox1)((((CtkBox*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((vbox1)), ((ctk_box_get_type ()))))))
, button8, FALSE(0), FALSE(0), 0);
6526
6527 button9 = ctk_button_new_with_label ("button9");
6528 ctk_box_pack_start (CTK_BOX (vbox1)((((CtkBox*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((vbox1)), ((ctk_box_get_type ()))))))
, button9, FALSE(0), FALSE(0), 0);
6529
6530 vpaned1 = ctk_paned_new (CTK_ORIENTATION_VERTICAL);
6531 ctk_paned_pack2 (CTK_PANED (hpaned1)((((CtkPaned*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((hpaned1)), ((ctk_paned_get_type ()))))))
, vpaned1, TRUE(!(0)), TRUE(!(0)));
6532
6533 frame2 = ctk_frame_new (NULL((void*)0));
6534 ctk_paned_pack1 (CTK_PANED (vpaned1)((((CtkPaned*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((vpaned1)), ((ctk_paned_get_type ()))))))
, frame2, FALSE(0), TRUE(!(0)));
6535 ctk_frame_set_shadow_type (CTK_FRAME (frame2)((((CtkFrame*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((frame2)), ((ctk_frame_get_type ()))))))
, CTK_SHADOW_IN);
6536
6537 frame5 = ctk_frame_new (NULL((void*)0));
6538 ctk_container_add (CTK_CONTAINER (frame2)((((CtkContainer*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((frame2)), ((ctk_container_get_type ()))))))
, frame5);
6539
6540 hbox1 = ctk_box_new (CTK_ORIENTATION_HORIZONTAL, 0);
6541 ctk_container_add (CTK_CONTAINER (frame5)((((CtkContainer*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((frame5)), ((ctk_container_get_type ()))))))
, hbox1);
6542
6543 button5 = ctk_button_new_with_label ("button5");
6544 ctk_box_pack_start (CTK_BOX (hbox1)((((CtkBox*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((hbox1)), ((ctk_box_get_type ()))))))
, button5, FALSE(0), FALSE(0), 0);
6545
6546 button6 = ctk_button_new_with_label ("button6");
6547 ctk_box_pack_start (CTK_BOX (hbox1)((((CtkBox*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((hbox1)), ((ctk_box_get_type ()))))))
, button6, FALSE(0), FALSE(0), 0);
6548
6549 frame3 = ctk_frame_new (NULL((void*)0));
6550 ctk_paned_pack2 (CTK_PANED (vpaned1)((((CtkPaned*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((vpaned1)), ((ctk_paned_get_type ()))))))
, frame3, TRUE(!(0)), TRUE(!(0)));
6551 ctk_frame_set_shadow_type (CTK_FRAME (frame3)((((CtkFrame*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((frame3)), ((ctk_frame_get_type ()))))))
, CTK_SHADOW_IN);
6552
6553 frame4 = ctk_frame_new ("Buttons");
6554 ctk_container_add (CTK_CONTAINER (frame3)((((CtkContainer*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((frame3)), ((ctk_container_get_type ()))))))
, frame4);
6555 ctk_container_set_border_width (CTK_CONTAINER (frame4)((((CtkContainer*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((frame4)), ((ctk_container_get_type ()))))))
, 15);
6556
6557 grid1 = ctk_grid_new ();
6558 ctk_container_add (CTK_CONTAINER (frame4)((((CtkContainer*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((frame4)), ((ctk_container_get_type ()))))))
, grid1);
6559 ctk_container_set_border_width (CTK_CONTAINER (grid1)((((CtkContainer*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((grid1)), ((ctk_container_get_type ()))))))
, 11);
6560
6561 button1 = ctk_button_new_with_label ("button1");
6562 ctk_grid_attach (CTK_GRID (grid1)((((CtkGrid*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((grid1)), ((ctk_grid_get_type ()))))))
, button1, 0, 0, 1, 1);
6563
6564 button2 = ctk_button_new_with_label ("button2");
6565 ctk_grid_attach (CTK_GRID (grid1)((((CtkGrid*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((grid1)), ((ctk_grid_get_type ()))))))
, button2, 1, 0, 1, 1);
6566
6567 button3 = ctk_button_new_with_label ("button3");
6568 ctk_grid_attach (CTK_GRID (grid1)((((CtkGrid*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((grid1)), ((ctk_grid_get_type ()))))))
, button3, 0, 1, 1, 1);
6569
6570 button4 = ctk_button_new_with_label ("button4");
6571 ctk_grid_attach (CTK_GRID (grid1)((((CtkGrid*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((grid1)), ((ctk_grid_get_type ()))))))
, button4, 1, 1, 1, 1);
6572
6573 return window1;
6574}
6575
6576static CtkWidget*
6577paned_keyboard_window2 (CtkWidget *widget)
6578{
6579 CtkWidget *window2;
6580 CtkWidget *hpaned2;
6581 CtkWidget *frame6;
6582 CtkWidget *button13;
6583 CtkWidget *hbox2;
6584 CtkWidget *vpaned2;
6585 CtkWidget *frame7;
6586 CtkWidget *button12;
6587 CtkWidget *frame8;
6588 CtkWidget *button11;
6589 CtkWidget *button10;
6590
6591 window2 = ctk_window_new (CTK_WINDOW_TOPLEVEL);
6592 ctk_window_set_title (CTK_WINDOW (window2)((((CtkWindow*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((window2)), ((ctk_window_get_type ()))))))
, "\"button 10\" is not inside the horisontal pane");
6593
6594 ctk_window_set_screen (CTK_WINDOW (window2)((((CtkWindow*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((window2)), ((ctk_window_get_type ()))))))
,
6595 ctk_widget_get_screen (widget));
6596
6597 hpaned2 = ctk_paned_new (CTK_ORIENTATION_HORIZONTAL);
6598 ctk_container_add (CTK_CONTAINER (window2)((((CtkContainer*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((window2)), ((ctk_container_get_type ()))))))
, hpaned2);
6599
6600 frame6 = ctk_frame_new (NULL((void*)0));
6601 ctk_paned_pack1 (CTK_PANED (hpaned2)((((CtkPaned*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((hpaned2)), ((ctk_paned_get_type ()))))))
, frame6, FALSE(0), TRUE(!(0)));
6602 ctk_frame_set_shadow_type (CTK_FRAME (frame6)((((CtkFrame*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((frame6)), ((ctk_frame_get_type ()))))))
, CTK_SHADOW_IN);
6603
6604 button13 = ctk_button_new_with_label ("button13");
6605 ctk_container_add (CTK_CONTAINER (frame6)((((CtkContainer*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((frame6)), ((ctk_container_get_type ()))))))
, button13);
6606
6607 hbox2 = ctk_box_new (CTK_ORIENTATION_HORIZONTAL, 0);
6608 ctk_paned_pack2 (CTK_PANED (hpaned2)((((CtkPaned*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((hpaned2)), ((ctk_paned_get_type ()))))))
, hbox2, TRUE(!(0)), TRUE(!(0)));
6609
6610 vpaned2 = ctk_paned_new (CTK_ORIENTATION_VERTICAL);
6611 ctk_box_pack_start (CTK_BOX (hbox2)((((CtkBox*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((hbox2)), ((ctk_box_get_type ()))))))
, vpaned2, TRUE(!(0)), TRUE(!(0)), 0);
6612
6613 frame7 = ctk_frame_new (NULL((void*)0));
6614 ctk_paned_pack1 (CTK_PANED (vpaned2)((((CtkPaned*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((vpaned2)), ((ctk_paned_get_type ()))))))
, frame7, FALSE(0), TRUE(!(0)));
6615 ctk_frame_set_shadow_type (CTK_FRAME (frame7)((((CtkFrame*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((frame7)), ((ctk_frame_get_type ()))))))
, CTK_SHADOW_IN);
6616
6617 button12 = ctk_button_new_with_label ("button12");
6618 ctk_container_add (CTK_CONTAINER (frame7)((((CtkContainer*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((frame7)), ((ctk_container_get_type ()))))))
, button12);
6619
6620 frame8 = ctk_frame_new (NULL((void*)0));
6621 ctk_paned_pack2 (CTK_PANED (vpaned2)((((CtkPaned*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((vpaned2)), ((ctk_paned_get_type ()))))))
, frame8, TRUE(!(0)), TRUE(!(0)));
6622 ctk_frame_set_shadow_type (CTK_FRAME (frame8)((((CtkFrame*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((frame8)), ((ctk_frame_get_type ()))))))
, CTK_SHADOW_IN);
6623
6624 button11 = ctk_button_new_with_label ("button11");
6625 ctk_container_add (CTK_CONTAINER (frame8)((((CtkContainer*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((frame8)), ((ctk_container_get_type ()))))))
, button11);
6626
6627 button10 = ctk_button_new_with_label ("button10");
6628 ctk_box_pack_start (CTK_BOX (hbox2)((((CtkBox*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((hbox2)), ((ctk_box_get_type ()))))))
, button10, FALSE(0), FALSE(0), 0);
6629
6630 return window2;
6631}
6632
6633static CtkWidget*
6634paned_keyboard_window3 (CtkWidget *widget)
6635{
6636 CtkWidget *window3;
6637 CtkWidget *vbox2;
6638 CtkWidget *label1;
6639 CtkWidget *hpaned3;
6640 CtkWidget *frame9;
6641 CtkWidget *button14;
6642 CtkWidget *hpaned4;
6643 CtkWidget *frame10;
6644 CtkWidget *button15;
6645 CtkWidget *hpaned5;
6646 CtkWidget *frame11;
6647 CtkWidget *button16;
6648 CtkWidget *frame12;
6649 CtkWidget *button17;
6650
6651 window3 = ctk_window_new (CTK_WINDOW_TOPLEVEL);
6652 g_object_set_data (G_OBJECT (window3)((((GObject*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((window3)), (((GType) ((20) << (2))))))))
, "window3", window3);
6653 ctk_window_set_title (CTK_WINDOW (window3)((((CtkWindow*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((window3)), ((ctk_window_get_type ()))))))
, "Nested panes");
6654
6655 ctk_window_set_screen (CTK_WINDOW (window3)((((CtkWindow*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((window3)), ((ctk_window_get_type ()))))))
,
6656 ctk_widget_get_screen (widget));
6657
6658
6659 vbox2 = ctk_box_new (CTK_ORIENTATION_VERTICAL, 0);
6660 ctk_container_add (CTK_CONTAINER (window3)((((CtkContainer*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((window3)), ((ctk_container_get_type ()))))))
, vbox2);
6661
6662 label1 = ctk_label_new ("Three panes nested inside each other");
6663 ctk_box_pack_start (CTK_BOX (vbox2)((((CtkBox*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((vbox2)), ((ctk_box_get_type ()))))))
, label1, FALSE(0), FALSE(0), 0);
6664
6665 hpaned3 = ctk_paned_new (CTK_ORIENTATION_HORIZONTAL);
6666 ctk_box_pack_start (CTK_BOX (vbox2)((((CtkBox*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((vbox2)), ((ctk_box_get_type ()))))))
, hpaned3, TRUE(!(0)), TRUE(!(0)), 0);
6667
6668 frame9 = ctk_frame_new (NULL((void*)0));
6669 ctk_paned_pack1 (CTK_PANED (hpaned3)((((CtkPaned*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((hpaned3)), ((ctk_paned_get_type ()))))))
, frame9, FALSE(0), TRUE(!(0)));
6670 ctk_frame_set_shadow_type (CTK_FRAME (frame9)((((CtkFrame*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((frame9)), ((ctk_frame_get_type ()))))))
, CTK_SHADOW_IN);
6671
6672 button14 = ctk_button_new_with_label ("button14");
6673 ctk_container_add (CTK_CONTAINER (frame9)((((CtkContainer*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((frame9)), ((ctk_container_get_type ()))))))
, button14);
6674
6675 hpaned4 = ctk_paned_new (CTK_ORIENTATION_HORIZONTAL);
6676 ctk_paned_pack2 (CTK_PANED (hpaned3)((((CtkPaned*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((hpaned3)), ((ctk_paned_get_type ()))))))
, hpaned4, TRUE(!(0)), TRUE(!(0)));
6677
6678 frame10 = ctk_frame_new (NULL((void*)0));
6679 ctk_paned_pack1 (CTK_PANED (hpaned4)((((CtkPaned*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((hpaned4)), ((ctk_paned_get_type ()))))))
, frame10, FALSE(0), TRUE(!(0)));
6680 ctk_frame_set_shadow_type (CTK_FRAME (frame10)((((CtkFrame*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((frame10)), ((ctk_frame_get_type ()))))))
, CTK_SHADOW_IN);
6681
6682 button15 = ctk_button_new_with_label ("button15");
6683 ctk_container_add (CTK_CONTAINER (frame10)((((CtkContainer*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((frame10)), ((ctk_container_get_type ()))))))
, button15);
6684
6685 hpaned5 = ctk_paned_new (CTK_ORIENTATION_HORIZONTAL);
6686 ctk_paned_pack2 (CTK_PANED (hpaned4)((((CtkPaned*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((hpaned4)), ((ctk_paned_get_type ()))))))
, hpaned5, TRUE(!(0)), TRUE(!(0)));
6687
6688 frame11 = ctk_frame_new (NULL((void*)0));
6689 ctk_paned_pack1 (CTK_PANED (hpaned5)((((CtkPaned*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((hpaned5)), ((ctk_paned_get_type ()))))))
, frame11, FALSE(0), TRUE(!(0)));
6690 ctk_frame_set_shadow_type (CTK_FRAME (frame11)((((CtkFrame*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((frame11)), ((ctk_frame_get_type ()))))))
, CTK_SHADOW_IN);
6691
6692 button16 = ctk_button_new_with_label ("button16");
6693 ctk_container_add (CTK_CONTAINER (frame11)((((CtkContainer*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((frame11)), ((ctk_container_get_type ()))))))
, button16);
6694
6695 frame12 = ctk_frame_new (NULL((void*)0));
6696 ctk_paned_pack2 (CTK_PANED (hpaned5)((((CtkPaned*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((hpaned5)), ((ctk_paned_get_type ()))))))
, frame12, TRUE(!(0)), TRUE(!(0)));
6697 ctk_frame_set_shadow_type (CTK_FRAME (frame12)((((CtkFrame*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((frame12)), ((ctk_frame_get_type ()))))))
, CTK_SHADOW_IN);
6698
6699 button17 = ctk_button_new_with_label ("button17");
6700 ctk_container_add (CTK_CONTAINER (frame12)((((CtkContainer*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((frame12)), ((ctk_container_get_type ()))))))
, button17);
6701
6702 return window3;
6703}
6704
6705static CtkWidget*
6706paned_keyboard_window4 (CtkWidget *widget)
6707{
6708 CtkWidget *window4;
6709 CtkWidget *vbox3;
6710 CtkWidget *label2;
6711 CtkWidget *hpaned6;
6712 CtkWidget *vpaned3;
6713 CtkWidget *button19;
6714 CtkWidget *button18;
6715 CtkWidget *hbox3;
6716 CtkWidget *vpaned4;
6717 CtkWidget *button21;
6718 CtkWidget *button20;
6719 CtkWidget *vpaned5;
6720 CtkWidget *button23;
6721 CtkWidget *button22;
6722 CtkWidget *vpaned6;
6723 CtkWidget *button25;
6724 CtkWidget *button24;
6725
6726 window4 = ctk_window_new (CTK_WINDOW_TOPLEVEL);
6727 g_object_set_data (G_OBJECT (window4)((((GObject*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((window4)), (((GType) ((20) << (2))))))))
, "window4", window4);
6728 ctk_window_set_title (CTK_WINDOW (window4)((((CtkWindow*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((window4)), ((ctk_window_get_type ()))))))
, "window4");
6729
6730 ctk_window_set_screen (CTK_WINDOW (window4)((((CtkWindow*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((window4)), ((ctk_window_get_type ()))))))
,
6731 ctk_widget_get_screen (widget));
6732
6733 vbox3 = ctk_box_new (CTK_ORIENTATION_VERTICAL, 0);
6734 ctk_container_add (CTK_CONTAINER (window4)((((CtkContainer*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((window4)), ((ctk_container_get_type ()))))))
, vbox3);
6735
6736 label2 = ctk_label_new ("Widget tree:\n\nhpaned \n - vpaned\n - hbox\n - vpaned\n - vpaned\n - vpaned\n");
6737 ctk_box_pack_start (CTK_BOX (vbox3)((((CtkBox*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((vbox3)), ((ctk_box_get_type ()))))))
, label2, FALSE(0), FALSE(0), 0);
6738 ctk_label_set_justify (CTK_LABEL (label2)((((CtkLabel*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((label2)), ((ctk_label_get_type ()))))))
, CTK_JUSTIFY_LEFT);
6739
6740 hpaned6 = ctk_paned_new (CTK_ORIENTATION_HORIZONTAL);
6741 ctk_box_pack_start (CTK_BOX (vbox3)((((CtkBox*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((vbox3)), ((ctk_box_get_type ()))))))
, hpaned6, TRUE(!(0)), TRUE(!(0)), 0);
6742
6743 vpaned3 = ctk_paned_new (CTK_ORIENTATION_VERTICAL);
6744 ctk_paned_pack1 (CTK_PANED (hpaned6)((((CtkPaned*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((hpaned6)), ((ctk_paned_get_type ()))))))
, vpaned3, FALSE(0), TRUE(!(0)));
6745
6746 button19 = ctk_button_new_with_label ("button19");
6747 ctk_paned_pack1 (CTK_PANED (vpaned3)((((CtkPaned*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((vpaned3)), ((ctk_paned_get_type ()))))))
, button19, FALSE(0), TRUE(!(0)));
6748
6749 button18 = ctk_button_new_with_label ("button18");
6750 ctk_paned_pack2 (CTK_PANED (vpaned3)((((CtkPaned*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((vpaned3)), ((ctk_paned_get_type ()))))))
, button18, TRUE(!(0)), TRUE(!(0)));
6751
6752 hbox3 = ctk_box_new (CTK_ORIENTATION_HORIZONTAL, 0);
6753 ctk_paned_pack2 (CTK_PANED (hpaned6)((((CtkPaned*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((hpaned6)), ((ctk_paned_get_type ()))))))
, hbox3, TRUE(!(0)), TRUE(!(0)));
6754
6755 vpaned4 = ctk_paned_new (CTK_ORIENTATION_VERTICAL);
6756 ctk_box_pack_start (CTK_BOX (hbox3)((((CtkBox*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((hbox3)), ((ctk_box_get_type ()))))))
, vpaned4, TRUE(!(0)), TRUE(!(0)), 0);
6757
6758 button21 = ctk_button_new_with_label ("button21");
6759 ctk_paned_pack1 (CTK_PANED (vpaned4)((((CtkPaned*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((vpaned4)), ((ctk_paned_get_type ()))))))
, button21, FALSE(0), TRUE(!(0)));
6760
6761 button20 = ctk_button_new_with_label ("button20");
6762 ctk_paned_pack2 (CTK_PANED (vpaned4)((((CtkPaned*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((vpaned4)), ((ctk_paned_get_type ()))))))
, button20, TRUE(!(0)), TRUE(!(0)));
6763
6764 vpaned5 = ctk_paned_new (CTK_ORIENTATION_VERTICAL);
6765 ctk_box_pack_start (CTK_BOX (hbox3)((((CtkBox*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((hbox3)), ((ctk_box_get_type ()))))))
, vpaned5, TRUE(!(0)), TRUE(!(0)), 0);
6766
6767 button23 = ctk_button_new_with_label ("button23");
6768 ctk_paned_pack1 (CTK_PANED (vpaned5)((((CtkPaned*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((vpaned5)), ((ctk_paned_get_type ()))))))
, button23, FALSE(0), TRUE(!(0)));
6769
6770 button22 = ctk_button_new_with_label ("button22");
6771 ctk_paned_pack2 (CTK_PANED (vpaned5)((((CtkPaned*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((vpaned5)), ((ctk_paned_get_type ()))))))
, button22, TRUE(!(0)), TRUE(!(0)));
6772
6773 vpaned6 = ctk_paned_new (CTK_ORIENTATION_VERTICAL);
6774 ctk_box_pack_start (CTK_BOX (hbox3)((((CtkBox*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((hbox3)), ((ctk_box_get_type ()))))))
, vpaned6, TRUE(!(0)), TRUE(!(0)), 0);
6775
6776 button25 = ctk_button_new_with_label ("button25");
6777 ctk_paned_pack1 (CTK_PANED (vpaned6)((((CtkPaned*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((vpaned6)), ((ctk_paned_get_type ()))))))
, button25, FALSE(0), TRUE(!(0)));
6778
6779 button24 = ctk_button_new_with_label ("button24");
6780 ctk_paned_pack2 (CTK_PANED (vpaned6)((((CtkPaned*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((vpaned6)), ((ctk_paned_get_type ()))))))
, button24, TRUE(!(0)), TRUE(!(0)));
6781
6782 return window4;
6783}
6784
6785static void
6786create_paned_keyboard_navigation (CtkWidget *widget)
6787{
6788 static CtkWidget *window1 = NULL((void*)0);
6789 static CtkWidget *window2 = NULL((void*)0);
6790 static CtkWidget *window3 = NULL((void*)0);
6791 static CtkWidget *window4 = NULL((void*)0);
6792
6793 if (window1 &&
6794 (ctk_widget_get_screen (window1) != ctk_widget_get_screen (widget)))
6795 {
6796 ctk_widget_destroy (window1);
6797 ctk_widget_destroy (window2);
6798 ctk_widget_destroy (window3);
6799 ctk_widget_destroy (window4);
6800 }
6801
6802 if (!window1)
6803 {
6804 window1 = paned_keyboard_window1 (widget);
6805 g_signal_connect (window1, "destroy",g_signal_connect_data ((window1), ("destroy"), (((GCallback) (
ctk_widget_destroyed))), (&window1), ((void*)0), (GConnectFlags
) 0)
6806 G_CALLBACK (ctk_widget_destroyed),g_signal_connect_data ((window1), ("destroy"), (((GCallback) (
ctk_widget_destroyed))), (&window1), ((void*)0), (GConnectFlags
) 0)
6807 &window1)g_signal_connect_data ((window1), ("destroy"), (((GCallback) (
ctk_widget_destroyed))), (&window1), ((void*)0), (GConnectFlags
) 0)
;
6808 }
6809
6810 if (!window2)
6811 {
6812 window2 = paned_keyboard_window2 (widget);
6813 g_signal_connect (window2, "destroy",g_signal_connect_data ((window2), ("destroy"), (((GCallback) (
ctk_widget_destroyed))), (&window2), ((void*)0), (GConnectFlags
) 0)
6814 G_CALLBACK (ctk_widget_destroyed),g_signal_connect_data ((window2), ("destroy"), (((GCallback) (
ctk_widget_destroyed))), (&window2), ((void*)0), (GConnectFlags
) 0)
6815 &window2)g_signal_connect_data ((window2), ("destroy"), (((GCallback) (
ctk_widget_destroyed))), (&window2), ((void*)0), (GConnectFlags
) 0)
;
6816 }
6817
6818 if (!window3)
6819 {
6820 window3 = paned_keyboard_window3 (widget);
6821 g_signal_connect (window3, "destroy",g_signal_connect_data ((window3), ("destroy"), (((GCallback) (
ctk_widget_destroyed))), (&window3), ((void*)0), (GConnectFlags
) 0)
6822 G_CALLBACK (ctk_widget_destroyed),g_signal_connect_data ((window3), ("destroy"), (((GCallback) (
ctk_widget_destroyed))), (&window3), ((void*)0), (GConnectFlags
) 0)
6823 &window3)g_signal_connect_data ((window3), ("destroy"), (((GCallback) (
ctk_widget_destroyed))), (&window3), ((void*)0), (GConnectFlags
) 0)
;
6824 }
6825
6826 if (!window4)
6827 {
6828 window4 = paned_keyboard_window4 (widget);
6829 g_signal_connect (window4, "destroy",g_signal_connect_data ((window4), ("destroy"), (((GCallback) (
ctk_widget_destroyed))), (&window4), ((void*)0), (GConnectFlags
) 0)
6830 G_CALLBACK (ctk_widget_destroyed),g_signal_connect_data ((window4), ("destroy"), (((GCallback) (
ctk_widget_destroyed))), (&window4), ((void*)0), (GConnectFlags
) 0)
6831 &window4)g_signal_connect_data ((window4), ("destroy"), (((GCallback) (
ctk_widget_destroyed))), (&window4), ((void*)0), (GConnectFlags
) 0)
;
6832 }
6833
6834 if (ctk_widget_get_visible (window1))
6835 ctk_widget_destroy (CTK_WIDGET (window1)((((CtkWidget*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((window1)), ((ctk_widget_get_type ()))))))
);
6836 else
6837 ctk_widget_show_all (CTK_WIDGET (window1)((((CtkWidget*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((window1)), ((ctk_widget_get_type ()))))))
);
6838
6839 if (ctk_widget_get_visible (window2))
6840 ctk_widget_destroy (CTK_WIDGET (window2)((((CtkWidget*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((window2)), ((ctk_widget_get_type ()))))))
);
6841 else
6842 ctk_widget_show_all (CTK_WIDGET (window2)((((CtkWidget*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((window2)), ((ctk_widget_get_type ()))))))
);
6843
6844 if (ctk_widget_get_visible (window3))
6845 ctk_widget_destroy (CTK_WIDGET (window3)((((CtkWidget*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((window3)), ((ctk_widget_get_type ()))))))
);
6846 else
6847 ctk_widget_show_all (CTK_WIDGET (window3)((((CtkWidget*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((window3)), ((ctk_widget_get_type ()))))))
);
6848
6849 if (ctk_widget_get_visible (window4))
6850 ctk_widget_destroy (CTK_WIDGET (window4)((((CtkWidget*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((window4)), ((ctk_widget_get_type ()))))))
);
6851 else
6852 ctk_widget_show_all (CTK_WIDGET (window4)((((CtkWidget*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((window4)), ((ctk_widget_get_type ()))))))
);
6853}
6854
6855
6856/*
6857 * Shaped Windows
6858 */
6859
6860typedef struct _cursoroffset {gint x,y;} CursorOffset;
6861
6862static void
6863shape_pressed (CtkWidget *widget, CdkEventButton *event)
6864{
6865 CursorOffset *p;
6866
6867 /* ignore double and triple click */
6868 if (event->type != CDK_BUTTON_PRESS)
6869 return;
6870
6871 p = g_object_get_data (G_OBJECT (widget)((((GObject*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((widget)), (((GType) ((20) << (2))))))))
, "cursor_offset");
6872 p->x = (int) event->x;
6873 p->y = (int) event->y;
6874
6875 ctk_grab_add (widget);
6876 cdk_seat_grab (cdk_event_get_seat ((CdkEvent *) event),
6877 ctk_widget_get_window (widget),
6878 CDK_SEAT_CAPABILITY_ALL_POINTING,
6879 TRUE(!(0)), NULL((void*)0), (CdkEvent *) event, NULL((void*)0), NULL((void*)0));
6880}
6881
6882static void
6883shape_released (CtkWidget *widget,
6884 CdkEventButton *event)
6885{
6886 ctk_grab_remove (widget);
6887 cdk_seat_ungrab (cdk_event_get_seat ((CdkEvent *) event));
6888}
6889
6890static void
6891shape_motion (CtkWidget *widget,
6892 CdkEventMotion *event)
6893{
6894 gint xp, yp;
6895 CursorOffset * p;
6896
6897 p = g_object_get_data (G_OBJECT (widget)((((GObject*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((widget)), (((GType) ((20) << (2))))))))
, "cursor_offset");
6898
6899 /*
6900 * Can't use event->x / event->y here
6901 * because I need absolute coordinates.
6902 */
6903 cdk_window_get_device_position (cdk_screen_get_root_window (ctk_widget_get_screen (widget)),
6904 cdk_event_get_device ((CdkEvent *) event),
6905 &xp, &yp, NULL((void*)0));
6906 ctk_window_move (CTK_WINDOW (widget)((((CtkWindow*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((widget)), ((ctk_window_get_type ()))))))
, xp - p->x, yp - p->y);
6907}
6908
6909CtkWidget *
6910shape_create_icon (CdkScreen *screen,
6911 char *xpm_file,
6912 gint x,
6913 gint y,
6914 gint px,
6915 gint py,
6916 gint window_type)
6917{
6918 CtkWidget *window;
6919 CtkWidget *image;
6920 CtkWidget *fixed;
6921 CursorOffset* icon_pos;
6922 cairo_surface_t *mask;
6923 cairo_region_t *mask_region;
6924 GdkPixbuf *pixbuf;
6925 cairo_t *cr;
6926
6927 /*
6928 * CDK_WINDOW_TOPLEVEL works also, giving you a title border
6929 */
6930 window = ctk_window_new (window_type);
6931 ctk_window_set_screen (CTK_WINDOW (window)((((CtkWindow*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((window)), ((ctk_window_get_type ()))))))
, screen);
6932
6933 fixed = ctk_fixed_new ();
6934 ctk_widget_set_size_request (fixed, 100, 100);
6935 ctk_container_add (CTK_CONTAINER (window)((((CtkContainer*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((window)), ((ctk_container_get_type ()))))))
, fixed);
6936 ctk_widget_show (fixed);
6937
6938 ctk_widget_set_events (window,
6939 ctk_widget_get_events (window) |
6940 CDK_BUTTON_MOTION_MASK |
6941 CDK_BUTTON_PRESS_MASK);
6942
6943 ctk_widget_realize (window);
6944
6945 pixbuf = gdk_pixbuf_new_from_file (xpm_file, NULL((void*)0));
6946 g_assert (pixbuf)do { if (pixbuf) ; else g_assertion_message_expr (((gchar*) 0
), "testctk.c", 6946, ((const char*) (__func__)), "pixbuf"); }
while (0)
; /* FIXME: error handling */
6947
6948 mask = cairo_image_surface_create (CAIRO_FORMAT_A1,
6949 gdk_pixbuf_get_width (pixbuf),
6950 gdk_pixbuf_get_height (pixbuf));
6951 cr = cairo_create (mask);
6952 cdk_cairo_set_source_pixbuf (cr, pixbuf, 0, 0);
6953 cairo_paint (cr);
6954 cairo_destroy (cr);
6955
6956 mask_region = cdk_cairo_region_create_from_surface (mask);
6957
6958 cairo_region_translate (mask_region, px, py);
6959
6960 image = ctk_image_new_from_pixbuf (pixbuf);
6961 ctk_fixed_put (CTK_FIXED (fixed)((((CtkFixed*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((fixed)), ((ctk_fixed_get_type ()))))))
, image, px,py);
6962 ctk_widget_show (image);
6963
6964 ctk_widget_shape_combine_region (window, mask_region);
6965
6966 cairo_region_destroy (mask_region);
6967 cairo_surface_destroy (mask);
6968 g_object_unref (pixbuf);
6969
6970 g_signal_connect (window, "button_press_event",g_signal_connect_data ((window), ("button_press_event"), (((GCallback
) (shape_pressed))), (((void*)0)), ((void*)0), (GConnectFlags
) 0)
6971 G_CALLBACK (shape_pressed), NULL)g_signal_connect_data ((window), ("button_press_event"), (((GCallback
) (shape_pressed))), (((void*)0)), ((void*)0), (GConnectFlags
) 0)
;
6972 g_signal_connect (window, "button_release_event",g_signal_connect_data ((window), ("button_release_event"), ((
(GCallback) (shape_released))), (((void*)0)), ((void*)0), (GConnectFlags
) 0)
6973 G_CALLBACK (shape_released), NULL)g_signal_connect_data ((window), ("button_release_event"), ((
(GCallback) (shape_released))), (((void*)0)), ((void*)0), (GConnectFlags
) 0)
;
6974 g_signal_connect (window, "motion_notify_event",g_signal_connect_data ((window), ("motion_notify_event"), (((
GCallback) (shape_motion))), (((void*)0)), ((void*)0), (GConnectFlags
) 0)
6975 G_CALLBACK (shape_motion), NULL)g_signal_connect_data ((window), ("motion_notify_event"), (((
GCallback) (shape_motion))), (((void*)0)), ((void*)0), (GConnectFlags
) 0)
;
6976
6977 icon_pos = g_new (CursorOffset, 1)((CursorOffset *) g_malloc_n ((1), sizeof (CursorOffset)));
6978 g_object_set_data (G_OBJECT (window)((((GObject*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((window)), (((GType) ((20) << (2))))))))
, "cursor_offset", icon_pos);
6979
6980 ctk_window_move (CTK_WINDOW (window)((((CtkWindow*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((window)), ((ctk_window_get_type ()))))))
, x, y);
6981 ctk_widget_show (window);
6982
6983 return window;
6984}
6985
6986void
6987create_shapes (CtkWidget *widget)
6988{
6989 /* Variables used by the Drag/Drop and Shape Window demos */
6990 static CtkWidget *modeller = NULL((void*)0);
6991 static CtkWidget *sheets = NULL((void*)0);
6992 static CtkWidget *rings = NULL((void*)0);
6993 static CtkWidget *with_region = NULL((void*)0);
6994 CdkScreen *screen = ctk_widget_get_screen (widget);
6995
6996 if (!(file_exists ("Modeller.xpm") &&
6997 file_exists ("FilesQueue.xpm") &&
6998 file_exists ("3DRings.xpm")))
6999 return;
7000
7001
7002 if (!modeller)
7003 {
7004 modeller = shape_create_icon (screen, "Modeller.xpm",
7005 440, 140, 0,0, CTK_WINDOW_POPUP);
7006
7007 g_signal_connect (modeller, "destroy",g_signal_connect_data ((modeller), ("destroy"), (((GCallback)
(ctk_widget_destroyed))), (&modeller), ((void*)0), (GConnectFlags
) 0)
7008 G_CALLBACK (ctk_widget_destroyed),g_signal_connect_data ((modeller), ("destroy"), (((GCallback)
(ctk_widget_destroyed))), (&modeller), ((void*)0), (GConnectFlags
) 0)
7009 &modeller)g_signal_connect_data ((modeller), ("destroy"), (((GCallback)
(ctk_widget_destroyed))), (&modeller), ((void*)0), (GConnectFlags
) 0)
;
7010 }
7011 else
7012 ctk_widget_destroy (modeller);
7013
7014 if (!sheets)
7015 {
7016 sheets = shape_create_icon (screen, "FilesQueue.xpm",
7017 580, 170, 0,0, CTK_WINDOW_POPUP);
7018
7019 g_signal_connect (sheets, "destroy",g_signal_connect_data ((sheets), ("destroy"), (((GCallback) (
ctk_widget_destroyed))), (&sheets), ((void*)0), (GConnectFlags
) 0)
7020 G_CALLBACK (ctk_widget_destroyed),g_signal_connect_data ((sheets), ("destroy"), (((GCallback) (
ctk_widget_destroyed))), (&sheets), ((void*)0), (GConnectFlags
) 0)
7021 &sheets)g_signal_connect_data ((sheets), ("destroy"), (((GCallback) (
ctk_widget_destroyed))), (&sheets), ((void*)0), (GConnectFlags
) 0)
;
7022
7023 }
7024 else
7025 ctk_widget_destroy (sheets);
7026
7027 if (!rings)
7028 {
7029 rings = shape_create_icon (screen, "3DRings.xpm",
7030 460, 270, 25,25, CTK_WINDOW_TOPLEVEL);
7031
7032 g_signal_connect (rings, "destroy",g_signal_connect_data ((rings), ("destroy"), (((GCallback) (ctk_widget_destroyed
))), (&rings), ((void*)0), (GConnectFlags) 0)
7033 G_CALLBACK (ctk_widget_destroyed),g_signal_connect_data ((rings), ("destroy"), (((GCallback) (ctk_widget_destroyed
))), (&rings), ((void*)0), (GConnectFlags) 0)
7034 &rings)g_signal_connect_data ((rings), ("destroy"), (((GCallback) (ctk_widget_destroyed
))), (&rings), ((void*)0), (GConnectFlags) 0)
;
7035 }
7036 else
7037 ctk_widget_destroy (rings);
7038
7039 if (!with_region)
7040 {
7041 cairo_region_t *region;
7042 gint x, y;
7043
7044 with_region = shape_create_icon (screen, "3DRings.xpm",
7045 460, 270, 25,25, CTK_WINDOW_TOPLEVEL);
7046
7047 ctk_window_set_decorated (CTK_WINDOW (with_region)((((CtkWindow*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((with_region)), ((ctk_window_get_type ()))))))
, FALSE(0));
7048
7049 g_signal_connect (with_region, "destroy",g_signal_connect_data ((with_region), ("destroy"), (((GCallback
) (ctk_widget_destroyed))), (&with_region), ((void*)0), (
GConnectFlags) 0)
7050 G_CALLBACK (ctk_widget_destroyed),g_signal_connect_data ((with_region), ("destroy"), (((GCallback
) (ctk_widget_destroyed))), (&with_region), ((void*)0), (
GConnectFlags) 0)
7051 &with_region)g_signal_connect_data ((with_region), ("destroy"), (((GCallback
) (ctk_widget_destroyed))), (&with_region), ((void*)0), (
GConnectFlags) 0)
;
7052
7053 /* reset shape from mask to a region */
7054 x = 0;
7055 y = 0;
7056 region = cairo_region_create ();
7057
7058 while (x < 460)
7059 {
7060 while (y < 270)
7061 {
7062 CdkRectangle rect;
7063 rect.x = x;
7064 rect.y = y;
7065 rect.width = 10;
7066 rect.height = 10;
7067
7068 cairo_region_union_rectangle (region, &rect);
7069
7070 y += 20;
7071 }
7072 y = 0;
7073 x += 20;
7074 }
7075
7076 cdk_window_shape_combine_region (ctk_widget_get_window (with_region),
7077 region,
7078 0, 0);
7079 }
7080 else
7081 ctk_widget_destroy (with_region);
7082}
7083
7084/*
7085 * WM Hints demo
7086 */
7087
7088void
7089create_wmhints (CtkWidget *widget)
7090{
7091 static CtkWidget *window = NULL((void*)0);
7092
7093 if (!window)
7094 {
7095 CtkWidget *label;
7096 CtkWidget *separator;
7097 CtkWidget *button;
7098 CtkWidget *box1;
7099 CtkWidget *box2;
7100 CdkWindow *cdk_window;
7101 GdkPixbuf *pixbuf;
7102 GList *list;
7103
7104 window = ctk_window_new (CTK_WINDOW_TOPLEVEL);
7105
7106 ctk_window_set_screen (CTK_WINDOW (window)((((CtkWindow*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((window)), ((ctk_window_get_type ()))))))
,
7107 ctk_widget_get_screen (widget));
7108
7109 g_signal_connect (window, "destroy",g_signal_connect_data ((window), ("destroy"), (((GCallback) (
ctk_widget_destroyed))), (&window), ((void*)0), (GConnectFlags
) 0)
7110 G_CALLBACK (ctk_widget_destroyed),g_signal_connect_data ((window), ("destroy"), (((GCallback) (
ctk_widget_destroyed))), (&window), ((void*)0), (GConnectFlags
) 0)
7111 &window)g_signal_connect_data ((window), ("destroy"), (((GCallback) (
ctk_widget_destroyed))), (&window), ((void*)0), (GConnectFlags
) 0)
;
7112
7113 ctk_window_set_title (CTK_WINDOW (window)((((CtkWindow*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((window)), ((ctk_window_get_type ()))))))
, "WM Hints");
7114 ctk_container_set_border_width (CTK_CONTAINER (window)((((CtkContainer*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((window)), ((ctk_container_get_type ()))))))
, 0);
7115
7116 ctk_widget_realize (window);
7117
7118 cdk_window = ctk_widget_get_window (window);
7119
7120 pixbuf = gdk_pixbuf_new_from_xpm_data ((const char **) openfile);
7121 list = g_list_prepend (NULL((void*)0), pixbuf);
7122
7123 cdk_window_set_icon_list (cdk_window, list);
7124
7125 g_list_free (list);
7126 g_object_unref (pixbuf);
7127
7128 cdk_window_set_icon_name (cdk_window, "WMHints Test Icon");
7129
7130 cdk_window_set_decorations (cdk_window, CDK_DECOR_ALL | CDK_DECOR_MENU);
7131 cdk_window_set_functions (cdk_window, CDK_FUNC_ALL | CDK_FUNC_RESIZE);
7132
7133 box1 = ctk_box_new (CTK_ORIENTATION_VERTICAL, 0);
7134 ctk_container_add (CTK_CONTAINER (window)((((CtkContainer*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((window)), ((ctk_container_get_type ()))))))
, box1);
7135 ctk_widget_show (box1);
7136
7137 label = ctk_label_new ("Try iconizing me!");
7138 ctk_widget_set_size_request (label, 150, 50);
7139 ctk_box_pack_start (CTK_BOX (box1)((((CtkBox*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((box1)), ((ctk_box_get_type ()))))))
, label, TRUE(!(0)), TRUE(!(0)), 0);
7140 ctk_widget_show (label);
7141
7142
7143 separator = ctk_separator_new (CTK_ORIENTATION_HORIZONTAL);
7144 ctk_box_pack_start (CTK_BOX (box1)((((CtkBox*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((box1)), ((ctk_box_get_type ()))))))
, separator, FALSE(0), TRUE(!(0)), 0);
7145 ctk_widget_show (separator);
7146
7147
7148 box2 = ctk_box_new (CTK_ORIENTATION_VERTICAL, 10);
7149 ctk_container_set_border_width (CTK_CONTAINER (box2)((((CtkContainer*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((box2)), ((ctk_container_get_type ()))))))
, 10);
7150 ctk_box_pack_start (CTK_BOX (box1)((((CtkBox*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((box1)), ((ctk_box_get_type ()))))))
, box2, FALSE(0), TRUE(!(0)), 0);
7151 ctk_widget_show (box2);
7152
7153
7154 button = ctk_button_new_with_label ("close");
7155
7156 g_signal_connect_swapped (button, "clicked",g_signal_connect_data ((button), ("clicked"), (((GCallback) (
ctk_widget_destroy))), (window), ((void*)0), G_CONNECT_SWAPPED
)
7157 G_CALLBACK (ctk_widget_destroy),g_signal_connect_data ((button), ("clicked"), (((GCallback) (
ctk_widget_destroy))), (window), ((void*)0), G_CONNECT_SWAPPED
)
7158 window)g_signal_connect_data ((button), ("clicked"), (((GCallback) (
ctk_widget_destroy))), (window), ((void*)0), G_CONNECT_SWAPPED
)
;
7159
7160 ctk_box_pack_start (CTK_BOX (box2)((((CtkBox*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((box2)), ((ctk_box_get_type ()))))))
, button, TRUE(!(0)), TRUE(!(0)), 0);
7161 ctk_widget_set_can_default (button, TRUE(!(0)));
7162 ctk_widget_grab_default (button);
7163 ctk_widget_show (button);
7164 }
7165
7166 if (!ctk_widget_get_visible (window))
7167 ctk_widget_show (window);
7168 else
7169 ctk_widget_destroy (window);
7170}
7171
7172
7173/*
7174 * Window state tracking
7175 */
7176
7177static gint
7178window_state_callback (CtkWidget *widget,
7179 CdkEventWindowState *event,
7180 gpointer data)
7181{
7182 CtkWidget *label = data;
7183 gchar *msg;
7184
7185 msg = g_strconcat (ctk_window_get_title (CTK_WINDOW (widget)((((CtkWindow*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((widget)), ((ctk_window_get_type ()))))))
), ": ",
7186 (event->new_window_state & CDK_WINDOW_STATE_WITHDRAWN) ?
7187 "withdrawn" : "not withdrawn", ", ",
7188 (event->new_window_state & CDK_WINDOW_STATE_ICONIFIED) ?
7189 "iconified" : "not iconified", ", ",
7190 (event->new_window_state & CDK_WINDOW_STATE_STICKY) ?
7191 "sticky" : "not sticky", ", ",
7192 (event->new_window_state & CDK_WINDOW_STATE_MAXIMIZED) ?
7193 "maximized" : "not maximized", ", ",
7194 (event->new_window_state & CDK_WINDOW_STATE_FULLSCREEN) ?
7195 "fullscreen" : "not fullscreen",
7196 (event->new_window_state & CDK_WINDOW_STATE_ABOVE) ?
7197 "above" : "not above", ", ",
7198 (event->new_window_state & CDK_WINDOW_STATE_BELOW) ?
7199 "below" : "not below", ", ",
7200 NULL((void*)0));
7201
7202 ctk_label_set_text (CTK_LABEL (label)((((CtkLabel*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((label)), ((ctk_label_get_type ()))))))
, msg);
7203
7204 g_free (msg);
7205
7206 return FALSE(0);
7207}
7208
7209static CtkWidget*
7210tracking_label (CtkWidget *window)
7211{
7212 CtkWidget *label;
7213 CtkWidget *hbox;
7214 CtkWidget *button;
7215
7216 hbox = ctk_box_new (CTK_ORIENTATION_HORIZONTAL, 5);
7217
7218 g_signal_connect_object (hbox,
7219 "destroy",
7220 G_CALLBACK (ctk_widget_destroy)((GCallback) (ctk_widget_destroy)),
7221 window,
7222 G_CONNECT_SWAPPED);
7223
7224 label = ctk_label_new ("<no window state events received>");
7225 ctk_label_set_line_wrap (CTK_LABEL (label)((((CtkLabel*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((label)), ((ctk_label_get_type ()))))))
, TRUE(!(0)));
7226 ctk_box_pack_start (CTK_BOX (hbox)((((CtkBox*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((hbox)), ((ctk_box_get_type ()))))))
, label, FALSE(0), FALSE(0), 0);
7227
7228 g_signal_connect (window,g_signal_connect_data ((window), ("window_state_event"), (((GCallback
) (window_state_callback))), (label), ((void*)0), (GConnectFlags
) 0)
7229 "window_state_event",g_signal_connect_data ((window), ("window_state_event"), (((GCallback
) (window_state_callback))), (label), ((void*)0), (GConnectFlags
) 0)
7230 G_CALLBACK (window_state_callback),g_signal_connect_data ((window), ("window_state_event"), (((GCallback
) (window_state_callback))), (label), ((void*)0), (GConnectFlags
) 0)
7231 label)g_signal_connect_data ((window), ("window_state_event"), (((GCallback
) (window_state_callback))), (label), ((void*)0), (GConnectFlags
) 0)
;
7232
7233 button = ctk_button_new_with_label ("Deiconify");
7234 g_signal_connect_object (button,
7235 "clicked",
7236 G_CALLBACK (ctk_window_deiconify)((GCallback) (ctk_window_deiconify)),
7237 window,
7238 G_CONNECT_SWAPPED);
7239 ctk_box_pack_end (CTK_BOX (hbox)((((CtkBox*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((hbox)), ((ctk_box_get_type ()))))))
, button, FALSE(0), FALSE(0), 0);
7240
7241 button = ctk_button_new_with_label ("Iconify");
7242 g_signal_connect_object (button,
7243 "clicked",
7244 G_CALLBACK (ctk_window_iconify)((GCallback) (ctk_window_iconify)),
7245 window,
7246 G_CONNECT_SWAPPED);
7247 ctk_box_pack_end (CTK_BOX (hbox)((((CtkBox*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((hbox)), ((ctk_box_get_type ()))))))
, button, FALSE(0), FALSE(0), 0);
7248
7249 button = ctk_button_new_with_label ("Fullscreen");
7250 g_signal_connect_object (button,
7251 "clicked",
7252 G_CALLBACK (ctk_window_fullscreen)((GCallback) (ctk_window_fullscreen)),
7253 window,
7254 G_CONNECT_SWAPPED);
7255 ctk_box_pack_end (CTK_BOX (hbox)((((CtkBox*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((hbox)), ((ctk_box_get_type ()))))))
, button, FALSE(0), FALSE(0), 0);
7256
7257 button = ctk_button_new_with_label ("Unfullscreen");
7258 g_signal_connect_object (button,
7259 "clicked",
7260 G_CALLBACK (ctk_window_unfullscreen)((GCallback) (ctk_window_unfullscreen)),
7261 window,
7262 G_CONNECT_SWAPPED);
7263 ctk_box_pack_end (CTK_BOX (hbox)((((CtkBox*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((hbox)), ((ctk_box_get_type ()))))))
, button, FALSE(0), FALSE(0), 0);
7264
7265 button = ctk_button_new_with_label ("Present");
7266 g_signal_connect_object (button,
7267 "clicked",
7268 G_CALLBACK (ctk_window_present)((GCallback) (ctk_window_present)),
7269 window,
7270 G_CONNECT_SWAPPED);
7271 ctk_box_pack_end (CTK_BOX (hbox)((((CtkBox*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((hbox)), ((ctk_box_get_type ()))))))
, button, FALSE(0), FALSE(0), 0);
7272
7273 button = ctk_button_new_with_label ("Show");
7274 g_signal_connect_object (button,
7275 "clicked",
7276 G_CALLBACK (ctk_widget_show)((GCallback) (ctk_widget_show)),
7277 window,
7278 G_CONNECT_SWAPPED);
7279 ctk_box_pack_end (CTK_BOX (hbox)((((CtkBox*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((hbox)), ((ctk_box_get_type ()))))))
, button, FALSE(0), FALSE(0), 0);
7280
7281 ctk_widget_show_all (hbox);
7282
7283 return hbox;
7284}
7285
7286void
7287keep_window_above (CtkToggleButton *togglebutton, gpointer data)
7288{
7289 CtkWidget *button = g_object_get_data (G_OBJECT (togglebutton)((((GObject*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((togglebutton)), (((GType) ((20) << (2))))))))
, "radio");
7290
7291 ctk_window_set_keep_above (CTK_WINDOW (data)((((CtkWindow*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((data)), ((ctk_window_get_type ()))))))
,
7292 ctk_toggle_button_get_active (togglebutton));
7293
7294 if (ctk_toggle_button_get_active (togglebutton))
7295 ctk_toggle_button_set_active (CTK_TOGGLE_BUTTON (button)((((CtkToggleButton*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((button)), ((ctk_toggle_button_get_type ()))))))
, FALSE(0));
7296}
7297
7298void
7299keep_window_below (CtkToggleButton *togglebutton, gpointer data)
7300{
7301 CtkWidget *button = g_object_get_data (G_OBJECT (togglebutton)((((GObject*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((togglebutton)), (((GType) ((20) << (2))))))))
, "radio");
7302
7303 ctk_window_set_keep_below (CTK_WINDOW (data)((((CtkWindow*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((data)), ((ctk_window_get_type ()))))))
,
7304 ctk_toggle_button_get_active (togglebutton));
7305
7306 if (ctk_toggle_button_get_active (togglebutton))
7307 ctk_toggle_button_set_active (CTK_TOGGLE_BUTTON (button)((((CtkToggleButton*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((button)), ((ctk_toggle_button_get_type ()))))))
, FALSE(0));
7308}
7309
7310
7311static CtkWidget*
7312get_state_controls (CtkWidget *window)
7313{
7314 CtkWidget *vbox;
7315 CtkWidget *button;
7316 CtkWidget *button_above;
7317 CtkWidget *button_below;
7318
7319 vbox = ctk_box_new (CTK_ORIENTATION_VERTICAL, 0);
7320
7321 button = ctk_button_new_with_label ("Stick");
7322 g_signal_connect_object (button,
7323 "clicked",
7324 G_CALLBACK (ctk_window_stick)((GCallback) (ctk_window_stick)),
7325 window,
7326 G_CONNECT_SWAPPED);
7327 ctk_box_pack_start (CTK_BOX (vbox)((((CtkBox*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((vbox)), ((ctk_box_get_type ()))))))
, button, FALSE(0), FALSE(0), 0);
7328
7329 button = ctk_button_new_with_label ("Unstick");
7330 g_signal_connect_object (button,
7331 "clicked",
7332 G_CALLBACK (ctk_window_unstick)((GCallback) (ctk_window_unstick)),
7333 window,
7334 G_CONNECT_SWAPPED);
7335 ctk_box_pack_start (CTK_BOX (vbox)((((CtkBox*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((vbox)), ((ctk_box_get_type ()))))))
, button, FALSE(0), FALSE(0), 0);
7336
7337 button = ctk_button_new_with_label ("Maximize");
7338 g_signal_connect_object (button,
7339 "clicked",
7340 G_CALLBACK (ctk_window_maximize)((GCallback) (ctk_window_maximize)),
7341 window,
7342 G_CONNECT_SWAPPED);
7343 ctk_box_pack_start (CTK_BOX (vbox)((((CtkBox*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((vbox)), ((ctk_box_get_type ()))))))
, button, FALSE(0), FALSE(0), 0);
7344
7345 button = ctk_button_new_with_label ("Unmaximize");
7346 g_signal_connect_object (button,
7347 "clicked",
7348 G_CALLBACK (ctk_window_unmaximize)((GCallback) (ctk_window_unmaximize)),
7349 window,
7350 G_CONNECT_SWAPPED);
7351 ctk_box_pack_start (CTK_BOX (vbox)((((CtkBox*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((vbox)), ((ctk_box_get_type ()))))))
, button, FALSE(0), FALSE(0), 0);
7352
7353 button = ctk_button_new_with_label ("Iconify");
7354 g_signal_connect_object (button,
7355 "clicked",
7356 G_CALLBACK (ctk_window_iconify)((GCallback) (ctk_window_iconify)),
7357 window,
7358 G_CONNECT_SWAPPED);
7359 ctk_box_pack_start (CTK_BOX (vbox)((((CtkBox*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((vbox)), ((ctk_box_get_type ()))))))
, button, FALSE(0), FALSE(0), 0);
7360
7361 button = ctk_button_new_with_label ("Fullscreen");
7362 g_signal_connect_object (button,
7363 "clicked",
7364 G_CALLBACK (ctk_window_fullscreen)((GCallback) (ctk_window_fullscreen)),
7365 window,
7366 G_CONNECT_SWAPPED);
7367 ctk_box_pack_start (CTK_BOX (vbox)((((CtkBox*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((vbox)), ((ctk_box_get_type ()))))))
, button, FALSE(0), FALSE(0), 0);
7368
7369 button = ctk_button_new_with_label ("Unfullscreen");
7370 g_signal_connect_object (button,
7371 "clicked",
7372 G_CALLBACK (ctk_window_unfullscreen)((GCallback) (ctk_window_unfullscreen)),
7373 window,
7374 G_CONNECT_SWAPPED);
7375 ctk_box_pack_start (CTK_BOX (vbox)((((CtkBox*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((vbox)), ((ctk_box_get_type ()))))))
, button, FALSE(0), FALSE(0), 0);
7376
7377 button_above = ctk_toggle_button_new_with_label ("Keep above");
7378 g_signal_connect (button_above,g_signal_connect_data ((button_above), ("toggled"), (((GCallback
) (keep_window_above))), (window), ((void*)0), (GConnectFlags
) 0)
7379 "toggled",g_signal_connect_data ((button_above), ("toggled"), (((GCallback
) (keep_window_above))), (window), ((void*)0), (GConnectFlags
) 0)
7380 G_CALLBACK (keep_window_above),g_signal_connect_data ((button_above), ("toggled"), (((GCallback
) (keep_window_above))), (window), ((void*)0), (GConnectFlags
) 0)
7381 window)g_signal_connect_data ((button_above), ("toggled"), (((GCallback
) (keep_window_above))), (window), ((void*)0), (GConnectFlags
) 0)
;
7382 ctk_box_pack_start (CTK_BOX (vbox)((((CtkBox*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((vbox)), ((ctk_box_get_type ()))))))
, button_above, FALSE(0), FALSE(0), 0);
7383
7384 button_below = ctk_toggle_button_new_with_label ("Keep below");
7385 g_signal_connect (button_below,g_signal_connect_data ((button_below), ("toggled"), (((GCallback
) (keep_window_below))), (window), ((void*)0), (GConnectFlags
) 0)
7386 "toggled",g_signal_connect_data ((button_below), ("toggled"), (((GCallback
) (keep_window_below))), (window), ((void*)0), (GConnectFlags
) 0)
7387 G_CALLBACK (keep_window_below),g_signal_connect_data ((button_below), ("toggled"), (((GCallback
) (keep_window_below))), (window), ((void*)0), (GConnectFlags
) 0)
7388 window)g_signal_connect_data ((button_below), ("toggled"), (((GCallback
) (keep_window_below))), (window), ((void*)0), (GConnectFlags
) 0)
;
7389 ctk_box_pack_start (CTK_BOX (vbox)((((CtkBox*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((vbox)), ((ctk_box_get_type ()))))))
, button_below, FALSE(0), FALSE(0), 0);
7390
7391 g_object_set_data (G_OBJECT (button_above)((((GObject*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((button_above)), (((GType) ((20) << (2))))))))
, "radio", button_below);
7392 g_object_set_data (G_OBJECT (button_below)((((GObject*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((button_below)), (((GType) ((20) << (2))))))))
, "radio", button_above);
7393
7394 button = ctk_button_new_with_label ("Hide (withdraw)");
7395 g_signal_connect_object (button,
7396 "clicked",
7397 G_CALLBACK (ctk_widget_hide)((GCallback) (ctk_widget_hide)),
7398 window,
7399 G_CONNECT_SWAPPED);
7400 ctk_box_pack_start (CTK_BOX (vbox)((((CtkBox*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((vbox)), ((ctk_box_get_type ()))))))
, button, FALSE(0), FALSE(0), 0);
7401
7402 ctk_widget_show_all (vbox);
7403
7404 return vbox;
7405}
7406
7407void
7408create_window_states (CtkWidget *widget)
7409{
7410 static CtkWidget *window = NULL((void*)0);
7411
7412 if (!window)
7413 {
7414 CtkWidget *label;
7415 CtkWidget *box1;
7416 CtkWidget *iconified;
7417 CtkWidget *normal;
7418 CtkWidget *controls;
7419
7420 window = ctk_window_new (CTK_WINDOW_TOPLEVEL);
7421 ctk_window_set_screen (CTK_WINDOW (window)((((CtkWindow*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((window)), ((ctk_window_get_type ()))))))
,
7422 ctk_widget_get_screen (widget));
7423
7424 g_signal_connect (window, "destroy",g_signal_connect_data ((window), ("destroy"), (((GCallback) (
ctk_widget_destroyed))), (&window), ((void*)0), (GConnectFlags
) 0)
7425 G_CALLBACK (ctk_widget_destroyed),g_signal_connect_data ((window), ("destroy"), (((GCallback) (
ctk_widget_destroyed))), (&window), ((void*)0), (GConnectFlags
) 0)
7426 &window)g_signal_connect_data ((window), ("destroy"), (((GCallback) (
ctk_widget_destroyed))), (&window), ((void*)0), (GConnectFlags
) 0)
;
7427
7428 ctk_window_set_title (CTK_WINDOW (window)((((CtkWindow*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((window)), ((ctk_window_get_type ()))))))
, "Window states");
7429
7430 box1 = ctk_box_new (CTK_ORIENTATION_VERTICAL, 0);
7431 ctk_container_add (CTK_CONTAINER (window)((((CtkContainer*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((window)), ((ctk_container_get_type ()))))))
, box1);
7432
7433 iconified = ctk_window_new (CTK_WINDOW_TOPLEVEL);
7434
7435 ctk_window_set_screen (CTK_WINDOW (iconified)((((CtkWindow*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((iconified)), ((ctk_window_get_type ()))))))
,
7436 ctk_widget_get_screen (widget));
7437
7438 g_signal_connect_object (iconified, "destroy",
7439 G_CALLBACK (ctk_widget_destroy)((GCallback) (ctk_widget_destroy)),
7440 window,
7441 G_CONNECT_SWAPPED);
7442 ctk_window_iconify (CTK_WINDOW (iconified)((((CtkWindow*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((iconified)), ((ctk_window_get_type ()))))))
);
7443 ctk_window_set_title (CTK_WINDOW (iconified)((((CtkWindow*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((iconified)), ((ctk_window_get_type ()))))))
, "Iconified initially");
7444 controls = get_state_controls (iconified);
7445 ctk_container_add (CTK_CONTAINER (iconified)((((CtkContainer*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((iconified)), ((ctk_container_get_type ()))))))
, controls);
7446
7447 normal = ctk_window_new (CTK_WINDOW_TOPLEVEL);
7448
7449 ctk_window_set_screen (CTK_WINDOW (normal)((((CtkWindow*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((normal)), ((ctk_window_get_type ()))))))
,
7450 ctk_widget_get_screen (widget));
7451
7452 g_signal_connect_object (normal, "destroy",
7453 G_CALLBACK (ctk_widget_destroy)((GCallback) (ctk_widget_destroy)),
7454 window,
7455 G_CONNECT_SWAPPED);
7456
7457 ctk_window_set_title (CTK_WINDOW (normal)((((CtkWindow*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((normal)), ((ctk_window_get_type ()))))))
, "Deiconified initially");
7458 controls = get_state_controls (normal);
7459 ctk_container_add (CTK_CONTAINER (normal)((((CtkContainer*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((normal)), ((ctk_container_get_type ()))))))
, controls);
7460
7461 label = tracking_label (iconified);
7462 ctk_container_add (CTK_CONTAINER (box1)((((CtkContainer*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((box1)), ((ctk_container_get_type ()))))))
, label);
7463
7464 label = tracking_label (normal);
7465 ctk_container_add (CTK_CONTAINER (box1)((((CtkContainer*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((box1)), ((ctk_container_get_type ()))))))
, label);
7466
7467 ctk_widget_show_all (iconified);
7468 ctk_widget_show_all (normal);
7469 ctk_widget_show_all (box1);
7470 }
7471
7472 if (!ctk_widget_get_visible (window))
7473 ctk_widget_show (window);
7474 else
7475 ctk_widget_destroy (window);
7476}
7477
7478/*
7479 * Window sizing
7480 */
7481
7482static gint
7483configure_event_callback (CtkWidget *widget,
7484 CdkEventConfigure *event,
7485 gpointer data)
7486{
7487 CtkWidget *label = data;
7488 gchar *msg;
7489 gint x, y;
7490
7491 ctk_window_get_position (CTK_WINDOW (widget)((((CtkWindow*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((widget)), ((ctk_window_get_type ()))))))
, &x, &y);
7492
7493 msg = g_strdup_printf ("event: %d,%d %d x %d\n"
7494 "position: %d, %d",
7495 event->x, event->y, event->width, event->height,
7496 x, y);
7497
7498 ctk_label_set_text (CTK_LABEL (label)((((CtkLabel*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((label)), ((ctk_label_get_type ()))))))
, msg);
7499
7500 g_free (msg);
7501
7502 return FALSE(0);
7503}
7504
7505static void
7506get_ints (CtkWidget *window,
7507 gint *a,
7508 gint *b)
7509{
7510 CtkWidget *spin1;
7511 CtkWidget *spin2;
7512
7513 spin1 = g_object_get_data (G_OBJECT (window)((((GObject*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((window)), (((GType) ((20) << (2))))))))
, "spin1");
7514 spin2 = g_object_get_data (G_OBJECT (window)((((GObject*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((window)), (((GType) ((20) << (2))))))))
, "spin2");
7515
7516 *a = ctk_spin_button_get_value_as_int (CTK_SPIN_BUTTON (spin1)((((CtkSpinButton*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((spin1)), ((ctk_spin_button_get_type ()))))))
);
7517 *b = ctk_spin_button_get_value_as_int (CTK_SPIN_BUTTON (spin2)((((CtkSpinButton*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((spin2)), ((ctk_spin_button_get_type ()))))))
);
7518}
7519
7520static void
7521set_size_callback (CtkWidget *widget G_GNUC_UNUSED__attribute__ ((__unused__)),
7522 gpointer data)
7523{
7524 gint w, h;
7525
7526 get_ints (data, &w, &h);
7527
7528 ctk_window_resize (CTK_WINDOW (g_object_get_data (data, "target"))((((CtkWindow*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((g_object_get_data (data, "target"))), ((ctk_window_get_type
()))))))
, w, h);
7529}
7530
7531static void
7532unset_default_size_callback (CtkWidget *widget G_GNUC_UNUSED__attribute__ ((__unused__)),
7533 gpointer data)
7534{
7535 ctk_window_set_default_size (g_object_get_data (data, "target"),
7536 -1, -1);
7537}
7538
7539static void
7540set_default_size_callback (CtkWidget *widget G_GNUC_UNUSED__attribute__ ((__unused__)),
7541 gpointer data)
7542{
7543 gint w, h;
7544
7545 get_ints (data, &w, &h);
7546
7547 ctk_window_set_default_size (g_object_get_data (data, "target"),
7548 w, h);
7549}
7550
7551static void
7552unset_size_request_callback (CtkWidget *widget G_GNUC_UNUSED__attribute__ ((__unused__)),
7553 gpointer data)
7554{
7555 ctk_widget_set_size_request (g_object_get_data (data, "target"),
7556 -1, -1);
7557}
7558
7559static void
7560set_size_request_callback (CtkWidget *widget G_GNUC_UNUSED__attribute__ ((__unused__)),
7561 gpointer data)
7562{
7563 gint w, h;
7564
7565 get_ints (data, &w, &h);
7566
7567 ctk_widget_set_size_request (g_object_get_data (data, "target"),
7568 w, h);
7569}
7570
7571static void
7572set_location_callback (CtkWidget *widget G_GNUC_UNUSED__attribute__ ((__unused__)),
7573 gpointer data)
7574{
7575 gint x, y;
7576
7577 get_ints (data, &x, &y);
7578
7579 ctk_window_move (g_object_get_data (data, "target"), x, y);
7580}
7581
7582static void
7583move_to_position_callback (CtkWidget *widget G_GNUC_UNUSED__attribute__ ((__unused__)),
7584 gpointer data)
7585{
7586 gint x, y;
7587 CtkWindow *window;
7588
7589 window = g_object_get_data (data, "target");
7590
7591 ctk_window_get_position (window, &x, &y);
7592
7593 ctk_window_move (window, x, y);
7594}
7595
7596static void
7597set_geometry_callback (CtkWidget *entry,
7598 gpointer data)
7599{
7600 gchar *text;
7601 CtkWindow *target;
7602
7603 target = CTK_WINDOW (g_object_get_data (G_OBJECT (data), "target"))((((CtkWindow*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((g_object_get_data (((((GObject*) (void *) g_type_check_instance_cast
((GTypeInstance*) ((data)), (((GType) ((20) << (2)))))
))), "target"))), ((ctk_window_get_type ()))))))
;
7604
7605 text = ctk_editable_get_chars (CTK_EDITABLE (entry)((((CtkEditable*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((entry)), ((ctk_editable_get_type ()))))))
, 0, -1);
7606
7607 if (!ctk_window_parse_geometry (target, text))
7608 g_print ("Bad geometry string '%s'\n", text);
7609
7610 g_free (text);
7611}
7612
7613static void
7614resizable_callback (CtkWidget *widget,
7615 gpointer data)
7616{
7617 g_object_set (g_object_get_data (data, "target"),
7618 "resizable", ctk_toggle_button_get_active (CTK_TOGGLE_BUTTON (widget)((((CtkToggleButton*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((widget)), ((ctk_toggle_button_get_type ()))))))
),
7619 NULL((void*)0));
7620}
7621
7622static void
7623gravity_selected (CtkWidget *widget,
7624 gpointer data)
7625{
7626 ctk_window_set_gravity (CTK_WINDOW (g_object_get_data (data, "target"))((((CtkWindow*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((g_object_get_data (data, "target"))), ((ctk_window_get_type
()))))))
,
7627 ctk_combo_box_get_active (CTK_COMBO_BOX (widget)((((CtkComboBox*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((widget)), ((ctk_combo_box_get_type ()))))))
) + CDK_GRAVITY_NORTH_WEST);
7628}
7629
7630static void
7631pos_selected (CtkWidget *widget,
7632 gpointer data)
7633{
7634 ctk_window_set_position (CTK_WINDOW (g_object_get_data (data, "target"))((((CtkWindow*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((g_object_get_data (data, "target"))), ((ctk_window_get_type
()))))))
,
7635 ctk_combo_box_get_active (CTK_COMBO_BOX (widget)((((CtkComboBox*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((widget)), ((ctk_combo_box_get_type ()))))))
) + CTK_WIN_POS_NONE);
7636}
7637
7638static void
7639move_gravity_window_to_current_position (CtkWidget *widget G_GNUC_UNUSED__attribute__ ((__unused__)),
7640 gpointer data)
7641{
7642 gint x, y;
7643 CtkWindow *window;
7644
7645 window = CTK_WINDOW (data)((((CtkWindow*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((data)), ((ctk_window_get_type ()))))))
;
7646
7647 ctk_window_get_position (window, &x, &y);
7648
7649 ctk_window_move (window, x, y);
7650}
7651
7652static void
7653get_screen_corner (CtkWindow *window,
7654 gint *x,
7655 gint *y)
7656{
7657 int w, h;
7658 CdkScreen * screen = ctk_window_get_screen (window);
7659
7660 ctk_window_get_size (CTK_WINDOW (window)((((CtkWindow*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((window)), ((ctk_window_get_type ()))))))
, &w, &h);
7661
7662 switch (ctk_window_get_gravity (window))
7663 {
7664 case CDK_GRAVITY_SOUTH_EAST:
7665 *x = cdk_screen_get_width (screen) - w;
7666 *y = cdk_screen_get_height (screen) - h;
7667 break;
7668
7669 case CDK_GRAVITY_NORTH_EAST:
7670 *x = cdk_screen_get_width (screen) - w;
7671 *y = 0;
7672 break;
7673
7674 case CDK_GRAVITY_SOUTH_WEST:
7675 *x = 0;
7676 *y = cdk_screen_get_height (screen) - h;
7677 break;
7678
7679 case CDK_GRAVITY_NORTH_WEST:
7680 *x = 0;
7681 *y = 0;
7682 break;
7683
7684 case CDK_GRAVITY_SOUTH:
7685 *x = (cdk_screen_get_width (screen) - w) / 2;
7686 *y = cdk_screen_get_height (screen) - h;
7687 break;
7688
7689 case CDK_GRAVITY_NORTH:
7690 *x = (cdk_screen_get_width (screen) - w) / 2;
7691 *y = 0;
7692 break;
7693
7694 case CDK_GRAVITY_WEST:
7695 *x = 0;
7696 *y = (cdk_screen_get_height (screen) - h) / 2;
7697 break;
7698
7699 case CDK_GRAVITY_EAST:
7700 *x = cdk_screen_get_width (screen) - w;
7701 *y = (cdk_screen_get_height (screen) - h) / 2;
7702 break;
7703
7704 case CDK_GRAVITY_CENTER:
7705 *x = (cdk_screen_get_width (screen) - w) / 2;
7706 *y = (cdk_screen_get_height (screen) - h) / 2;
7707 break;
7708
7709 case CDK_GRAVITY_STATIC:
7710 /* pick some random numbers */
7711 *x = 350;
7712 *y = 350;
7713 break;
7714
7715 default:
7716 g_assert_not_reached ()do { g_assertion_message_expr (((gchar*) 0), "testctk.c", 7716
, ((const char*) (__func__)), ((void*)0)); } while (0)
;
7717 break;
7718 }
7719}
7720
7721static void
7722move_gravity_window_to_starting_position (CtkWidget *widget G_GNUC_UNUSED__attribute__ ((__unused__)),
7723 gpointer data)
7724{
7725 gint x, y;
7726 CtkWindow *window;
7727
7728 window = CTK_WINDOW (data)((((CtkWindow*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((data)), ((ctk_window_get_type ()))))))
;
7729
7730 get_screen_corner (window,
7731 &x, &y);
7732
7733 ctk_window_move (window, x, y);
7734}
7735
7736static CtkWidget*
7737make_gravity_window (CtkWidget *destroy_with,
7738 CdkGravity gravity,
7739 const gchar *title)
7740{
7741 CtkWidget *window;
7742 CtkWidget *button;
7743 CtkWidget *vbox;
7744 int x, y;
7745
7746 window = ctk_window_new (CTK_WINDOW_TOPLEVEL);
7747
7748 ctk_window_set_screen (CTK_WINDOW (window)((((CtkWindow*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((window)), ((ctk_window_get_type ()))))))
,
7749 ctk_widget_get_screen (destroy_with));
7750
7751 vbox = ctk_box_new (CTK_ORIENTATION_VERTICAL, 0);
7752 ctk_widget_show (vbox);
7753
7754 ctk_container_add (CTK_CONTAINER (window)((((CtkContainer*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((window)), ((ctk_container_get_type ()))))))
, vbox);
7755 ctk_window_set_title (CTK_WINDOW (window)((((CtkWindow*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((window)), ((ctk_window_get_type ()))))))
, title);
7756 ctk_window_set_gravity (CTK_WINDOW (window)((((CtkWindow*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((window)), ((ctk_window_get_type ()))))))
, gravity);
7757
7758 g_signal_connect_object (destroy_with,
7759 "destroy",
7760 G_CALLBACK (ctk_widget_destroy)((GCallback) (ctk_widget_destroy)),
7761 window,
7762 G_CONNECT_SWAPPED);
7763
7764
7765 button = ctk_button_new_with_mnemonic ("_Move to current position");
7766
7767 g_signal_connect (button, "clicked",g_signal_connect_data ((button), ("clicked"), (((GCallback) (
move_gravity_window_to_current_position))), (window), ((void*
)0), (GConnectFlags) 0)
7768 G_CALLBACK (move_gravity_window_to_current_position),g_signal_connect_data ((button), ("clicked"), (((GCallback) (
move_gravity_window_to_current_position))), (window), ((void*
)0), (GConnectFlags) 0)
7769 window)g_signal_connect_data ((button), ("clicked"), (((GCallback) (
move_gravity_window_to_current_position))), (window), ((void*
)0), (GConnectFlags) 0)
;
7770
7771 ctk_container_add (CTK_CONTAINER (vbox)((((CtkContainer*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((vbox)), ((ctk_container_get_type ()))))))
, button);
7772 ctk_widget_show (button);
7773
7774 button = ctk_button_new_with_mnemonic ("Move to _starting position");
7775
7776 g_signal_connect (button, "clicked",g_signal_connect_data ((button), ("clicked"), (((GCallback) (
move_gravity_window_to_starting_position))), (window), ((void
*)0), (GConnectFlags) 0)
7777 G_CALLBACK (move_gravity_window_to_starting_position),g_signal_connect_data ((button), ("clicked"), (((GCallback) (
move_gravity_window_to_starting_position))), (window), ((void
*)0), (GConnectFlags) 0)
7778 window)g_signal_connect_data ((button), ("clicked"), (((GCallback) (
move_gravity_window_to_starting_position))), (window), ((void
*)0), (GConnectFlags) 0)
;
7779
7780 ctk_container_add (CTK_CONTAINER (vbox)((((CtkContainer*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((vbox)), ((ctk_container_get_type ()))))))
, button);
7781 ctk_widget_show (button);
7782
7783 /* Pretend this is the result of --geometry.
7784 * DO NOT COPY THIS CODE unless you are setting --geometry results,
7785 * and in that case you probably should just use ctk_window_parse_geometry().
7786 * AGAIN, DO NOT SET CDK_HINT_USER_POS! It violates the ICCCM unless
7787 * you are parsing --geometry or equivalent.
7788 */
7789 ctk_window_set_geometry_hints (CTK_WINDOW (window)((((CtkWindow*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((window)), ((ctk_window_get_type ()))))))
,
7790 NULL((void*)0), NULL((void*)0),
7791 CDK_HINT_USER_POS);
7792
7793 ctk_window_set_default_size (CTK_WINDOW (window)((((CtkWindow*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((window)), ((ctk_window_get_type ()))))))
,
7794 200, 200);
7795
7796 get_screen_corner (CTK_WINDOW (window)((((CtkWindow*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((window)), ((ctk_window_get_type ()))))))
, &x, &y);
7797
7798 ctk_window_move (CTK_WINDOW (window)((((CtkWindow*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((window)), ((ctk_window_get_type ()))))))
,
7799 x, y);
7800
7801 return window;
7802}
7803
7804static void
7805do_gravity_test (CtkWidget *widget G_GNUC_UNUSED__attribute__ ((__unused__)),
7806 gpointer data)
7807{
7808 CtkWidget *destroy_with = data;
7809 CtkWidget *window;
7810
7811 /* We put a window at each gravity point on the screen. */
7812 window = make_gravity_window (destroy_with, CDK_GRAVITY_NORTH_WEST,
7813 "NorthWest");
7814 ctk_widget_show (window);
7815
7816 window = make_gravity_window (destroy_with, CDK_GRAVITY_SOUTH_EAST,
7817 "SouthEast");
7818 ctk_widget_show (window);
7819
7820 window = make_gravity_window (destroy_with, CDK_GRAVITY_NORTH_EAST,
7821 "NorthEast");
7822 ctk_widget_show (window);
7823
7824 window = make_gravity_window (destroy_with, CDK_GRAVITY_SOUTH_WEST,
7825 "SouthWest");
7826 ctk_widget_show (window);
7827
7828 window = make_gravity_window (destroy_with, CDK_GRAVITY_SOUTH,
7829 "South");
7830 ctk_widget_show (window);
7831
7832 window = make_gravity_window (destroy_with, CDK_GRAVITY_NORTH,
7833 "North");
7834 ctk_widget_show (window);
7835
7836
7837 window = make_gravity_window (destroy_with, CDK_GRAVITY_WEST,
7838 "West");
7839 ctk_widget_show (window);
7840
7841
7842 window = make_gravity_window (destroy_with, CDK_GRAVITY_EAST,
7843 "East");
7844 ctk_widget_show (window);
7845
7846 window = make_gravity_window (destroy_with, CDK_GRAVITY_CENTER,
7847 "Center");
7848 ctk_widget_show (window);
7849
7850 window = make_gravity_window (destroy_with, CDK_GRAVITY_STATIC,
7851 "Static");
7852 ctk_widget_show (window);
7853}
7854
7855static CtkWidget*
7856window_controls (CtkWidget *window)
7857{
7858 CtkWidget *control_window;
7859 CtkWidget *label;
7860 CtkWidget *vbox;
7861 CtkWidget *button;
7862 CtkWidget *spin;
7863 CtkAdjustment *adjustment;
7864 CtkWidget *entry;
7865 CtkWidget *om;
7866 gint i;
7867
7868 control_window = ctk_window_new (CTK_WINDOW_TOPLEVEL);
7869
7870 ctk_window_set_screen (CTK_WINDOW (control_window)((((CtkWindow*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((control_window)), ((ctk_window_get_type ()))))))
,
7871 ctk_widget_get_screen (window));
7872
7873 ctk_window_set_title (CTK_WINDOW (control_window)((((CtkWindow*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((control_window)), ((ctk_window_get_type ()))))))
, "Size controls");
7874
7875 g_object_set_data (G_OBJECT (control_window)((((GObject*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((control_window)), (((GType) ((20) << (2))))))))
,
7876 "target",
7877 window);
7878
7879 g_signal_connect_object (control_window,
7880 "destroy",
7881 G_CALLBACK (ctk_widget_destroy)((GCallback) (ctk_widget_destroy)),
7882 window,
7883 G_CONNECT_SWAPPED);
7884
7885 vbox = ctk_box_new (CTK_ORIENTATION_VERTICAL, 5);
7886
7887 ctk_container_add (CTK_CONTAINER (control_window)((((CtkContainer*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((control_window)), ((ctk_container_get_type ()))))))
, vbox);
7888
7889 label = ctk_label_new ("<no configure events>");
7890 ctk_box_pack_start (CTK_BOX (vbox)((((CtkBox*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((vbox)), ((ctk_box_get_type ()))))))
, label, FALSE(0), FALSE(0), 0);
7891
7892 g_signal_connect (window,g_signal_connect_data ((window), ("configure_event"), (((GCallback
) (configure_event_callback))), (label), ((void*)0), (GConnectFlags
) 0)
7893 "configure_event",g_signal_connect_data ((window), ("configure_event"), (((GCallback
) (configure_event_callback))), (label), ((void*)0), (GConnectFlags
) 0)
7894 G_CALLBACK (configure_event_callback),g_signal_connect_data ((window), ("configure_event"), (((GCallback
) (configure_event_callback))), (label), ((void*)0), (GConnectFlags
) 0)
7895 label)g_signal_connect_data ((window), ("configure_event"), (((GCallback
) (configure_event_callback))), (label), ((void*)0), (GConnectFlags
) 0)
;
7896
7897 adjustment = ctk_adjustment_new (10.0, -2000.0, 2000.0, 1.0, 5.0, 0.0);
7898 spin = ctk_spin_button_new (adjustment, 0, 0);
7899
7900 ctk_box_pack_start (CTK_BOX (vbox)((((CtkBox*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((vbox)), ((ctk_box_get_type ()))))))
, spin, FALSE(0), FALSE(0), 0);
7901
7902 g_object_set_data (G_OBJECT (control_window)((((GObject*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((control_window)), (((GType) ((20) << (2))))))))
, "spin1", spin);
7903
7904 adjustment = ctk_adjustment_new (10.0, -2000.0, 2000.0, 1.0, 5.0, 0.0);
7905 spin = ctk_spin_button_new (adjustment, 0, 0);
7906
7907 ctk_box_pack_start (CTK_BOX (vbox)((((CtkBox*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((vbox)), ((ctk_box_get_type ()))))))
, spin, FALSE(0), FALSE(0), 0);
7908
7909 g_object_set_data (G_OBJECT (control_window)((((GObject*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((control_window)), (((GType) ((20) << (2))))))))
, "spin2", spin);
7910
7911 entry = ctk_entry_new ();
7912 ctk_box_pack_start (CTK_BOX (vbox)((((CtkBox*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((vbox)), ((ctk_box_get_type ()))))))
, entry, FALSE(0), FALSE(0), 0);
7913
7914 g_signal_connect (entry, "changed",g_signal_connect_data ((entry), ("changed"), (((GCallback) (set_geometry_callback
))), (control_window), ((void*)0), (GConnectFlags) 0)
7915 G_CALLBACK (set_geometry_callback),g_signal_connect_data ((entry), ("changed"), (((GCallback) (set_geometry_callback
))), (control_window), ((void*)0), (GConnectFlags) 0)
7916 control_window)g_signal_connect_data ((entry), ("changed"), (((GCallback) (set_geometry_callback
))), (control_window), ((void*)0), (GConnectFlags) 0)
;
7917
7918 button = ctk_button_new_with_label ("Show gravity test windows");
7919 g_signal_connect_swapped (button,g_signal_connect_data ((button), ("clicked"), (((GCallback) (
do_gravity_test))), (control_window), ((void*)0), G_CONNECT_SWAPPED
)
7920 "clicked",g_signal_connect_data ((button), ("clicked"), (((GCallback) (
do_gravity_test))), (control_window), ((void*)0), G_CONNECT_SWAPPED
)
7921 G_CALLBACK (do_gravity_test),g_signal_connect_data ((button), ("clicked"), (((GCallback) (
do_gravity_test))), (control_window), ((void*)0), G_CONNECT_SWAPPED
)
7922 control_window)g_signal_connect_data ((button), ("clicked"), (((GCallback) (
do_gravity_test))), (control_window), ((void*)0), G_CONNECT_SWAPPED
)
;
7923 ctk_box_pack_end (CTK_BOX (vbox)((((CtkBox*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((vbox)), ((ctk_box_get_type ()))))))
, button, FALSE(0), FALSE(0), 0);
7924
7925 G_GNUC_BEGIN_IGNORE_DEPRECATIONSclang diagnostic push clang diagnostic ignored "-Wdeprecated-declarations"
;
7926 button = ctk_button_new_with_label ("Reshow with initial size");
7927 g_signal_connect_object (button,
7928 "clicked",
7929 G_CALLBACK (ctk_window_reshow_with_initial_size)((GCallback) (ctk_window_reshow_with_initial_size)),
7930 window,
7931 G_CONNECT_SWAPPED);
7932 ctk_box_pack_end (CTK_BOX (vbox)((((CtkBox*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((vbox)), ((ctk_box_get_type ()))))))
, button, FALSE(0), FALSE(0), 0);
7933 G_GNUC_END_IGNORE_DEPRECATIONSclang diagnostic pop ;
7934
7935 button = ctk_button_new_with_label ("Queue resize");
7936 g_signal_connect_object (button,
7937 "clicked",
7938 G_CALLBACK (ctk_widget_queue_resize)((GCallback) (ctk_widget_queue_resize)),
7939 window,
7940 G_CONNECT_SWAPPED);
7941 ctk_box_pack_end (CTK_BOX (vbox)((((CtkBox*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((vbox)), ((ctk_box_get_type ()))))))
, button, FALSE(0), FALSE(0), 0);
7942
7943 button = ctk_button_new_with_label ("Resize");
7944 g_signal_connect (button,g_signal_connect_data ((button), ("clicked"), (((GCallback) (
set_size_callback))), (control_window), ((void*)0), (GConnectFlags
) 0)
7945 "clicked",g_signal_connect_data ((button), ("clicked"), (((GCallback) (
set_size_callback))), (control_window), ((void*)0), (GConnectFlags
) 0)
7946 G_CALLBACK (set_size_callback),g_signal_connect_data ((button), ("clicked"), (((GCallback) (
set_size_callback))), (control_window), ((void*)0), (GConnectFlags
) 0)
7947 control_window)g_signal_connect_data ((button), ("clicked"), (((GCallback) (
set_size_callback))), (control_window), ((void*)0), (GConnectFlags
) 0)
;
7948 ctk_box_pack_end (CTK_BOX (vbox)((((CtkBox*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((vbox)), ((ctk_box_get_type ()))))))
, button, FALSE(0), FALSE(0), 0);
7949
7950 button = ctk_button_new_with_label ("Set default size");
7951 g_signal_connect (button,g_signal_connect_data ((button), ("clicked"), (((GCallback) (
set_default_size_callback))), (control_window), ((void*)0), (
GConnectFlags) 0)
7952 "clicked",g_signal_connect_data ((button), ("clicked"), (((GCallback) (
set_default_size_callback))), (control_window), ((void*)0), (
GConnectFlags) 0)
7953 G_CALLBACK (set_default_size_callback),g_signal_connect_data ((button), ("clicked"), (((GCallback) (
set_default_size_callback))), (control_window), ((void*)0), (
GConnectFlags) 0)
7954 control_window)g_signal_connect_data ((button), ("clicked"), (((GCallback) (
set_default_size_callback))), (control_window), ((void*)0), (
GConnectFlags) 0)
;
7955 ctk_box_pack_end (CTK_BOX (vbox)((((CtkBox*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((vbox)), ((ctk_box_get_type ()))))))
, button, FALSE(0), FALSE(0), 0);
7956
7957 button = ctk_button_new_with_label ("Unset default size");
7958 g_signal_connect (button,g_signal_connect_data ((button), ("clicked"), (((GCallback) (
unset_default_size_callback))), (control_window), ((void*)0),
(GConnectFlags) 0)
7959 "clicked",g_signal_connect_data ((button), ("clicked"), (((GCallback) (
unset_default_size_callback))), (control_window), ((void*)0),
(GConnectFlags) 0)
7960 G_CALLBACK (unset_default_size_callback),g_signal_connect_data ((button), ("clicked"), (((GCallback) (
unset_default_size_callback))), (control_window), ((void*)0),
(GConnectFlags) 0)
7961 control_window)g_signal_connect_data ((button), ("clicked"), (((GCallback) (
unset_default_size_callback))), (control_window), ((void*)0),
(GConnectFlags) 0)
;
7962 ctk_box_pack_end (CTK_BOX (vbox)((((CtkBox*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((vbox)), ((ctk_box_get_type ()))))))
, button, FALSE(0), FALSE(0), 0);
7963
7964 button = ctk_button_new_with_label ("Set size request");
7965 g_signal_connect (button,g_signal_connect_data ((button), ("clicked"), (((GCallback) (
set_size_request_callback))), (control_window), ((void*)0), (
GConnectFlags) 0)
7966 "clicked",g_signal_connect_data ((button), ("clicked"), (((GCallback) (
set_size_request_callback))), (control_window), ((void*)0), (
GConnectFlags) 0)
7967 G_CALLBACK (set_size_request_callback),g_signal_connect_data ((button), ("clicked"), (((GCallback) (
set_size_request_callback))), (control_window), ((void*)0), (
GConnectFlags) 0)
7968 control_window)g_signal_connect_data ((button), ("clicked"), (((GCallback) (
set_size_request_callback))), (control_window), ((void*)0), (
GConnectFlags) 0)
;
7969 ctk_box_pack_end (CTK_BOX (vbox)((((CtkBox*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((vbox)), ((ctk_box_get_type ()))))))
, button, FALSE(0), FALSE(0), 0);
7970
7971 button = ctk_button_new_with_label ("Unset size request");
7972 g_signal_connect (button,g_signal_connect_data ((button), ("clicked"), (((GCallback) (
unset_size_request_callback))), (control_window), ((void*)0),
(GConnectFlags) 0)
7973 "clicked",g_signal_connect_data ((button), ("clicked"), (((GCallback) (
unset_size_request_callback))), (control_window), ((void*)0),
(GConnectFlags) 0)
7974 G_CALLBACK (unset_size_request_callback),g_signal_connect_data ((button), ("clicked"), (((GCallback) (
unset_size_request_callback))), (control_window), ((void*)0),
(GConnectFlags) 0)
7975 control_window)g_signal_connect_data ((button), ("clicked"), (((GCallback) (
unset_size_request_callback))), (control_window), ((void*)0),
(GConnectFlags) 0)
;
7976 ctk_box_pack_end (CTK_BOX (vbox)((((CtkBox*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((vbox)), ((ctk_box_get_type ()))))))
, button, FALSE(0), FALSE(0), 0);
7977
7978 button = ctk_button_new_with_label ("Move");
7979 g_signal_connect (button,g_signal_connect_data ((button), ("clicked"), (((GCallback) (
set_location_callback))), (control_window), ((void*)0), (GConnectFlags
) 0)
7980 "clicked",g_signal_connect_data ((button), ("clicked"), (((GCallback) (
set_location_callback))), (control_window), ((void*)0), (GConnectFlags
) 0)
7981 G_CALLBACK (set_location_callback),g_signal_connect_data ((button), ("clicked"), (((GCallback) (
set_location_callback))), (control_window), ((void*)0), (GConnectFlags
) 0)
7982 control_window)g_signal_connect_data ((button), ("clicked"), (((GCallback) (
set_location_callback))), (control_window), ((void*)0), (GConnectFlags
) 0)
;
7983 ctk_box_pack_end (CTK_BOX (vbox)((((CtkBox*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((vbox)), ((ctk_box_get_type ()))))))
, button, FALSE(0), FALSE(0), 0);
7984
7985 button = ctk_button_new_with_label ("Move to current position");
7986 g_signal_connect (button,g_signal_connect_data ((button), ("clicked"), (((GCallback) (
move_to_position_callback))), (control_window), ((void*)0), (
GConnectFlags) 0)
7987 "clicked",g_signal_connect_data ((button), ("clicked"), (((GCallback) (
move_to_position_callback))), (control_window), ((void*)0), (
GConnectFlags) 0)
7988 G_CALLBACK (move_to_position_callback),g_signal_connect_data ((button), ("clicked"), (((GCallback) (
move_to_position_callback))), (control_window), ((void*)0), (
GConnectFlags) 0)
7989 control_window)g_signal_connect_data ((button), ("clicked"), (((GCallback) (
move_to_position_callback))), (control_window), ((void*)0), (
GConnectFlags) 0)
;
7990 ctk_box_pack_end (CTK_BOX (vbox)((((CtkBox*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((vbox)), ((ctk_box_get_type ()))))))
, button, FALSE(0), FALSE(0), 0);
7991
7992 button = ctk_check_button_new_with_label ("Allow resize");
7993 ctk_toggle_button_set_active (CTK_TOGGLE_BUTTON (button)((((CtkToggleButton*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((button)), ((ctk_toggle_button_get_type ()))))))
, TRUE(!(0)));
7994 g_signal_connect (button,g_signal_connect_data ((button), ("toggled"), (((GCallback) (
resizable_callback))), (control_window), ((void*)0), (GConnectFlags
) 0)
7995 "toggled",g_signal_connect_data ((button), ("toggled"), (((GCallback) (
resizable_callback))), (control_window), ((void*)0), (GConnectFlags
) 0)
7996 G_CALLBACK (resizable_callback),g_signal_connect_data ((button), ("toggled"), (((GCallback) (
resizable_callback))), (control_window), ((void*)0), (GConnectFlags
) 0)
7997 control_window)g_signal_connect_data ((button), ("toggled"), (((GCallback) (
resizable_callback))), (control_window), ((void*)0), (GConnectFlags
) 0)
;
7998 ctk_box_pack_end (CTK_BOX (vbox)((((CtkBox*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((vbox)), ((ctk_box_get_type ()))))))
, button, FALSE(0), FALSE(0), 0);
7999
8000 button = ctk_button_new_with_mnemonic ("_Show");
8001 g_signal_connect_object (button,
8002 "clicked",
8003 G_CALLBACK (ctk_widget_show)((GCallback) (ctk_widget_show)),
8004 window,
8005 G_CONNECT_SWAPPED);
8006 ctk_box_pack_end (CTK_BOX (vbox)((((CtkBox*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((vbox)), ((ctk_box_get_type ()))))))
, button, FALSE(0), FALSE(0), 0);
8007
8008 button = ctk_button_new_with_mnemonic ("_Hide");
8009 g_signal_connect_object (button,
8010 "clicked",
8011 G_CALLBACK (ctk_widget_hide)((GCallback) (ctk_widget_hide)),
8012 window,
8013 G_CONNECT_SWAPPED);
8014 ctk_box_pack_end (CTK_BOX (vbox)((((CtkBox*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((vbox)), ((ctk_box_get_type ()))))))
, button, FALSE(0), FALSE(0), 0);
8015
8016 om = ctk_combo_box_text_new ();
8017 i = 0;
8018 while (i < 10)
8019 {
8020 static gchar *names[] = {
8021 "CDK_GRAVITY_NORTH_WEST",
8022 "CDK_GRAVITY_NORTH",
8023 "CDK_GRAVITY_NORTH_EAST",
8024 "CDK_GRAVITY_WEST",
8025 "CDK_GRAVITY_CENTER",
8026 "CDK_GRAVITY_EAST",
8027 "CDK_GRAVITY_SOUTH_WEST",
8028 "CDK_GRAVITY_SOUTH",
8029 "CDK_GRAVITY_SOUTH_EAST",
8030 "CDK_GRAVITY_STATIC",
8031 NULL((void*)0)
8032 };
8033
8034 g_assert (names[i])do { if (names[i]) ; else g_assertion_message_expr (((gchar*)
0), "testctk.c", 8034, ((const char*) (__func__)), "names[i]"
); } while (0)
;
8035 ctk_combo_box_text_append_text (CTK_COMBO_BOX_TEXT (om)((((CtkComboBoxText*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((om)), ((ctk_combo_box_text_get_type ()))))))
, names[i]);
8036
8037 ++i;
8038 }
8039
8040 g_signal_connect (om,g_signal_connect_data ((om), ("changed"), (((GCallback) (gravity_selected
))), (control_window), ((void*)0), (GConnectFlags) 0)
8041 "changed",g_signal_connect_data ((om), ("changed"), (((GCallback) (gravity_selected
))), (control_window), ((void*)0), (GConnectFlags) 0)
8042 G_CALLBACK (gravity_selected),g_signal_connect_data ((om), ("changed"), (((GCallback) (gravity_selected
))), (control_window), ((void*)0), (GConnectFlags) 0)
8043 control_window)g_signal_connect_data ((om), ("changed"), (((GCallback) (gravity_selected
))), (control_window), ((void*)0), (GConnectFlags) 0)
;
8044
8045 ctk_box_pack_end (CTK_BOX (vbox)((((CtkBox*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((vbox)), ((ctk_box_get_type ()))))))
, om, FALSE(0), FALSE(0), 0);
8046
8047
8048 om = ctk_combo_box_text_new ();
8049 i = 0;
8050 while (i < 5)
8051 {
8052 static gchar *names[] = {
8053 "CTK_WIN_POS_NONE",
8054 "CTK_WIN_POS_CENTER",
8055 "CTK_WIN_POS_MOUSE",
8056 "CTK_WIN_POS_CENTER_ALWAYS",
8057 "CTK_WIN_POS_CENTER_ON_PARENT",
8058 NULL((void*)0)
8059 };
8060
8061 g_assert (names[i])do { if (names[i]) ; else g_assertion_message_expr (((gchar*)
0), "testctk.c", 8061, ((const char*) (__func__)), "names[i]"
); } while (0)
;
8062 ctk_combo_box_text_append_text (CTK_COMBO_BOX_TEXT (om)((((CtkComboBoxText*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((om)), ((ctk_combo_box_text_get_type ()))))))
, names[i]);
8063
8064 ++i;
8065 }
8066
8067 g_signal_connect (om,g_signal_connect_data ((om), ("changed"), (((GCallback) (pos_selected
))), (control_window), ((void*)0), (GConnectFlags) 0)
8068 "changed",g_signal_connect_data ((om), ("changed"), (((GCallback) (pos_selected
))), (control_window), ((void*)0), (GConnectFlags) 0)
8069 G_CALLBACK (pos_selected),g_signal_connect_data ((om), ("changed"), (((GCallback) (pos_selected
))), (control_window), ((void*)0), (GConnectFlags) 0)
8070 control_window)g_signal_connect_data ((om), ("changed"), (((GCallback) (pos_selected
))), (control_window), ((void*)0), (GConnectFlags) 0)
;
8071
8072 ctk_box_pack_end (CTK_BOX (vbox)((((CtkBox*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((vbox)), ((ctk_box_get_type ()))))))
, om, FALSE(0), FALSE(0), 0);
8073
8074 ctk_widget_show_all (vbox);
8075
8076 return control_window;
8077}
8078
8079void
8080create_window_sizing (CtkWidget *widget)
8081{
8082 static CtkWidget *window = NULL((void*)0);
8083 static CtkWidget *target_window = NULL((void*)0);
8084
8085 if (!target_window)
8086 {
8087 CtkWidget *label;
8088
8089 target_window = ctk_window_new (CTK_WINDOW_TOPLEVEL);
8090 ctk_window_set_screen (CTK_WINDOW (target_window)((((CtkWindow*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((target_window)), ((ctk_window_get_type ()))))))
,
8091 ctk_widget_get_screen (widget));
8092 label = ctk_label_new (NULL((void*)0));
8093 ctk_label_set_markup (CTK_LABEL (label)((((CtkLabel*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((label)), ((ctk_label_get_type ()))))))
, "<span foreground=\"purple\"><big>Window being resized</big></span>\nBlah blah blah blah\nblah blah blah\nblah blah blah blah blah");
8094 ctk_container_add (CTK_CONTAINER (target_window)((((CtkContainer*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((target_window)), ((ctk_container_get_type ()))))))
, label);
8095 ctk_widget_show (label);
8096
8097 g_signal_connect (target_window, "destroy",g_signal_connect_data ((target_window), ("destroy"), (((GCallback
) (ctk_widget_destroyed))), (&target_window), ((void*)0),
(GConnectFlags) 0)
8098 G_CALLBACK (ctk_widget_destroyed),g_signal_connect_data ((target_window), ("destroy"), (((GCallback
) (ctk_widget_destroyed))), (&target_window), ((void*)0),
(GConnectFlags) 0)
8099 &target_window)g_signal_connect_data ((target_window), ("destroy"), (((GCallback
) (ctk_widget_destroyed))), (&target_window), ((void*)0),
(GConnectFlags) 0)
;
8100
8101 window = window_controls (target_window);
8102
8103 g_signal_connect (window, "destroy",g_signal_connect_data ((window), ("destroy"), (((GCallback) (
ctk_widget_destroyed))), (&window), ((void*)0), (GConnectFlags
) 0)
8104 G_CALLBACK (ctk_widget_destroyed),g_signal_connect_data ((window), ("destroy"), (((GCallback) (
ctk_widget_destroyed))), (&window), ((void*)0), (GConnectFlags
) 0)
8105 &window)g_signal_connect_data ((window), ("destroy"), (((GCallback) (
ctk_widget_destroyed))), (&window), ((void*)0), (GConnectFlags
) 0)
;
8106
8107 ctk_window_set_title (CTK_WINDOW (target_window)((((CtkWindow*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((target_window)), ((ctk_window_get_type ()))))))
, "Window to size");
8108 }
8109
8110 /* don't show target window by default, we want to allow testing
8111 * of behavior on first show.
8112 */
8113
8114 if (!ctk_widget_get_visible (window))
8115 ctk_widget_show (window);
8116 else
8117 ctk_widget_destroy (window);
8118}
8119
8120/*
8121 * CtkProgressBar
8122 */
8123
8124typedef struct _ProgressData {
8125 CtkWidget *window;
8126 CtkWidget *pbar;
8127 CtkWidget *block_spin;
8128 CtkWidget *x_align_spin;
8129 CtkWidget *y_align_spin;
8130 CtkWidget *step_spin;
8131 CtkWidget *act_blocks_spin;
8132 CtkWidget *label;
8133 CtkWidget *omenu1;
8134 CtkWidget *elmenu;
8135 CtkWidget *omenu2;
8136 CtkWidget *entry;
8137 int timer;
8138 gboolean activity;
8139} ProgressData;
8140
8141gboolean
8142progress_timeout (gpointer data)
8143{
8144 ProgressData *pdata = data;
8145 gdouble new_val;
8146 gchar *text;
8147
8148 if (pdata->activity)
8149 {
8150 ctk_progress_bar_pulse (CTK_PROGRESS_BAR (pdata->pbar)((((CtkProgressBar*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((pdata->pbar)), ((ctk_progress_bar_get_type ()))))))
);
8151
8152 text = g_strdup_printf ("%s", "???");
8153 }
8154 else
8155 {
8156 new_val = ctk_progress_bar_get_fraction (CTK_PROGRESS_BAR (pdata->pbar)((((CtkProgressBar*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((pdata->pbar)), ((ctk_progress_bar_get_type ()))))))
) + 0.01;
8157 if (new_val > 1.00)
8158 new_val = 0.00;
8159 ctk_progress_bar_set_fraction (CTK_PROGRESS_BAR (pdata->pbar)((((CtkProgressBar*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((pdata->pbar)), ((ctk_progress_bar_get_type ()))))))
, new_val);
8160
8161 text = g_strdup_printf ("%.0f%%", 100 * new_val);
8162 }
8163
8164 ctk_label_set_text (CTK_LABEL (pdata->label)((((CtkLabel*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((pdata->label)), ((ctk_label_get_type ()))))))
, text);
8165 g_free (text);
8166
8167 return TRUE(!(0));
8168}
8169
8170static void
8171destroy_progress (CtkWidget *widget G_GNUC_UNUSED__attribute__ ((__unused__)),
8172 ProgressData **pdata)
8173{
8174 if ((*pdata)->timer)
8175 {
8176 g_source_remove ((*pdata)->timer);
8177 (*pdata)->timer = 0;
8178 }
8179 (*pdata)->window = NULL((void*)0);
8180 g_free (*pdata);
8181 *pdata = NULL((void*)0);
8182}
8183
8184static void
8185progressbar_toggle_orientation (CtkWidget *widget, gpointer data)
8186{
8187 ProgressData *pdata;
8188 gint i;
8189
8190 pdata = (ProgressData *) data;
8191
8192 if (!ctk_widget_get_mapped (widget))
8193 return;
8194
8195 i = ctk_combo_box_get_active (CTK_COMBO_BOX (widget)((((CtkComboBox*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((widget)), ((ctk_combo_box_get_type ()))))))
);
8196
8197 if (i == 0 || i == 1)
8198 ctk_orientable_set_orientation (CTK_ORIENTABLE (pdata->pbar)((((CtkOrientable*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((pdata->pbar)), ((ctk_orientable_get_type ()))))))
, CTK_ORIENTATION_HORIZONTAL);
8199 else
8200 ctk_orientable_set_orientation (CTK_ORIENTABLE (pdata->pbar)((((CtkOrientable*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((pdata->pbar)), ((ctk_orientable_get_type ()))))))
, CTK_ORIENTATION_VERTICAL);
8201
8202 if (i == 1 || i == 2)
8203 ctk_progress_bar_set_inverted (CTK_PROGRESS_BAR (pdata->pbar)((((CtkProgressBar*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((pdata->pbar)), ((ctk_progress_bar_get_type ()))))))
, TRUE(!(0)));
8204 else
8205 ctk_progress_bar_set_inverted (CTK_PROGRESS_BAR (pdata->pbar)((((CtkProgressBar*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((pdata->pbar)), ((ctk_progress_bar_get_type ()))))))
, FALSE(0));
8206}
8207
8208static void
8209toggle_show_text (CtkWidget *widget, ProgressData *pdata)
8210{
8211 gboolean active;
8212
8213 active = ctk_toggle_button_get_active (CTK_TOGGLE_BUTTON (widget)((((CtkToggleButton*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((widget)), ((ctk_toggle_button_get_type ()))))))
);
8214 ctk_progress_bar_set_show_text (CTK_PROGRESS_BAR (pdata->pbar)((((CtkProgressBar*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((pdata->pbar)), ((ctk_progress_bar_get_type ()))))))
, active);
8215}
8216
8217static void
8218progressbar_toggle_ellipsize (CtkWidget *widget,
8219 gpointer data)
8220{
8221 if (ctk_widget_is_drawable (widget))
8222 {
8223 ProgressData *pdata = data;
8224 gint i = ctk_combo_box_get_active (CTK_COMBO_BOX (widget)((((CtkComboBox*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((widget)), ((ctk_combo_box_get_type ()))))))
);
8225 ctk_progress_bar_set_ellipsize (CTK_PROGRESS_BAR (pdata->pbar)((((CtkProgressBar*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((pdata->pbar)), ((ctk_progress_bar_get_type ()))))))
, i);
8226 }
8227}
8228
8229static void
8230toggle_activity_mode (CtkWidget *widget, ProgressData *pdata)
8231{
8232 pdata->activity = ctk_toggle_button_get_active (CTK_TOGGLE_BUTTON (widget)((((CtkToggleButton*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((widget)), ((ctk_toggle_button_get_type ()))))))
);
8233}
8234
8235static void
8236toggle_running (CtkWidget *widget, ProgressData *pdata)
8237{
8238 if (ctk_toggle_button_get_active (CTK_TOGGLE_BUTTON (widget)((((CtkToggleButton*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((widget)), ((ctk_toggle_button_get_type ()))))))
))
8239 {
8240 if (pdata->timer == 0)
8241 pdata->timer = g_timeout_add (100, (GSourceFunc)progress_timeout, pdata);
8242 }
8243 else
8244 {
8245 if (pdata->timer != 0)
8246 {
8247 g_source_remove (pdata->timer);
8248 pdata->timer = 0;
8249 }
8250 }
8251}
8252
8253static void
8254entry_changed (CtkWidget *widget G_GNUC_UNUSED__attribute__ ((__unused__)),
8255 ProgressData *pdata)
8256{
8257 ctk_progress_bar_set_text (CTK_PROGRESS_BAR (pdata->pbar)((((CtkProgressBar*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((pdata->pbar)), ((ctk_progress_bar_get_type ()))))))
,
8258 ctk_entry_get_text (CTK_ENTRY (pdata->entry)((((CtkEntry*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((pdata->entry)), ((ctk_entry_get_type ()))))))
));
8259}
8260
8261void
8262create_progress_bar (CtkWidget *widget)
8263{
8264 static ProgressData *pdata = NULL((void*)0);
8265
8266 if (!pdata)
8267 pdata = g_new0 (ProgressData, 1)((ProgressData *) g_malloc0_n ((1), sizeof (ProgressData)));
8268
8269 if (!pdata->window)
8270 {
8271 CtkWidget *content_area;
8272 CtkWidget *vbox;
8273 CtkWidget *vbox2;
8274 CtkWidget *hbox;
8275 CtkWidget *check;
8276 CtkWidget *frame;
8277 CtkWidget *grid;
8278 CtkWidget *label;
8279
8280 static gchar *items1[] =
8281 {
8282 "Left-Right",
8283 "Right-Left",
8284 "Bottom-Top",
8285 "Top-Bottom"
8286 };
8287
8288 static char *ellipsize_items[] =
8289 {
8290 "None", // PANGO_ELLIPSIZE_NONE,
8291 "Start", // PANGO_ELLIPSIZE_START,
8292 "Middle", // PANGO_ELLIPSIZE_MIDDLE,
8293 "End", // PANGO_ELLIPSIZE_END
8294 };
8295
8296 pdata->window = ctk_dialog_new ();
8297
8298 ctk_window_set_screen (CTK_WINDOW (pdata->window)((((CtkWindow*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((pdata->window)), ((ctk_window_get_type ()))))))
,
8299 ctk_widget_get_screen (widget));
8300
8301 ctk_window_set_resizable (CTK_WINDOW (pdata->window)((((CtkWindow*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((pdata->window)), ((ctk_window_get_type ()))))))
, TRUE(!(0)));
8302
8303 g_signal_connect (pdata->window, "destroy",g_signal_connect_data ((pdata->window), ("destroy"), (((GCallback
) (destroy_progress))), (&pdata), ((void*)0), (GConnectFlags
) 0)
8304 G_CALLBACK (destroy_progress),g_signal_connect_data ((pdata->window), ("destroy"), (((GCallback
) (destroy_progress))), (&pdata), ((void*)0), (GConnectFlags
) 0)
8305 &pdata)g_signal_connect_data ((pdata->window), ("destroy"), (((GCallback
) (destroy_progress))), (&pdata), ((void*)0), (GConnectFlags
) 0)
;
8306 pdata->timer = 0;
8307
8308 content_area = ctk_dialog_get_content_area (CTK_DIALOG (pdata->window)((((CtkDialog*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((pdata->window)), ((ctk_dialog_get_type ()))))))
);
8309
8310 ctk_window_set_title (CTK_WINDOW (pdata->window)((((CtkWindow*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((pdata->window)), ((ctk_window_get_type ()))))))
, "CtkProgressBar");
8311 ctk_container_set_border_width (CTK_CONTAINER (pdata->window)((((CtkContainer*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((pdata->window)), ((ctk_container_get_type ()))))))
, 0);
8312
8313 vbox = ctk_box_new (CTK_ORIENTATION_VERTICAL, 5);
8314 ctk_container_set_border_width (CTK_CONTAINER (vbox)((((CtkContainer*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((vbox)), ((ctk_container_get_type ()))))))
, 10);
8315 ctk_box_pack_start (CTK_BOX (content_area)((((CtkBox*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((content_area)), ((ctk_box_get_type ()))))))
, vbox, FALSE(0), TRUE(!(0)), 0);
8316
8317 frame = ctk_frame_new ("Progress");
8318 ctk_box_pack_start (CTK_BOX (vbox)((((CtkBox*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((vbox)), ((ctk_box_get_type ()))))))
, frame, FALSE(0), TRUE(!(0)), 0);
8319
8320 vbox2 = ctk_box_new (CTK_ORIENTATION_VERTICAL, 5);
8321 ctk_container_add (CTK_CONTAINER (frame)((((CtkContainer*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((frame)), ((ctk_container_get_type ()))))))
, vbox2);
8322
8323 pdata->pbar = ctk_progress_bar_new ();
8324 ctk_progress_bar_set_ellipsize (CTK_PROGRESS_BAR (pdata->pbar)((((CtkProgressBar*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((pdata->pbar)), ((ctk_progress_bar_get_type ()))))))
,
8325 PANGO_ELLIPSIZE_MIDDLE);
8326 ctk_widget_set_halign (pdata->pbar, CTK_ALIGN_CENTER);
8327 ctk_widget_set_valign (pdata->pbar, CTK_ALIGN_CENTER);
8328 ctk_box_pack_start (CTK_BOX (vbox2)((((CtkBox*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((vbox2)), ((ctk_box_get_type ()))))))
, pdata->pbar, FALSE(0), FALSE(0), 5);
8329
8330 hbox = ctk_box_new (CTK_ORIENTATION_HORIZONTAL, 5);
8331 ctk_widget_set_halign (hbox, CTK_ALIGN_CENTER);
8332 ctk_widget_set_valign (hbox, CTK_ALIGN_CENTER);
8333 ctk_box_pack_start (CTK_BOX (vbox2)((((CtkBox*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((vbox2)), ((ctk_box_get_type ()))))))
, hbox, FALSE(0), FALSE(0), 5);
8334 label = ctk_label_new ("Label updated by user :");
8335 ctk_box_pack_start (CTK_BOX (hbox)((((CtkBox*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((hbox)), ((ctk_box_get_type ()))))))
, label, FALSE(0), TRUE(!(0)), 0);
8336 pdata->label = ctk_label_new ("");
8337 ctk_box_pack_start (CTK_BOX (hbox)((((CtkBox*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((hbox)), ((ctk_box_get_type ()))))))
, pdata->label, FALSE(0), TRUE(!(0)), 0);
8338
8339 frame = ctk_frame_new ("Options");
8340 ctk_box_pack_start (CTK_BOX (vbox)((((CtkBox*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((vbox)), ((ctk_box_get_type ()))))))
, frame, FALSE(0), TRUE(!(0)), 0);
8341
8342 vbox2 = ctk_box_new (CTK_ORIENTATION_VERTICAL, 5);
8343 ctk_container_add (CTK_CONTAINER (frame)((((CtkContainer*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((frame)), ((ctk_container_get_type ()))))))
, vbox2);
8344
8345 grid = ctk_grid_new ();
8346 ctk_grid_set_row_spacing (CTK_GRID (grid)((((CtkGrid*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((grid)), ((ctk_grid_get_type ()))))))
, 10);
8347 ctk_grid_set_column_spacing (CTK_GRID (grid)((((CtkGrid*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((grid)), ((ctk_grid_get_type ()))))))
, 10);
8348 ctk_box_pack_start (CTK_BOX (vbox2)((((CtkBox*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((vbox2)), ((ctk_box_get_type ()))))))
, grid, FALSE(0), TRUE(!(0)), 0);
8349
8350 label = ctk_label_new ("Orientation :");
8351 ctk_grid_attach (CTK_GRID (grid)((((CtkGrid*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((grid)), ((ctk_grid_get_type ()))))))
, label, 0, 0, 1, 1);
8352 ctk_widget_set_halign (label, CTK_ALIGN_START);
8353 ctk_widget_set_valign (label, CTK_ALIGN_CENTER);
8354
8355 pdata->omenu1 = build_option_menu (items1, 4, 0,
8356 progressbar_toggle_orientation,
8357 pdata);
8358 ctk_grid_attach (CTK_GRID (grid)((((CtkGrid*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((grid)), ((ctk_grid_get_type ()))))))
, pdata->omenu1, 1, 0, 1, 1);
8359
8360 check = ctk_check_button_new_with_label ("Running");
8361 g_signal_connect (check, "toggled",g_signal_connect_data ((check), ("toggled"), (((GCallback) (toggle_running
))), (pdata), ((void*)0), (GConnectFlags) 0)
8362 G_CALLBACK (toggle_running),g_signal_connect_data ((check), ("toggled"), (((GCallback) (toggle_running
))), (pdata), ((void*)0), (GConnectFlags) 0)
8363 pdata)g_signal_connect_data ((check), ("toggled"), (((GCallback) (toggle_running
))), (pdata), ((void*)0), (GConnectFlags) 0)
;
8364 ctk_grid_attach (CTK_GRID (grid)((((CtkGrid*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((grid)), ((ctk_grid_get_type ()))))))
, check, 0, 1, 2, 1);
8365 ctk_toggle_button_set_active (CTK_TOGGLE_BUTTON (check)((((CtkToggleButton*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((check)), ((ctk_toggle_button_get_type ()))))))
, TRUE(!(0)));
8366
8367 check = ctk_check_button_new_with_label ("Show text");
8368 g_signal_connect (check, "clicked",g_signal_connect_data ((check), ("clicked"), (((GCallback) (toggle_show_text
))), (pdata), ((void*)0), (GConnectFlags) 0)
8369 G_CALLBACK (toggle_show_text),g_signal_connect_data ((check), ("clicked"), (((GCallback) (toggle_show_text
))), (pdata), ((void*)0), (GConnectFlags) 0)
8370 pdata)g_signal_connect_data ((check), ("clicked"), (((GCallback) (toggle_show_text
))), (pdata), ((void*)0), (GConnectFlags) 0)
;
8371 ctk_grid_attach (CTK_GRID (grid)((((CtkGrid*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((grid)), ((ctk_grid_get_type ()))))))
, check, 0, 2, 1, 1);
8372
8373 hbox = ctk_box_new (CTK_ORIENTATION_HORIZONTAL, 0);
8374 ctk_grid_attach (CTK_GRID (grid)((((CtkGrid*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((grid)), ((ctk_grid_get_type ()))))))
, hbox, 1, 2, 1, 1);
8375
8376 label = ctk_label_new ("Text: ");
8377 ctk_box_pack_start (CTK_BOX (hbox)((((CtkBox*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((hbox)), ((ctk_box_get_type ()))))))
, label, FALSE(0), TRUE(!(0)), 0);
8378
8379 pdata->entry = ctk_entry_new ();
8380 ctk_widget_set_hexpand (pdata->entry, TRUE(!(0)));
8381 g_signal_connect (pdata->entry, "changed",g_signal_connect_data ((pdata->entry), ("changed"), (((GCallback
) (entry_changed))), (pdata), ((void*)0), (GConnectFlags) 0)
8382 G_CALLBACK (entry_changed),g_signal_connect_data ((pdata->entry), ("changed"), (((GCallback
) (entry_changed))), (pdata), ((void*)0), (GConnectFlags) 0)
8383 pdata)g_signal_connect_data ((pdata->entry), ("changed"), (((GCallback
) (entry_changed))), (pdata), ((void*)0), (GConnectFlags) 0)
;
8384 ctk_box_pack_start (CTK_BOX (hbox)((((CtkBox*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((hbox)), ((ctk_box_get_type ()))))))
, pdata->entry, TRUE(!(0)), TRUE(!(0)), 0);
8385 ctk_widget_set_size_request (pdata->entry, 100, -1);
8386
8387 label = ctk_label_new ("Ellipsize text :");
8388 ctk_grid_attach (CTK_GRID (grid)((((CtkGrid*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((grid)), ((ctk_grid_get_type ()))))))
, label, 0, 10, 1, 1);
8389
8390 ctk_widget_set_halign (label, CTK_ALIGN_START);
8391 ctk_widget_set_valign (label, CTK_ALIGN_CENTER);
8392 pdata->elmenu = build_option_menu (ellipsize_items,
8393 sizeof (ellipsize_items) / sizeof (ellipsize_items[0]),
8394 2, // PANGO_ELLIPSIZE_MIDDLE
8395 progressbar_toggle_ellipsize,
8396 pdata);
8397 ctk_grid_attach (CTK_GRID (grid)((((CtkGrid*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((grid)), ((ctk_grid_get_type ()))))))
, pdata->elmenu, 1, 10, 1, 1);
8398
8399 check = ctk_check_button_new_with_label ("Activity mode");
8400 g_signal_connect (check, "clicked",g_signal_connect_data ((check), ("clicked"), (((GCallback) (toggle_activity_mode
))), (pdata), ((void*)0), (GConnectFlags) 0)
8401 G_CALLBACK (toggle_activity_mode), pdata)g_signal_connect_data ((check), ("clicked"), (((GCallback) (toggle_activity_mode
))), (pdata), ((void*)0), (GConnectFlags) 0)
;
8402 ctk_grid_attach (CTK_GRID (grid)((((CtkGrid*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((grid)), ((ctk_grid_get_type ()))))))
, check, 0, 15, 1, 1);
8403
8404 ctk_dialog_add_button (CTK_DIALOG (pdata->window)((((CtkDialog*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((pdata->window)), ((ctk_dialog_get_type ()))))))
, "Close", CTK_RESPONSE_CLOSE);
8405 g_signal_connect (pdata->window, "response",g_signal_connect_data ((pdata->window), ("response"), (((GCallback
) (ctk_widget_destroy))), (((void*)0)), ((void*)0), (GConnectFlags
) 0)
8406 G_CALLBACK (ctk_widget_destroy),g_signal_connect_data ((pdata->window), ("response"), (((GCallback
) (ctk_widget_destroy))), (((void*)0)), ((void*)0), (GConnectFlags
) 0)
8407 NULL)g_signal_connect_data ((pdata->window), ("response"), (((GCallback
) (ctk_widget_destroy))), (((void*)0)), ((void*)0), (GConnectFlags
) 0)
;
8408 }
8409
8410 if (!ctk_widget_get_visible (pdata->window))
8411 ctk_widget_show_all (pdata->window);
8412 else
8413 ctk_widget_destroy (pdata->window);
8414}
8415
8416/*
8417 * Properties
8418 */
8419
8420typedef struct {
8421 int x;
8422 int y;
8423 gboolean found;
8424 gboolean first;
8425 CtkWidget *res_widget;
8426} FindWidgetData;
8427
8428static void
8429find_widget (CtkWidget *widget, FindWidgetData *data)
8430{
8431 CtkAllocation new_allocation;
8432 gint x_offset = 0;
8433 gint y_offset = 0;
8434
8435 ctk_widget_get_allocation (widget, &new_allocation);
8436
8437 if (data->found || !ctk_widget_get_mapped (widget))
8438 return;
8439
8440 /* Note that in the following code, we only count the
8441 * position as being inside a WINDOW widget if it is inside
8442 * widget->window; points that are outside of widget->window
8443 * but within the allocation are not counted. This is consistent
8444 * with the way we highlight drag targets.
8445 */
8446 if (ctk_widget_get_has_window (widget))
8447 {
8448 new_allocation.x = 0;
8449 new_allocation.y = 0;
8450 }
8451
8452 if (ctk_widget_get_parent (widget) && !data->first)
8453 {
8454 CdkWindow *window = ctk_widget_get_window (widget);
8455 while (window != ctk_widget_get_window (ctk_widget_get_parent (widget)))
8456 {
8457 gint tx, ty, twidth, theight;
8458
8459 twidth = cdk_window_get_width (window);
8460 theight = cdk_window_get_height (window);
8461
8462 if (new_allocation.x < 0)
8463 {
8464 new_allocation.width += new_allocation.x;
8465 new_allocation.x = 0;
8466 }
8467 if (new_allocation.y < 0)
8468 {
8469 new_allocation.height += new_allocation.y;
8470 new_allocation.y = 0;
8471 }
8472 if (new_allocation.x + new_allocation.width > twidth)
8473 new_allocation.width = twidth - new_allocation.x;
8474 if (new_allocation.y + new_allocation.height > theight)
8475 new_allocation.height = theight - new_allocation.y;
8476
8477 cdk_window_get_position (window, &tx, &ty);
8478 new_allocation.x += tx;
8479 x_offset += tx;
8480 new_allocation.y += ty;
8481 y_offset += ty;
8482
8483 window = cdk_window_get_parent (window);
8484 }
8485 }
8486
8487 if ((data->x >= new_allocation.x) && (data->y >= new_allocation.y) &&
8488 (data->x < new_allocation.x + new_allocation.width) &&
8489 (data->y < new_allocation.y + new_allocation.height))
8490 {
8491 /* First, check if the drag is in a valid drop site in
8492 * one of our children
8493 */
8494 if (CTK_IS_CONTAINER (widget)(((__extension__ ({ GTypeInstance *__inst = (GTypeInstance*) (
(widget)); GType __t = ((ctk_container_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; }))))
)
8495 {
8496 FindWidgetData new_data = *data;
8497
8498 new_data.x -= x_offset;
8499 new_data.y -= y_offset;
8500 new_data.found = FALSE(0);
8501 new_data.first = FALSE(0);
8502
8503 ctk_container_forall (CTK_CONTAINER (widget)((((CtkContainer*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((widget)), ((ctk_container_get_type ()))))))
,
8504 (CtkCallback)find_widget,
8505 &new_data);
8506
8507 data->found = new_data.found;
8508 if (data->found)
8509 data->res_widget = new_data.res_widget;
8510 }
8511
8512 /* If not, and this widget is registered as a drop site, check to
8513 * emit "drag_motion" to check if we are actually in
8514 * a drop site.
8515 */
8516 if (!data->found)
8517 {
8518 data->found = TRUE(!(0));
8519 data->res_widget = widget;
8520 }
8521 }
8522}
8523
8524static CtkWidget *
8525find_widget_at_pointer (CdkDevice *device)
8526{
8527 CtkWidget *widget = NULL((void*)0);
8528 CdkWindow *pointer_window;
8529 gint x, y;
8530 FindWidgetData data;
8531
8532 pointer_window = cdk_device_get_window_at_position (device, NULL((void*)0), NULL((void*)0));
8533
8534 if (pointer_window)
8535 {
8536 gpointer widget_ptr;
8537
8538 cdk_window_get_user_data (pointer_window, &widget_ptr);
8539 widget = widget_ptr;
8540 }
8541
8542 if (widget)
8543 {
8544 cdk_window_get_device_position (ctk_widget_get_window (widget),
8545 device,
8546 &x, &y, NULL((void*)0));
8547
8548 data.x = x;
8549 data.y = y;
8550 data.found = FALSE(0);
8551 data.first = TRUE(!(0));
8552
8553 find_widget (widget, &data);
8554 if (data.found)
8555 return data.res_widget;
8556 return widget;
8557 }
8558 return NULL((void*)0);
8559}
8560
8561struct SnapshotData {
8562 CtkWidget *toplevel_button;
8563 CtkWidget **window;
8564 CdkCursor *cursor;
8565 gboolean in_query;
8566 gboolean is_toplevel;
8567 gint handler;
8568};
8569
8570static void
8571destroy_snapshot_data (CtkWidget *widget,
8572 struct SnapshotData *data)
8573{
8574 if (*data->window)
8575 *data->window = NULL((void*)0);
8576
8577 if (data->cursor)
8578 {
8579 g_object_unref (data->cursor);
8580 data->cursor = NULL((void*)0);
8581 }
8582
8583 if (data->handler)
8584 {
8585 g_signal_handler_disconnect (widget, data->handler);
8586 data->handler = 0;
8587 }
8588
8589 g_free (data);
8590}
8591
8592static gint
8593snapshot_widget_event (CtkWidget *widget,
8594 CdkEvent *event,
8595 struct SnapshotData *data)
8596{
8597 CtkWidget *res_widget = NULL((void*)0);
8598
8599 if (!data->in_query)
8600 return FALSE(0);
8601
8602 if (event->type == CDK_BUTTON_RELEASE)
8603 {
8604 ctk_grab_remove (widget);
8605 cdk_seat_ungrab (cdk_event_get_seat (event));
8606
8607 res_widget = find_widget_at_pointer (cdk_event_get_device (event));
8608 if (data->is_toplevel && res_widget)
8609 res_widget = ctk_widget_get_toplevel (res_widget);
8610 if (res_widget)
8611 {
8612 cairo_surface_t *surface;
8613 CtkWidget *window, *image;
8614 GdkPixbuf *pixbuf;
8615 int width, height;
8616 cairo_t *cr;
8617
8618 width = ctk_widget_get_allocated_width (res_widget);
8619 height = ctk_widget_get_allocated_height (res_widget);
8620
8621 surface = cairo_image_surface_create (CAIRO_FORMAT_ARGB32, width, height);
8622
8623 cr = cairo_create (surface);
8624 ctk_widget_draw (res_widget, cr);
8625 cairo_destroy (cr);
8626
8627 pixbuf = gdk_pixbuf_get_from_surface (surface,
8628 0, 0,
8629 width, height);
8630 cairo_surface_destroy (surface);
8631
8632 window = ctk_window_new (CTK_WINDOW_TOPLEVEL);
8633 image = ctk_image_new_from_pixbuf (pixbuf);
8634 g_object_unref (pixbuf);
8635
8636 ctk_container_add (CTK_CONTAINER (window)((((CtkContainer*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((window)), ((ctk_container_get_type ()))))))
, image);
8637 ctk_widget_show_all (window);
8638 }
8639
8640 data->in_query = FALSE(0);
8641 }
8642 return FALSE(0);
8643}
8644
8645
8646static void
8647snapshot_widget (CtkButton *button,
8648 struct SnapshotData *data)
8649{
8650 CtkWidget *widget = CTK_WIDGET (button)((((CtkWidget*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((button)), ((ctk_widget_get_type ()))))))
;
8651 CdkDevice *device;
8652
8653 device = ctk_get_current_event_device ();
8654 if (device == NULL((void*)0))
8655 return;
8656
8657 data->is_toplevel = widget == data->toplevel_button;
8658
8659 if (!data->cursor)
8660 data->cursor = cdk_cursor_new_for_display (ctk_widget_get_display (widget),
8661 CDK_TARGET);
8662
8663 cdk_seat_grab (cdk_device_get_seat (device),
8664 ctk_widget_get_window (widget),
8665 CDK_SEAT_CAPABILITY_ALL_POINTING,
8666 TRUE(!(0)), data->cursor, NULL((void*)0), NULL((void*)0), NULL((void*)0));
8667
8668 g_signal_connect (button, "event",g_signal_connect_data ((button), ("event"), (((GCallback) (snapshot_widget_event
))), (data), ((void*)0), (GConnectFlags) 0)
8669 G_CALLBACK (snapshot_widget_event), data)g_signal_connect_data ((button), ("event"), (((GCallback) (snapshot_widget_event
))), (data), ((void*)0), (GConnectFlags) 0)
;
8670
8671 ctk_grab_add (widget);
8672
8673 data->in_query = TRUE(!(0));
8674}
8675
8676static void
8677create_snapshot (CtkWidget *widget)
8678{
8679 static CtkWidget *window = NULL((void*)0);
8680 struct SnapshotData *data;
8681
8682 data = g_new (struct SnapshotData, 1)((struct SnapshotData *) g_malloc_n ((1), sizeof (struct SnapshotData
)))
;
8683 data->window = &window;
8684 data->in_query = FALSE(0);
8685 data->cursor = NULL((void*)0);
8686 data->handler = 0;
8687
8688 if (!window)
8689 {
8690 CtkWidget *button;
8691 CtkWidget *vbox;
8692
8693 window = ctk_window_new (CTK_WINDOW_TOPLEVEL);
8694
8695 ctk_window_set_screen (CTK_WINDOW (window)((((CtkWindow*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((window)), ((ctk_window_get_type ()))))))
,
8696 ctk_widget_get_screen (widget));
8697
8698 data->handler = g_signal_connect (window, "destroy",g_signal_connect_data ((window), ("destroy"), (((GCallback) (
destroy_snapshot_data))), (data), ((void*)0), (GConnectFlags)
0)
8699 G_CALLBACK (destroy_snapshot_data),g_signal_connect_data ((window), ("destroy"), (((GCallback) (
destroy_snapshot_data))), (data), ((void*)0), (GConnectFlags)
0)
8700 data)g_signal_connect_data ((window), ("destroy"), (((GCallback) (
destroy_snapshot_data))), (data), ((void*)0), (GConnectFlags)
0)
;
8701
8702 ctk_window_set_title (CTK_WINDOW (window)((((CtkWindow*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((window)), ((ctk_window_get_type ()))))))
, "test snapshot");
8703 ctk_container_set_border_width (CTK_CONTAINER (window)((((CtkContainer*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((window)), ((ctk_container_get_type ()))))))
, 10);
8704
8705 vbox = ctk_box_new (CTK_ORIENTATION_VERTICAL, 1);
8706 ctk_container_add (CTK_CONTAINER (window)((((CtkContainer*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((window)), ((ctk_container_get_type ()))))))
, vbox);
8707
8708 button = ctk_button_new_with_label ("Snapshot widget");
8709 ctk_box_pack_start (CTK_BOX (vbox)((((CtkBox*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((vbox)), ((ctk_box_get_type ()))))))
, button, TRUE(!(0)), TRUE(!(0)), 0);
8710 g_signal_connect (button, "clicked",g_signal_connect_data ((button), ("clicked"), (((GCallback) (
snapshot_widget))), (data), ((void*)0), (GConnectFlags) 0)
8711 G_CALLBACK (snapshot_widget),g_signal_connect_data ((button), ("clicked"), (((GCallback) (
snapshot_widget))), (data), ((void*)0), (GConnectFlags) 0)
8712 data)g_signal_connect_data ((button), ("clicked"), (((GCallback) (
snapshot_widget))), (data), ((void*)0), (GConnectFlags) 0)
;
8713
8714 button = ctk_button_new_with_label ("Snapshot toplevel");
8715 data->toplevel_button = button;
8716 ctk_box_pack_start (CTK_BOX (vbox)((((CtkBox*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((vbox)), ((ctk_box_get_type ()))))))
, button, TRUE(!(0)), TRUE(!(0)), 0);
8717 g_signal_connect (button, "clicked",g_signal_connect_data ((button), ("clicked"), (((GCallback) (
snapshot_widget))), (data), ((void*)0), (GConnectFlags) 0)
8718 G_CALLBACK (snapshot_widget),g_signal_connect_data ((button), ("clicked"), (((GCallback) (
snapshot_widget))), (data), ((void*)0), (GConnectFlags) 0)
8719 data)g_signal_connect_data ((button), ("clicked"), (((GCallback) (
snapshot_widget))), (data), ((void*)0), (GConnectFlags) 0)
;
8720 }
8721
8722 if (!ctk_widget_get_visible (window))
8723 ctk_widget_show_all (window);
8724 else
8725 ctk_widget_destroy (window);
8726
8727}
8728
8729/*
8730 * Selection Test
8731 */
8732
8733void
8734selection_test_received (CtkWidget *tree_view,
8735 CtkSelectionData *selection_data)
8736{
8737 CtkTreeModel *model;
8738 CtkListStore *store;
8739 CdkAtom *atoms;
8740 int i, l;
8741
8742 if (ctk_selection_data_get_length (selection_data) < 0)
8743 {
8744 g_print ("Selection retrieval failed\n");
8745 return;
8746 }
8747 if (ctk_selection_data_get_data_type (selection_data) != CDK_SELECTION_TYPE_ATOM((CdkAtom)((gpointer) (gulong) (4))))
8748 {
8749 g_print ("Selection \"TARGETS\" was not returned as atoms!\n");
8750 return;
8751 }
8752
8753 /* Clear out any current list items */
8754
8755 model = ctk_tree_view_get_model (CTK_TREE_VIEW (tree_view)((((CtkTreeView*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((tree_view)), ((ctk_tree_view_get_type ()))))))
);
8756 store = CTK_LIST_STORE (model)((((CtkListStore*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((model)), ((ctk_list_store_get_type ()))))))
;
8757 ctk_list_store_clear (store);
8758
8759 /* Add new items to list */
8760
8761 ctk_selection_data_get_targets (selection_data,
8762 &atoms, &l);
8763
8764 for (i = 0; i < l; i++)
8765 {
8766 char *name;
8767 CtkTreeIter iter;
8768
8769 name = cdk_atom_name (atoms[i]);
8770 if (name != NULL((void*)0))
8771 {
8772 ctk_list_store_insert_with_values (store, &iter, i, 0, name, -1);
8773 g_free (name);
8774 }
8775 else
8776 ctk_list_store_insert_with_values (store, &iter, i, 0, "(bad atom)", -1);
8777 }
8778
8779 return;
8780}
8781
8782void
8783selection_test_get_targets (CtkWidget *dialog, gint response, CtkWidget *tree_view)
8784{
8785 static CdkAtom targets_atom = CDK_NONE((CdkAtom)((gpointer) (gulong) (0)));
8786
8787 if (response != CTK_RESPONSE_APPLY)
8788 {
8789 ctk_widget_destroy (dialog);
8790 return;
8791 }
8792
8793 if (targets_atom == CDK_NONE((CdkAtom)((gpointer) (gulong) (0))))
8794 targets_atom = cdk_atom_intern ("TARGETS", FALSE(0));
8795
8796 ctk_selection_convert (tree_view, CDK_SELECTION_PRIMARY((CdkAtom)((gpointer) (gulong) (1))), targets_atom,
8797 CDK_CURRENT_TIME0L);
8798}
8799
8800void
8801create_selection_test (CtkWidget *widget)
8802{
8803 static CtkWidget *window = NULL((void*)0);
8804
8805 if (!window)
8806 {
8807 CtkWidget *content_area;
8808 CtkWidget *vbox;
8809 CtkWidget *scrolled_win;
8810 CtkListStore* store;
8811 CtkWidget *tree_view;
8812 CtkTreeViewColumn *column;
8813 CtkCellRenderer *renderer;
8814 CtkWidget *label;
8815
8816 window = ctk_dialog_new ();
8817
8818 ctk_window_set_screen (CTK_WINDOW (window)((((CtkWindow*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((window)), ((ctk_window_get_type ()))))))
,
8819 ctk_widget_get_screen (widget));
8820
8821 g_signal_connect (window, "destroy",g_signal_connect_data ((window), ("destroy"), (((GCallback) (
ctk_widget_destroyed))), (&window), ((void*)0), (GConnectFlags
) 0)
8822 G_CALLBACK (ctk_widget_destroyed),g_signal_connect_data ((window), ("destroy"), (((GCallback) (
ctk_widget_destroyed))), (&window), ((void*)0), (GConnectFlags
) 0)
8823 &window)g_signal_connect_data ((window), ("destroy"), (((GCallback) (
ctk_widget_destroyed))), (&window), ((void*)0), (GConnectFlags
) 0)
;
8824
8825 content_area = ctk_dialog_get_content_area (CTK_DIALOG (window)((((CtkDialog*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((window)), ((ctk_dialog_get_type ()))))))
);
8826
8827 ctk_window_set_title (CTK_WINDOW (window)((((CtkWindow*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((window)), ((ctk_window_get_type ()))))))
, "Selection Test");
8828 ctk_container_set_border_width (CTK_CONTAINER (window)((((CtkContainer*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((window)), ((ctk_container_get_type ()))))))
, 0);
8829
8830 /* Create the list */
8831
8832 vbox = ctk_box_new (CTK_ORIENTATION_VERTICAL, 5);
8833 ctk_container_set_border_width (CTK_CONTAINER (vbox)((((CtkContainer*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((vbox)), ((ctk_container_get_type ()))))))
, 10);
8834 ctk_box_pack_start (CTK_BOX (content_area)((((CtkBox*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((content_area)), ((ctk_box_get_type ()))))))
, vbox, TRUE(!(0)), TRUE(!(0)), 0);
8835
8836 label = ctk_label_new ("Gets available targets for current selection");
8837 ctk_box_pack_start (CTK_BOX (vbox)((((CtkBox*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((vbox)), ((ctk_box_get_type ()))))))
, label, FALSE(0), FALSE(0), 0);
8838
8839 scrolled_win = ctk_scrolled_window_new (NULL((void*)0), NULL((void*)0));
8840 ctk_scrolled_window_set_policy (CTK_SCROLLED_WINDOW (scrolled_win)((((CtkScrolledWindow*) (void *) g_type_check_instance_cast (
(GTypeInstance*) ((scrolled_win)), ((ctk_scrolled_window_get_type
()))))))
,
8841 CTK_POLICY_AUTOMATIC,
8842 CTK_POLICY_AUTOMATIC);
8843 ctk_box_pack_start (CTK_BOX (vbox)((((CtkBox*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((vbox)), ((ctk_box_get_type ()))))))
, scrolled_win, TRUE(!(0)), TRUE(!(0)), 0);
8844 ctk_widget_set_size_request (scrolled_win, 100, 200);
8845
8846 store = ctk_list_store_new (1, G_TYPE_STRING((GType) ((16) << (2))));
8847 tree_view = ctk_tree_view_new_with_model (CTK_TREE_MODEL (store)((((CtkTreeModel*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((store)), ((ctk_tree_model_get_type ()))))))
);
8848 ctk_container_add (CTK_CONTAINER (scrolled_win)((((CtkContainer*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((scrolled_win)), ((ctk_container_get_type ()))))))
, tree_view);
8849
8850 renderer = ctk_cell_renderer_text_new ();
8851 column = ctk_tree_view_column_new_with_attributes ("Target", renderer,
8852 "text", 0, NULL((void*)0));
8853 ctk_tree_view_append_column (CTK_TREE_VIEW (tree_view)((((CtkTreeView*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((tree_view)), ((ctk_tree_view_get_type ()))))))
, column);
8854
8855 g_signal_connect (tree_view, "selection_received",g_signal_connect_data ((tree_view), ("selection_received"), (
((GCallback) (selection_test_received))), (((void*)0)), ((void
*)0), (GConnectFlags) 0)
8856 G_CALLBACK (selection_test_received), NULL)g_signal_connect_data ((tree_view), ("selection_received"), (
((GCallback) (selection_test_received))), (((void*)0)), ((void
*)0), (GConnectFlags) 0)
;
8857
8858 /* .. And create some buttons */
8859 ctk_dialog_add_button (CTK_DIALOG (window)((((CtkDialog*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((window)), ((ctk_dialog_get_type ()))))))
,
8860 "Get Targets",
8861 CTK_RESPONSE_APPLY);
8862
8863 g_signal_connect (window, "response",g_signal_connect_data ((window), ("response"), (((GCallback) (
selection_test_get_targets))), (tree_view), ((void*)0), (GConnectFlags
) 0)
8864 G_CALLBACK (selection_test_get_targets), tree_view)g_signal_connect_data ((window), ("response"), (((GCallback) (
selection_test_get_targets))), (tree_view), ((void*)0), (GConnectFlags
) 0)
;
8865
8866 ctk_dialog_add_button (CTK_DIALOG (window)((((CtkDialog*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((window)), ((ctk_dialog_get_type ()))))))
,
8867 "Quit",
8868 CTK_RESPONSE_CLOSE);
8869 }
8870
8871 if (!ctk_widget_get_visible (window))
8872 ctk_widget_show_all (window);
8873 else
8874 ctk_widget_destroy (window);
8875}
8876
8877/*
8878 * Test scrolling
8879 */
8880
8881static int scroll_test_pos = 0.0;
8882
8883static gint
8884scroll_test_draw (CtkWidget *widget G_GNUC_UNUSED__attribute__ ((__unused__)),
8885 cairo_t *cr,
8886 CtkAdjustment *adjustment)
8887{
8888 gint i,j;
8889 gint imin, imax, jmin, jmax;
8890 CdkRectangle clip;
8891
8892 cdk_cairo_get_clip_rectangle (cr, &clip);
8893
8894 imin = (clip.x) / 10;
8895 imax = (clip.x + clip.width + 9) / 10;
8896
8897 jmin = ((int)ctk_adjustment_get_value (adjustment) + clip.y) / 10;
8898 jmax = ((int)ctk_adjustment_get_value (adjustment) + clip.y + clip.height + 9) / 10;
8899
8900 for (i=imin; i<imax; i++)
8901 for (j=jmin; j<jmax; j++)
8902 if ((i+j) % 2)
8903 cairo_rectangle (cr, 10*i, 10*j - (int)ctk_adjustment_get_value (adjustment), 1+i%10, 1+j%10);
8904
8905 cairo_fill (cr);
8906
8907 return TRUE(!(0));
8908}
8909
8910static gint
8911scroll_test_scroll (CtkWidget *widget G_GNUC_UNUSED__attribute__ ((__unused__)),
8912 CdkEventScroll *event,
8913 CtkAdjustment *adjustment)
8914{
8915 gdouble new_value = ctk_adjustment_get_value (adjustment) + ((event->direction == CDK_SCROLL_UP) ?
8916 -ctk_adjustment_get_page_increment (adjustment) / 2:
8917 ctk_adjustment_get_page_increment (adjustment) / 2);
8918 new_value = CLAMP (new_value, ctk_adjustment_get_lower (adjustment), ctk_adjustment_get_upper (adjustment) - ctk_adjustment_get_page_size (adjustment))(((new_value) > (ctk_adjustment_get_upper (adjustment) - ctk_adjustment_get_page_size
(adjustment))) ? (ctk_adjustment_get_upper (adjustment) - ctk_adjustment_get_page_size
(adjustment)) : (((new_value) < (ctk_adjustment_get_lower
(adjustment))) ? (ctk_adjustment_get_lower (adjustment)) : (
new_value)))
;
8919 ctk_adjustment_set_value (adjustment, new_value);
8920
8921 return TRUE(!(0));
8922}
8923
8924static void
8925scroll_test_configure (CtkWidget *widget,
8926 CdkEventConfigure *event G_GNUC_UNUSED__attribute__ ((__unused__)),
8927 CtkAdjustment *adjustment)
8928{
8929 CtkAllocation allocation;
8930
8931 ctk_widget_get_allocation (widget, &allocation);
8932 ctk_adjustment_configure (adjustment,
8933 ctk_adjustment_get_value (adjustment),
8934 ctk_adjustment_get_lower (adjustment),
8935 ctk_adjustment_get_upper (adjustment),
8936 0.1 * allocation.height,
8937 0.9 * allocation.height,
8938 allocation.height);
8939}
8940
8941static void
8942scroll_test_adjustment_changed (CtkAdjustment *adjustment, CtkWidget *widget)
8943{
8944 CdkWindow *window;
8945 gint dy;
8946
8947 dy = scroll_test_pos - (int)ctk_adjustment_get_value (adjustment);
8948 scroll_test_pos = ctk_adjustment_get_value (adjustment);
8949
8950 if (!ctk_widget_is_drawable (widget))
8951 return;
8952
8953 window = ctk_widget_get_window (widget);
8954 cdk_window_scroll (window, 0, dy);
8955 cdk_window_process_updates (window, FALSE(0));
8956}
8957
8958
8959void
8960create_scroll_test (CtkWidget *widget)
8961{
8962 static CtkWidget *window = NULL((void*)0);
8963
8964 if (!window)
8965 {
8966 CtkWidget *content_area;
8967 CtkWidget *hbox;
8968 CtkWidget *drawing_area;
8969 CtkWidget *scrollbar;
8970 CtkAdjustment *adjustment;
8971 CdkGeometry geometry;
8972 CdkWindowHints geometry_mask;
8973
8974 window = ctk_dialog_new ();
8975
8976 ctk_window_set_screen (CTK_WINDOW (window)((((CtkWindow*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((window)), ((ctk_window_get_type ()))))))
,
8977 ctk_widget_get_screen (widget));
8978
8979 g_signal_connect (window, "destroy",g_signal_connect_data ((window), ("destroy"), (((GCallback) (
ctk_widget_destroyed))), (&window), ((void*)0), (GConnectFlags
) 0)
8980 G_CALLBACK (ctk_widget_destroyed),g_signal_connect_data ((window), ("destroy"), (((GCallback) (
ctk_widget_destroyed))), (&window), ((void*)0), (GConnectFlags
) 0)
8981 &window)g_signal_connect_data ((window), ("destroy"), (((GCallback) (
ctk_widget_destroyed))), (&window), ((void*)0), (GConnectFlags
) 0)
;
8982
8983 content_area = ctk_dialog_get_content_area (CTK_DIALOG (window)((((CtkDialog*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((window)), ((ctk_dialog_get_type ()))))))
);
8984
8985 ctk_window_set_title (CTK_WINDOW (window)((((CtkWindow*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((window)), ((ctk_window_get_type ()))))))
, "Scroll Test");
8986 ctk_container_set_border_width (CTK_CONTAINER (window)((((CtkContainer*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((window)), ((ctk_container_get_type ()))))))
, 0);
8987
8988 hbox = ctk_box_new (CTK_ORIENTATION_HORIZONTAL, 0);
8989 ctk_box_pack_start (CTK_BOX (content_area)((((CtkBox*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((content_area)), ((ctk_box_get_type ()))))))
, hbox, TRUE(!(0)), TRUE(!(0)), 0);
8990 ctk_widget_show (hbox);
8991
8992 drawing_area = ctk_drawing_area_new ();
8993 ctk_widget_set_size_request (drawing_area, 200, 200);
8994 ctk_box_pack_start (CTK_BOX (hbox)((((CtkBox*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((hbox)), ((ctk_box_get_type ()))))))
, drawing_area, TRUE(!(0)), TRUE(!(0)), 0);
8995 ctk_widget_show (drawing_area);
8996
8997 ctk_widget_set_events (drawing_area, CDK_EXPOSURE_MASK | CDK_SCROLL_MASK);
8998
8999 adjustment = ctk_adjustment_new (0.0, 0.0, 1000.0, 1.0, 180.0, 200.0);
9000 scroll_test_pos = 0.0;
9001
9002 scrollbar = ctk_scrollbar_new (CTK_ORIENTATION_VERTICAL, adjustment);
9003 ctk_box_pack_start (CTK_BOX (hbox)((((CtkBox*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((hbox)), ((ctk_box_get_type ()))))))
, scrollbar, FALSE(0), FALSE(0), 0);
9004 ctk_widget_show (scrollbar);
9005
9006 g_signal_connect (drawing_area, "draw",g_signal_connect_data ((drawing_area), ("draw"), (((GCallback
) (scroll_test_draw))), (adjustment), ((void*)0), (GConnectFlags
) 0)
9007 G_CALLBACK (scroll_test_draw), adjustment)g_signal_connect_data ((drawing_area), ("draw"), (((GCallback
) (scroll_test_draw))), (adjustment), ((void*)0), (GConnectFlags
) 0)
;
9008 g_signal_connect (drawing_area, "configure_event",g_signal_connect_data ((drawing_area), ("configure_event"), (
((GCallback) (scroll_test_configure))), (adjustment), ((void*
)0), (GConnectFlags) 0)
9009 G_CALLBACK (scroll_test_configure), adjustment)g_signal_connect_data ((drawing_area), ("configure_event"), (
((GCallback) (scroll_test_configure))), (adjustment), ((void*
)0), (GConnectFlags) 0)
;
9010 g_signal_connect (drawing_area, "scroll_event",g_signal_connect_data ((drawing_area), ("scroll_event"), (((GCallback
) (scroll_test_scroll))), (adjustment), ((void*)0), (GConnectFlags
) 0)
9011 G_CALLBACK (scroll_test_scroll), adjustment)g_signal_connect_data ((drawing_area), ("scroll_event"), (((GCallback
) (scroll_test_scroll))), (adjustment), ((void*)0), (GConnectFlags
) 0)
;
9012
9013 g_signal_connect (adjustment, "value_changed",g_signal_connect_data ((adjustment), ("value_changed"), (((GCallback
) (scroll_test_adjustment_changed))), (drawing_area), ((void*
)0), (GConnectFlags) 0)
9014 G_CALLBACK (scroll_test_adjustment_changed),g_signal_connect_data ((adjustment), ("value_changed"), (((GCallback
) (scroll_test_adjustment_changed))), (drawing_area), ((void*
)0), (GConnectFlags) 0)
9015 drawing_area)g_signal_connect_data ((adjustment), ("value_changed"), (((GCallback
) (scroll_test_adjustment_changed))), (drawing_area), ((void*
)0), (GConnectFlags) 0)
;
9016
9017 /* .. And create some buttons */
9018
9019 ctk_dialog_add_button (CTK_DIALOG (window)((((CtkDialog*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((window)), ((ctk_dialog_get_type ()))))))
,
9020 "Quit",
9021 CTK_RESPONSE_CLOSE);
9022 g_signal_connect_swapped (window, "response",g_signal_connect_data ((window), ("response"), (((GCallback) (
ctk_widget_destroy))), (window), ((void*)0), G_CONNECT_SWAPPED
)
9023 G_CALLBACK (ctk_widget_destroy),g_signal_connect_data ((window), ("response"), (((GCallback) (
ctk_widget_destroy))), (window), ((void*)0), G_CONNECT_SWAPPED
)
9024 window)g_signal_connect_data ((window), ("response"), (((GCallback) (
ctk_widget_destroy))), (window), ((void*)0), G_CONNECT_SWAPPED
)
;
9025
9026 /* Set up gridded geometry */
9027
9028 geometry_mask = CDK_HINT_MIN_SIZE |
9029 CDK_HINT_BASE_SIZE |
9030 CDK_HINT_RESIZE_INC;
9031
9032 geometry.min_width = 20;
9033 geometry.min_height = 20;
9034 geometry.base_width = 0;
9035 geometry.base_height = 0;
9036 geometry.width_inc = 10;
9037 geometry.height_inc = 10;
9038
9039 ctk_window_set_geometry_hints (CTK_WINDOW (window)((((CtkWindow*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((window)), ((ctk_window_get_type ()))))))
,
9040 drawing_area, &geometry, geometry_mask);
9041 }
9042
9043 if (!ctk_widget_get_visible (window))
9044 ctk_widget_show (window);
9045 else
9046 ctk_widget_destroy (window);
9047}
9048
9049/*
9050 * Timeout Test
9051 */
9052
9053static int timer = 0;
9054
9055gint
9056timeout_test (CtkWidget *label)
9057{
9058 static int count = 0;
9059 static char buffer[32];
9060
9061 sprintf (buffer, "count: %d", ++count);
9062 ctk_label_set_text (CTK_LABEL (label)((((CtkLabel*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((label)), ((ctk_label_get_type ()))))))
, buffer);
9063
9064 return TRUE(!(0));
9065}
9066
9067void
9068start_timeout_test (CtkWidget *widget G_GNUC_UNUSED__attribute__ ((__unused__)),
9069 CtkWidget *label)
9070{
9071 if (!timer)
9072 {
9073 timer = g_timeout_add (100, (GSourceFunc)timeout_test, label);
9074 }
9075}
9076
9077void
9078stop_timeout_test (CtkWidget *widget G_GNUC_UNUSED__attribute__ ((__unused__)),
9079 gpointer data G_GNUC_UNUSED__attribute__ ((__unused__)))
9080{
9081 if (timer)
9082 {
9083 g_source_remove (timer);
9084 timer = 0;
9085 }
9086}
9087
9088void
9089destroy_timeout_test (CtkWidget *widget G_GNUC_UNUSED__attribute__ ((__unused__)),
9090 CtkWidget **window)
9091{
9092 stop_timeout_test (NULL((void*)0), NULL((void*)0));
9093
9094 *window = NULL((void*)0);
9095}
9096
9097void
9098create_timeout_test (CtkWidget *widget)
9099{
9100 static CtkWidget *window = NULL((void*)0);
9101
9102 if (!window)
9103 {
9104 CtkWidget *action_area, *content_area;
9105 CtkWidget *button;
9106 CtkWidget *label;
9107
9108 window = ctk_dialog_new ();
9109
9110 ctk_window_set_screen (CTK_WINDOW (window)((((CtkWindow*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((window)), ((ctk_window_get_type ()))))))
,
9111 ctk_widget_get_screen (widget));
9112
9113 g_signal_connect (window, "destroy",g_signal_connect_data ((window), ("destroy"), (((GCallback) (
destroy_timeout_test))), (&window), ((void*)0), (GConnectFlags
) 0)
9114 G_CALLBACK (destroy_timeout_test),g_signal_connect_data ((window), ("destroy"), (((GCallback) (
destroy_timeout_test))), (&window), ((void*)0), (GConnectFlags
) 0)
9115 &window)g_signal_connect_data ((window), ("destroy"), (((GCallback) (
destroy_timeout_test))), (&window), ((void*)0), (GConnectFlags
) 0)
;
9116
9117 content_area = ctk_dialog_get_content_area (CTK_DIALOG (window)((((CtkDialog*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((window)), ((ctk_dialog_get_type ()))))))
);
9118 action_area = ctk_dialog_get_content_area (CTK_DIALOG (window)((((CtkDialog*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((window)), ((ctk_dialog_get_type ()))))))
);
9119
9120 ctk_window_set_title (CTK_WINDOW (window)((((CtkWindow*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((window)), ((ctk_window_get_type ()))))))
, "Timeout Test");
9121 ctk_container_set_border_width (CTK_CONTAINER (window)((((CtkContainer*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((window)), ((ctk_container_get_type ()))))))
, 0);
9122
9123 label = ctk_label_new ("count: 0");
9124 g_object_set (label, "margin", 10, NULL((void*)0));
9125 ctk_box_pack_start (CTK_BOX (content_area)((((CtkBox*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((content_area)), ((ctk_box_get_type ()))))))
, label, TRUE(!(0)), TRUE(!(0)), 0);
9126 ctk_widget_show (label);
9127
9128 button = ctk_button_new_with_label ("close");
9129 g_signal_connect_swapped (button, "clicked",g_signal_connect_data ((button), ("clicked"), (((GCallback) (
ctk_widget_destroy))), (window), ((void*)0), G_CONNECT_SWAPPED
)
9130 G_CALLBACK (ctk_widget_destroy),g_signal_connect_data ((button), ("clicked"), (((GCallback) (
ctk_widget_destroy))), (window), ((void*)0), G_CONNECT_SWAPPED
)
9131 window)g_signal_connect_data ((button), ("clicked"), (((GCallback) (
ctk_widget_destroy))), (window), ((void*)0), G_CONNECT_SWAPPED
)
;
9132 ctk_widget_set_can_default (button, TRUE(!(0)));
9133 ctk_box_pack_start (CTK_BOX (action_area)((((CtkBox*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((action_area)), ((ctk_box_get_type ()))))))
, button, TRUE(!(0)), TRUE(!(0)), 0);
9134 ctk_widget_grab_default (button);
9135 ctk_widget_show (button);
9136
9137 button = ctk_button_new_with_label ("start");
9138 g_signal_connect (button, "clicked",g_signal_connect_data ((button), ("clicked"), (((GCallback) (
start_timeout_test))), (label), ((void*)0), (GConnectFlags) 0
)
9139 G_CALLBACK(start_timeout_test),g_signal_connect_data ((button), ("clicked"), (((GCallback) (
start_timeout_test))), (label), ((void*)0), (GConnectFlags) 0
)
9140 label)g_signal_connect_data ((button), ("clicked"), (((GCallback) (
start_timeout_test))), (label), ((void*)0), (GConnectFlags) 0
)
;
9141 ctk_widget_set_can_default (button, TRUE(!(0)));
9142 ctk_box_pack_start (CTK_BOX (action_area)((((CtkBox*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((action_area)), ((ctk_box_get_type ()))))))
, button, TRUE(!(0)), TRUE(!(0)), 0);
9143 ctk_widget_show (button);
9144
9145 button = ctk_button_new_with_label ("stop");
9146 g_signal_connect (button, "clicked",g_signal_connect_data ((button), ("clicked"), (((GCallback) (
stop_timeout_test))), (((void*)0)), ((void*)0), (GConnectFlags
) 0)
9147 G_CALLBACK (stop_timeout_test),g_signal_connect_data ((button), ("clicked"), (((GCallback) (
stop_timeout_test))), (((void*)0)), ((void*)0), (GConnectFlags
) 0)
9148 NULL)g_signal_connect_data ((button), ("clicked"), (((GCallback) (
stop_timeout_test))), (((void*)0)), ((void*)0), (GConnectFlags
) 0)
;
9149 ctk_widget_set_can_default (button, TRUE(!(0)));
9150 ctk_box_pack_start (CTK_BOX (action_area)((((CtkBox*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((action_area)), ((ctk_box_get_type ()))))))
, button, TRUE(!(0)), TRUE(!(0)), 0);
9151 ctk_widget_show (button);
9152 }
9153
9154 if (!ctk_widget_get_visible (window))
9155 ctk_widget_show (window);
9156 else
9157 ctk_widget_destroy (window);
9158}
9159
9160/*
9161 * Test of recursive mainloop
9162 */
9163
9164void
9165mainloop_destroyed (CtkWidget *w G_GNUC_UNUSED__attribute__ ((__unused__)),
9166 CtkWidget **window)
9167{
9168 *window = NULL((void*)0);
9169 ctk_main_quit ();
9170}
9171
9172void
9173create_mainloop (CtkWidget *widget)
9174{
9175 static CtkWidget *window = NULL((void*)0);
9176
9177 if (!window)
9178 {
9179 CtkWidget *content_area;
9180 CtkWidget *label;
9181
9182 window = ctk_dialog_new ();
9183
9184 ctk_window_set_screen (CTK_WINDOW (window)((((CtkWindow*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((window)), ((ctk_window_get_type ()))))))
,
9185 ctk_widget_get_screen (widget));
9186
9187 ctk_window_set_title (CTK_WINDOW (window)((((CtkWindow*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((window)), ((ctk_window_get_type ()))))))
, "Test Main Loop");
9188
9189 g_signal_connect (window, "destroy",g_signal_connect_data ((window), ("destroy"), (((GCallback) (
mainloop_destroyed))), (&window), ((void*)0), (GConnectFlags
) 0)
9190 G_CALLBACK (mainloop_destroyed),g_signal_connect_data ((window), ("destroy"), (((GCallback) (
mainloop_destroyed))), (&window), ((void*)0), (GConnectFlags
) 0)
9191 &window)g_signal_connect_data ((window), ("destroy"), (((GCallback) (
mainloop_destroyed))), (&window), ((void*)0), (GConnectFlags
) 0)
;
9192
9193 content_area = ctk_dialog_get_content_area (CTK_DIALOG (window)((((CtkDialog*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((window)), ((ctk_dialog_get_type ()))))))
);
9194
9195 label = ctk_label_new ("In recursive main loop...");
9196 g_object_set (label, "margin", 20, NULL((void*)0));
9197
9198 ctk_box_pack_start (CTK_BOX (content_area)((((CtkBox*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((content_area)), ((ctk_box_get_type ()))))))
, label, TRUE(!(0)), TRUE(!(0)), 0);
9199 ctk_widget_show (label);
9200
9201 ctk_dialog_add_button (CTK_DIALOG (window)((((CtkDialog*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((window)), ((ctk_dialog_get_type ()))))))
,
9202 "Leave",
9203 CTK_RESPONSE_OK);
9204 g_signal_connect_swapped (window, "response",g_signal_connect_data ((window), ("response"), (((GCallback) (
ctk_widget_destroy))), (window), ((void*)0), G_CONNECT_SWAPPED
)
9205 G_CALLBACK (ctk_widget_destroy),g_signal_connect_data ((window), ("response"), (((GCallback) (
ctk_widget_destroy))), (window), ((void*)0), G_CONNECT_SWAPPED
)
9206 window)g_signal_connect_data ((window), ("response"), (((GCallback) (
ctk_widget_destroy))), (window), ((void*)0), G_CONNECT_SWAPPED
)
;
9207 }
9208
9209 if (!ctk_widget_get_visible (window))
9210 {
9211 ctk_widget_show (window);
9212
9213 g_print ("create_mainloop: start\n");
9214 ctk_main ();
9215 g_print ("create_mainloop: done\n");
9216 }
9217 else
9218 ctk_widget_destroy (window);
9219}
9220
9221static gboolean
9222layout_draw_handler (CtkWidget *widget, cairo_t *cr)
9223{
9224 CtkLayout *layout;
9225 CdkWindow *bin_window;
9226 CdkRectangle clip;
9227 gint i,j,x,y;
9228 gint imin, imax, jmin, jmax;
9229
9230 layout = CTK_LAYOUT (widget)((((CtkLayout*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((widget)), ((ctk_layout_get_type ()))))))
;
9231 bin_window = ctk_layout_get_bin_window (layout);
9232
9233 if (!ctk_cairo_should_draw_window (cr, bin_window))
9234 return FALSE(0);
9235
9236 cdk_window_get_position (bin_window, &x, &y);
9237 cairo_translate (cr, x, y);
9238
9239 cdk_cairo_get_clip_rectangle (cr, &clip);
9240
9241 imin = (clip.x) / 10;
9242 imax = (clip.x + clip.width + 9) / 10;
9243
9244 jmin = (clip.y) / 10;
9245 jmax = (clip.y + clip.height + 9) / 10;
9246
9247 for (i=imin; i<imax; i++)
9248 for (j=jmin; j<jmax; j++)
9249 if ((i+j) % 2)
9250 cairo_rectangle (cr,
9251 10*i, 10*j,
9252 1+i%10, 1+j%10);
9253
9254 cairo_fill (cr);
9255
9256 return FALSE(0);
9257}
9258
9259void create_layout (CtkWidget *widget)
9260{
9261 static CtkWidget *window = NULL((void*)0);
9262
9263 if (!window)
9264 {
9265 CtkAdjustment *hadjustment, *vadjustment;
9266 CtkLayout *layout;
9267 CtkWidget *layout_widget;
9268 CtkWidget *scrolledwindow;
9269 CtkWidget *button;
9270 gchar buf[16];
9271 gint i, j;
9272
9273 window = ctk_window_new (CTK_WINDOW_TOPLEVEL);
9274 ctk_window_set_screen (CTK_WINDOW (window)((((CtkWindow*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((window)), ((ctk_window_get_type ()))))))
,
9275 ctk_widget_get_screen (widget));
9276
9277 g_signal_connect (window, "destroy",g_signal_connect_data ((window), ("destroy"), (((GCallback) (
ctk_widget_destroyed))), (&window), ((void*)0), (GConnectFlags
) 0)
9278 G_CALLBACK (ctk_widget_destroyed),g_signal_connect_data ((window), ("destroy"), (((GCallback) (
ctk_widget_destroyed))), (&window), ((void*)0), (GConnectFlags
) 0)
9279 &window)g_signal_connect_data ((window), ("destroy"), (((GCallback) (
ctk_widget_destroyed))), (&window), ((void*)0), (GConnectFlags
) 0)
;
9280
9281 ctk_window_set_title (CTK_WINDOW (window)((((CtkWindow*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((window)), ((ctk_window_get_type ()))))))
, "Layout");
9282 ctk_widget_set_size_request (window, 200, 200);
9283
9284 scrolledwindow = ctk_scrolled_window_new (NULL((void*)0), NULL((void*)0));
9285 ctk_scrolled_window_set_shadow_type (CTK_SCROLLED_WINDOW (scrolledwindow)((((CtkScrolledWindow*) (void *) g_type_check_instance_cast (
(GTypeInstance*) ((scrolledwindow)), ((ctk_scrolled_window_get_type
()))))))
,
9286 CTK_SHADOW_IN);
9287 ctk_scrolled_window_set_placement (CTK_SCROLLED_WINDOW (scrolledwindow)((((CtkScrolledWindow*) (void *) g_type_check_instance_cast (
(GTypeInstance*) ((scrolledwindow)), ((ctk_scrolled_window_get_type
()))))))
,
9288 CTK_CORNER_TOP_RIGHT);
9289
9290 ctk_container_add (CTK_CONTAINER (window)((((CtkContainer*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((window)), ((ctk_container_get_type ()))))))
, scrolledwindow);
9291
9292 layout_widget = ctk_layout_new (NULL((void*)0), NULL((void*)0));
9293 layout = CTK_LAYOUT (layout_widget)((((CtkLayout*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((layout_widget)), ((ctk_layout_get_type ()))))))
;
9294 ctk_container_add (CTK_CONTAINER (scrolledwindow)((((CtkContainer*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((scrolledwindow)), ((ctk_container_get_type ()))))))
, layout_widget);
9295
9296 /* We set step sizes here since CtkLayout does not set
9297 * them itself.
9298 */
9299 hadjustment = ctk_scrollable_get_hadjustment (CTK_SCROLLABLE (layout)((((CtkScrollable*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((layout)), ((ctk_scrollable_get_type ()))))))
);
9300 vadjustment = ctk_scrollable_get_vadjustment (CTK_SCROLLABLE (layout)((((CtkScrollable*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((layout)), ((ctk_scrollable_get_type ()))))))
);
9301 ctk_adjustment_set_step_increment (hadjustment, 10.0);
9302 ctk_adjustment_set_step_increment (vadjustment, 10.0);
9303 ctk_scrollable_set_hadjustment (CTK_SCROLLABLE (layout)((((CtkScrollable*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((layout)), ((ctk_scrollable_get_type ()))))))
, hadjustment);
9304 ctk_scrollable_set_vadjustment (CTK_SCROLLABLE (layout)((((CtkScrollable*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((layout)), ((ctk_scrollable_get_type ()))))))
, vadjustment);
9305
9306 ctk_widget_set_events (layout_widget, CDK_EXPOSURE_MASK);
9307 g_signal_connect (layout, "draw",g_signal_connect_data ((layout), ("draw"), (((GCallback) (layout_draw_handler
))), (((void*)0)), ((void*)0), (GConnectFlags) 0)
9308 G_CALLBACK (layout_draw_handler), NULL)g_signal_connect_data ((layout), ("draw"), (((GCallback) (layout_draw_handler
))), (((void*)0)), ((void*)0), (GConnectFlags) 0)
;
9309
9310 ctk_layout_set_size (layout, 1600, 128000);
9311
9312 for (i=0 ; i < 16 ; i++)
9313 for (j=0 ; j < 16 ; j++)
9314 {
9315 sprintf(buf, "Button %d, %d", i, j);
9316 if ((i + j) % 2)
9317 button = ctk_button_new_with_label (buf);
9318 else
9319 button = ctk_label_new (buf);
9320
9321 ctk_layout_put (layout, button, j*100, i*100);
9322 }
9323
9324 for (i=16; i < 1280; i++)
9325 {
9326 sprintf(buf, "Button %d, %d", i, 0);
9327 if (i % 2)
9328 button = ctk_button_new_with_label (buf);
9329 else
9330 button = ctk_label_new (buf);
9331
9332 ctk_layout_put (layout, button, 0, i*100);
9333 }
9334 }
9335
9336 if (!ctk_widget_get_visible (window))
9337 ctk_widget_show_all (window);
9338 else
9339 ctk_widget_destroy (window);
9340}
9341
9342static void
9343show_native (CtkWidget *button G_GNUC_UNUSED__attribute__ ((__unused__)),
9344 CtkFileChooserNative *native)
9345{
9346 ctk_native_dialog_show (CTK_NATIVE_DIALOG (native));
9347}
9348
9349static void
9350hide_native (CtkWidget *button G_GNUC_UNUSED__attribute__ ((__unused__)),
9351 CtkFileChooserNative *native)
9352{
9353 ctk_native_dialog_hide (CTK_NATIVE_DIALOG (native));
9354}
9355
9356static void
9357native_response (CtkNativeDialog *self,
9358 gint response_id,
9359 CtkWidget *label)
9360{
9361 static int count = 0;
9362 char *res;
9363 GSList *uris, *l;
9364 GString *s;
9365 char *response;
9366 CtkFileFilter *filter;
9367
9368 uris = ctk_file_chooser_get_uris (CTK_FILE_CHOOSER (self)((((CtkFileChooser*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((self)), ((ctk_file_chooser_get_type ()))))))
);
9369 filter = ctk_file_chooser_get_filter (CTK_FILE_CHOOSER (self)((((CtkFileChooser*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((self)), ((ctk_file_chooser_get_type ()))))))
);
9370 s = g_string_new ("");
9371 for (l = uris; l != NULL((void*)0); l = l->next)
9372 {
9373 g_string_prepend (s, l->data);
9374 g_string_prepend (s, "\n");
9375 }
9376
9377 switch (response_id)
9378 {
9379 case CTK_RESPONSE_NONE:
9380 response = g_strdup ("CTK_RESPONSE_NONE")g_strdup_inline ("CTK_RESPONSE_NONE");
9381 break;
9382 case CTK_RESPONSE_ACCEPT:
9383 response = g_strdup ("CTK_RESPONSE_ACCEPT")g_strdup_inline ("CTK_RESPONSE_ACCEPT");
9384 break;
9385 case CTK_RESPONSE_CANCEL:
9386 response = g_strdup ("CTK_RESPONSE_CANCEL")g_strdup_inline ("CTK_RESPONSE_CANCEL");
9387 break;
9388 case CTK_RESPONSE_DELETE_EVENT:
9389 response = g_strdup ("CTK_RESPONSE_DELETE_EVENT")g_strdup_inline ("CTK_RESPONSE_DELETE_EVENT");
9390 break;
9391 default:
9392 response = g_strdup_printf ("%d", response_id);
9393 break;
9394 }
9395
9396 if (filter)
9397 res = g_strdup_printf ("Response #%d: %s\n"
9398 "Filter: %s\n"
9399 "Files:\n"
9400 "%s",
9401 ++count,
9402 response,
9403 ctk_file_filter_get_name (filter),
9404 s->str);
9405 else
9406 res = g_strdup_printf ("Response #%d: %s\n"
9407 "NO Filter\n"
9408 "Files:\n"
9409 "%s",
9410 ++count,
9411 response,
9412 s->str);
9413 ctk_label_set_text (CTK_LABEL (label)((((CtkLabel*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((label)), ((ctk_label_get_type ()))))))
, res);
9414 g_free (response);
9415 g_string_free (s, TRUE)(__builtin_constant_p ((!(0))) ? (((!(0))) ? (g_string_free) (
(s), ((!(0)))) : g_string_free_and_steal (s)) : (g_string_free
) ((s), ((!(0)))))
;
9416}
9417
9418static void
9419native_modal_toggle (CtkWidget *checkbutton,
9420 CtkFileChooserNative *native)
9421{
9422 ctk_native_dialog_set_modal (CTK_NATIVE_DIALOG (native),
9423 ctk_toggle_button_get_active (CTK_TOGGLE_BUTTON(checkbutton)((((CtkToggleButton*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((checkbutton)), ((ctk_toggle_button_get_type ()))))))
));
9424}
9425
9426static void
9427native_multi_select_toggle (CtkWidget *checkbutton,
9428 CtkFileChooserNative *native)
9429{
9430 ctk_file_chooser_set_select_multiple (CTK_FILE_CHOOSER (native)((((CtkFileChooser*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((native)), ((ctk_file_chooser_get_type ()))))))
,
9431 ctk_toggle_button_get_active (CTK_TOGGLE_BUTTON(checkbutton)((((CtkToggleButton*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((checkbutton)), ((ctk_toggle_button_get_type ()))))))
));
9432}
9433
9434static void
9435native_overwrite_confirmation_toggle (CtkWidget *checkbutton,
9436 CtkFileChooserNative *native)
9437{
9438 ctk_file_chooser_set_do_overwrite_confirmation (CTK_FILE_CHOOSER (native)((((CtkFileChooser*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((native)), ((ctk_file_chooser_get_type ()))))))
,
9439 ctk_toggle_button_get_active (CTK_TOGGLE_BUTTON(checkbutton)((((CtkToggleButton*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((checkbutton)), ((ctk_toggle_button_get_type ()))))))
));
9440}
9441
9442static void
9443native_extra_widget_toggle (CtkWidget *checkbutton,
9444 CtkFileChooserNative *native)
9445{
9446 gboolean extra_widget = ctk_toggle_button_get_active (CTK_TOGGLE_BUTTON(checkbutton)((((CtkToggleButton*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((checkbutton)), ((ctk_toggle_button_get_type ()))))))
);
9447
9448 if (extra_widget)
9449 {
9450 CtkWidget *extra = ctk_check_button_new_with_label ("Extra toggle");
9451 ctk_widget_show (extra);
9452 ctk_file_chooser_set_extra_widget (CTK_FILE_CHOOSER (native)((((CtkFileChooser*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((native)), ((ctk_file_chooser_get_type ()))))))
, extra);
9453 }
9454 else
9455 {
9456 ctk_file_chooser_set_extra_widget (CTK_FILE_CHOOSER (native)((((CtkFileChooser*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((native)), ((ctk_file_chooser_get_type ()))))))
, NULL((void*)0));
9457 }
9458}
9459
9460
9461static void
9462native_visible_notify_show (GObject *object,
9463 GParamSpec *pspec G_GNUC_UNUSED__attribute__ ((__unused__)),
9464 CtkWidget *show_button)
9465{
9466 CtkFileChooserNative *native = CTK_FILE_CHOOSER_NATIVE (object);
9467 gboolean visible;
9468
9469 visible = ctk_native_dialog_get_visible (CTK_NATIVE_DIALOG (native));
9470 ctk_widget_set_sensitive (show_button, !visible);
9471}
9472
9473static void
9474native_visible_notify_hide (GObject *object,
9475 GParamSpec *pspec G_GNUC_UNUSED__attribute__ ((__unused__)),
9476 CtkWidget *hide_button)
9477{
9478 CtkFileChooserNative *native = CTK_FILE_CHOOSER_NATIVE (object);
9479 gboolean visible;
9480
9481 visible = ctk_native_dialog_get_visible (CTK_NATIVE_DIALOG (native));
9482 ctk_widget_set_sensitive (hide_button, visible);
9483}
9484
9485static char *
9486get_some_file (void)
9487{
9488 GFile *dir = g_file_new_for_path (g_get_current_dir ());
9489 GFileEnumerator *e;
9490 char *res = NULL((void*)0);
9491
9492 e = g_file_enumerate_children (dir, "*", 0, NULL((void*)0), NULL((void*)0));
9493 if (e)
9494 {
9495 while (res == NULL((void*)0))
9496 {
9497 GFileInfo *info;
9498
9499 info = g_file_enumerator_next_file (e, NULL((void*)0), NULL((void*)0));
9500
9501 if (info)
9502 {
9503 if (g_file_info_get_file_type (info) == G_FILE_TYPE_REGULAR)
9504 {
9505 GFile *child = g_file_enumerator_get_child (e, info);
9506 res = g_file_get_path (child);
9507 g_object_unref (child);
9508 }
9509 g_object_unref (info);
9510 }
9511 else
9512 break;
9513 }
9514 }
9515
9516 return res;
9517}
9518
9519static void
9520native_action_changed (CtkWidget *combo,
9521 CtkFileChooserNative *native)
9522{
9523 int i;
9524 gboolean save_as = FALSE(0);
9525 i = ctk_combo_box_get_active (CTK_COMBO_BOX (combo)((((CtkComboBox*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((combo)), ((ctk_combo_box_get_type ()))))))
);
9526
9527 if (i == 4) /* Save as */
9528 {
9529 save_as = TRUE(!(0));
9530 i = CTK_FILE_CHOOSER_ACTION_SAVE;
9531 }
9532
9533 ctk_file_chooser_set_action (CTK_FILE_CHOOSER (native)((((CtkFileChooser*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((native)), ((ctk_file_chooser_get_type ()))))))
,
9534 (CtkFileChooserAction) i);
9535
9536
9537 if (i == CTK_FILE_CHOOSER_ACTION_SAVE ||
9538 i == CTK_FILE_CHOOSER_ACTION_CREATE_FOLDER)
9539 {
9540 if (save_as)
9541 {
9542 char *file = get_some_file ();
9543 ctk_file_chooser_set_filename (CTK_FILE_CHOOSER (native)((((CtkFileChooser*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((native)), ((ctk_file_chooser_get_type ()))))))
, file);
9544 g_free (file);
9545 }
9546 else
9547 ctk_file_chooser_set_current_name (CTK_FILE_CHOOSER (native)((((CtkFileChooser*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((native)), ((ctk_file_chooser_get_type ()))))))
, "newname.txt");
9548 }
9549}
9550
9551static void
9552native_filter_changed (CtkWidget *combo,
9553 CtkFileChooserNative *native)
9554{
9555 int i;
9556 GSList *filters, *l;
9557 CtkFileFilter *filter;
9558
9559 i = ctk_combo_box_get_active (CTK_COMBO_BOX (combo)((((CtkComboBox*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((combo)), ((ctk_combo_box_get_type ()))))))
);
9560
9561 filters = ctk_file_chooser_list_filters (CTK_FILE_CHOOSER (native)((((CtkFileChooser*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((native)), ((ctk_file_chooser_get_type ()))))))
);
9562 for (l = filters; l != NULL((void*)0); l = l->next)
9563 ctk_file_chooser_remove_filter (CTK_FILE_CHOOSER (native)((((CtkFileChooser*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((native)), ((ctk_file_chooser_get_type ()))))))
, l->data);
9564 g_slist_free (filters);
9565
9566 switch (i)
9567 {
9568 case 0:
9569 break;
9570 case 1: /* pattern */
9571 filter = ctk_file_filter_new ();
9572 ctk_file_filter_set_name (filter, "Text");
9573 ctk_file_filter_add_pattern (filter, "*.doc");
9574 ctk_file_filter_add_pattern (filter, "*.txt");
9575 ctk_file_chooser_add_filter (CTK_FILE_CHOOSER (native)((((CtkFileChooser*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((native)), ((ctk_file_chooser_get_type ()))))))
, filter);
9576
9577 filter = ctk_file_filter_new ();
9578 ctk_file_filter_set_name (filter, "Images");
9579 ctk_file_filter_add_pixbuf_formats (filter);
9580 ctk_file_chooser_add_filter (CTK_FILE_CHOOSER (native)((((CtkFileChooser*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((native)), ((ctk_file_chooser_get_type ()))))))
, filter);
9581 ctk_file_chooser_set_filter (CTK_FILE_CHOOSER (native)((((CtkFileChooser*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((native)), ((ctk_file_chooser_get_type ()))))))
, filter);
9582
9583 filter = ctk_file_filter_new ();
9584 ctk_file_filter_set_name (filter, "All");
9585 ctk_file_filter_add_pattern (filter, "*");
9586 ctk_file_chooser_add_filter (CTK_FILE_CHOOSER (native)((((CtkFileChooser*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((native)), ((ctk_file_chooser_get_type ()))))))
, filter);
9587 break;
9588
9589 case 2: /* mimetype */
9590 filter = ctk_file_filter_new ();
9591 ctk_file_filter_set_name (filter, "Text");
9592 ctk_file_filter_add_mime_type (filter, "text/plain");
9593 ctk_file_chooser_add_filter (CTK_FILE_CHOOSER (native)((((CtkFileChooser*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((native)), ((ctk_file_chooser_get_type ()))))))
, filter);
9594
9595 filter = ctk_file_filter_new ();
9596 ctk_file_filter_set_name (filter, "All");
9597 ctk_file_filter_add_pattern (filter, "*");
9598 ctk_file_chooser_add_filter (CTK_FILE_CHOOSER (native)((((CtkFileChooser*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((native)), ((ctk_file_chooser_get_type ()))))))
, filter);
9599 ctk_file_chooser_set_filter (CTK_FILE_CHOOSER (native)((((CtkFileChooser*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((native)), ((ctk_file_chooser_get_type ()))))))
, filter);
9600 break;
9601 }
9602}
9603
9604static void
9605destroy_native (CtkFileChooserNative *native)
9606{
9607 ctk_native_dialog_destroy (CTK_NATIVE_DIALOG (native));
9608 g_object_unref (native);
9609}
9610
9611void
9612create_native_dialogs (CtkWidget *widget)
9613{
9614 static CtkWidget *window = NULL((void*)0);
9615
9616 if (!window)
9617 {
9618 CtkWidget *box, *label;
9619 CtkWidget *show_button, *hide_button, *check_button;
9620 CtkFileChooserNative *native;
9621 CtkWidget *combo;
9622
9623 window = ctk_window_new (CTK_WINDOW_TOPLEVEL);
9624 ctk_window_set_screen (CTK_WINDOW (window)((((CtkWindow*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((window)), ((ctk_window_get_type ()))))))
,
9625 ctk_widget_get_screen (widget));
9626
9627 native = ctk_file_chooser_native_new ("Native title",
9628 CTK_WINDOW (window)((((CtkWindow*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((window)), ((ctk_window_get_type ()))))))
,
9629 CTK_FILE_CHOOSER_ACTION_OPEN,
9630 "_accept&native",
9631 "_cancel__native");
9632
9633 g_signal_connect_swapped (G_OBJECT (window), "destroy", G_CALLBACK (destroy_native), native)g_signal_connect_data ((((((GObject*) (void *) g_type_check_instance_cast
((GTypeInstance*) ((window)), (((GType) ((20) << (2)))
)))))), ("destroy"), (((GCallback) (destroy_native))), (native
), ((void*)0), G_CONNECT_SWAPPED)
;
9634
9635 ctk_file_chooser_add_shortcut_folder (CTK_FILE_CHOOSER (native)((((CtkFileChooser*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((native)), ((ctk_file_chooser_get_type ()))))))
,
9636 g_get_current_dir (),
9637 NULL((void*)0));
9638
9639 ctk_window_set_title (CTK_WINDOW(window)((((CtkWindow*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((window)), ((ctk_window_get_type ()))))))
, "Native dialog parent");
9640
9641 box = ctk_box_new (CTK_ORIENTATION_VERTICAL, 5);
9642 ctk_container_add (CTK_CONTAINER (window)((((CtkContainer*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((window)), ((ctk_container_get_type ()))))))
, box);
9643
9644 label = ctk_label_new ("");
9645 ctk_box_pack_start (CTK_BOX (box)((((CtkBox*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((box)), ((ctk_box_get_type ()))))))
, label, FALSE(0), FALSE(0), 4);
9646
9647 combo = ctk_combo_box_text_new ();
9648
9649 ctk_combo_box_text_append_text (CTK_COMBO_BOX_TEXT (combo)((((CtkComboBoxText*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((combo)), ((ctk_combo_box_text_get_type ()))))))
, "Open");
9650 ctk_combo_box_text_append_text (CTK_COMBO_BOX_TEXT (combo)((((CtkComboBoxText*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((combo)), ((ctk_combo_box_text_get_type ()))))))
, "Save");
9651 ctk_combo_box_text_append_text (CTK_COMBO_BOX_TEXT (combo)((((CtkComboBoxText*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((combo)), ((ctk_combo_box_text_get_type ()))))))
, "Select Folder");
9652 ctk_combo_box_text_append_text (CTK_COMBO_BOX_TEXT (combo)((((CtkComboBoxText*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((combo)), ((ctk_combo_box_text_get_type ()))))))
, "Create Folder");
9653 ctk_combo_box_text_append_text (CTK_COMBO_BOX_TEXT (combo)((((CtkComboBoxText*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((combo)), ((ctk_combo_box_text_get_type ()))))))
, "Save as");
9654
9655 g_signal_connect (combo, "changed",g_signal_connect_data ((combo), ("changed"), (((GCallback) (native_action_changed
))), (native), ((void*)0), (GConnectFlags) 0)
9656 G_CALLBACK (native_action_changed), native)g_signal_connect_data ((combo), ("changed"), (((GCallback) (native_action_changed
))), (native), ((void*)0), (GConnectFlags) 0)
;
9657 ctk_combo_box_set_active (CTK_COMBO_BOX (combo)((((CtkComboBox*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((combo)), ((ctk_combo_box_get_type ()))))))
, CTK_FILE_CHOOSER_ACTION_OPEN);
9658 ctk_box_pack_start (CTK_BOX (box)((((CtkBox*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((box)), ((ctk_box_get_type ()))))))
, combo, FALSE(0), FALSE(0), 4);
9659
9660 combo = ctk_combo_box_text_new ();
9661
9662 ctk_combo_box_text_append_text (CTK_COMBO_BOX_TEXT (combo)((((CtkComboBoxText*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((combo)), ((ctk_combo_box_text_get_type ()))))))
, "No filters");
9663 ctk_combo_box_text_append_text (CTK_COMBO_BOX_TEXT (combo)((((CtkComboBoxText*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((combo)), ((ctk_combo_box_text_get_type ()))))))
, "Pattern filter");
9664 ctk_combo_box_text_append_text (CTK_COMBO_BOX_TEXT (combo)((((CtkComboBoxText*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((combo)), ((ctk_combo_box_text_get_type ()))))))
, "Mimetype filter");
9665
9666 g_signal_connect (combo, "changed",g_signal_connect_data ((combo), ("changed"), (((GCallback) (native_filter_changed
))), (native), ((void*)0), (GConnectFlags) 0)
9667 G_CALLBACK (native_filter_changed), native)g_signal_connect_data ((combo), ("changed"), (((GCallback) (native_filter_changed
))), (native), ((void*)0), (GConnectFlags) 0)
;
9668 ctk_combo_box_set_active (CTK_COMBO_BOX (combo)((((CtkComboBox*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((combo)), ((ctk_combo_box_get_type ()))))))
, 0);
9669 ctk_box_pack_start (CTK_BOX (box)((((CtkBox*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((box)), ((ctk_box_get_type ()))))))
, combo, FALSE(0), FALSE(0), 4);
9670
9671 check_button = ctk_check_button_new_with_label ("Modal");
9672 g_signal_connect (check_button, "toggled",g_signal_connect_data ((check_button), ("toggled"), (((GCallback
) (native_modal_toggle))), (native), ((void*)0), (GConnectFlags
) 0)
9673 G_CALLBACK (native_modal_toggle), native)g_signal_connect_data ((check_button), ("toggled"), (((GCallback
) (native_modal_toggle))), (native), ((void*)0), (GConnectFlags
) 0)
;
9674 ctk_box_pack_start (CTK_BOX (box)((((CtkBox*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((box)), ((ctk_box_get_type ()))))))
, check_button, FALSE(0), FALSE(0), 4);
9675
9676 check_button = ctk_check_button_new_with_label ("Multiple select");
9677 g_signal_connect (check_button, "toggled",g_signal_connect_data ((check_button), ("toggled"), (((GCallback
) (native_multi_select_toggle))), (native), ((void*)0), (GConnectFlags
) 0)
9678 G_CALLBACK (native_multi_select_toggle), native)g_signal_connect_data ((check_button), ("toggled"), (((GCallback
) (native_multi_select_toggle))), (native), ((void*)0), (GConnectFlags
) 0)
;
9679 ctk_box_pack_start (CTK_BOX (box)((((CtkBox*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((box)), ((ctk_box_get_type ()))))))
, check_button, FALSE(0), FALSE(0), 4);
9680
9681 check_button = ctk_check_button_new_with_label ("Confirm overwrite");
9682 g_signal_connect (check_button, "toggled",g_signal_connect_data ((check_button), ("toggled"), (((GCallback
) (native_overwrite_confirmation_toggle))), (native), ((void*
)0), (GConnectFlags) 0)
9683 G_CALLBACK (native_overwrite_confirmation_toggle), native)g_signal_connect_data ((check_button), ("toggled"), (((GCallback
) (native_overwrite_confirmation_toggle))), (native), ((void*
)0), (GConnectFlags) 0)
;
9684 ctk_box_pack_start (CTK_BOX (box)((((CtkBox*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((box)), ((ctk_box_get_type ()))))))
, check_button, FALSE(0), FALSE(0), 4);
9685
9686 check_button = ctk_check_button_new_with_label ("Extra widget");
9687 g_signal_connect (check_button, "toggled",g_signal_connect_data ((check_button), ("toggled"), (((GCallback
) (native_extra_widget_toggle))), (native), ((void*)0), (GConnectFlags
) 0)
9688 G_CALLBACK (native_extra_widget_toggle), native)g_signal_connect_data ((check_button), ("toggled"), (((GCallback
) (native_extra_widget_toggle))), (native), ((void*)0), (GConnectFlags
) 0)
;
9689 ctk_box_pack_start (CTK_BOX (box)((((CtkBox*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((box)), ((ctk_box_get_type ()))))))
, check_button, FALSE(0), FALSE(0), 4);
9690
9691 show_button = ctk_button_new_with_label ("Show");
9692 hide_button = ctk_button_new_with_label ("Hide");
9693 ctk_widget_set_sensitive (hide_button, FALSE(0));
9694
9695 ctk_box_pack_start (CTK_BOX (box)((((CtkBox*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((box)), ((ctk_box_get_type ()))))))
, show_button, FALSE(0), FALSE(0), 4);
9696 ctk_box_pack_start (CTK_BOX (box)((((CtkBox*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((box)), ((ctk_box_get_type ()))))))
, hide_button, FALSE(0), FALSE(0), 4);
9697
9698 /* connect signals */
9699 g_signal_connect (native, "response",g_signal_connect_data ((native), ("response"), (((GCallback) (
native_response))), (label), ((void*)0), (GConnectFlags) 0)
9700 G_CALLBACK (native_response), label)g_signal_connect_data ((native), ("response"), (((GCallback) (
native_response))), (label), ((void*)0), (GConnectFlags) 0)
;
9701 g_signal_connect (show_button, "clicked",g_signal_connect_data ((show_button), ("clicked"), (((GCallback
) (show_native))), (native), ((void*)0), (GConnectFlags) 0)
9702 G_CALLBACK (show_native), native)g_signal_connect_data ((show_button), ("clicked"), (((GCallback
) (show_native))), (native), ((void*)0), (GConnectFlags) 0)
;
9703 g_signal_connect (hide_button, "clicked",g_signal_connect_data ((hide_button), ("clicked"), (((GCallback
) (hide_native))), (native), ((void*)0), (GConnectFlags) 0)
9704 G_CALLBACK (hide_native), native)g_signal_connect_data ((hide_button), ("clicked"), (((GCallback
) (hide_native))), (native), ((void*)0), (GConnectFlags) 0)
;
9705
9706 g_signal_connect (native, "notify::visible",g_signal_connect_data ((native), ("notify::visible"), (((GCallback
) (native_visible_notify_show))), (show_button), ((void*)0), (
GConnectFlags) 0)
9707 G_CALLBACK (native_visible_notify_show), show_button)g_signal_connect_data ((native), ("notify::visible"), (((GCallback
) (native_visible_notify_show))), (show_button), ((void*)0), (
GConnectFlags) 0)
;
9708 g_signal_connect (native, "notify::visible",g_signal_connect_data ((native), ("notify::visible"), (((GCallback
) (native_visible_notify_hide))), (hide_button), ((void*)0), (
GConnectFlags) 0)
9709 G_CALLBACK (native_visible_notify_hide), hide_button)g_signal_connect_data ((native), ("notify::visible"), (((GCallback
) (native_visible_notify_hide))), (hide_button), ((void*)0), (
GConnectFlags) 0)
;
9710
9711 g_signal_connect (window, "destroy",g_signal_connect_data ((window), ("destroy"), (((GCallback) (
ctk_widget_destroyed))), (&window), ((void*)0), (GConnectFlags
) 0)
9712 G_CALLBACK (ctk_widget_destroyed),g_signal_connect_data ((window), ("destroy"), (((GCallback) (
ctk_widget_destroyed))), (&window), ((void*)0), (GConnectFlags
) 0)
9713 &window)g_signal_connect_data ((window), ("destroy"), (((GCallback) (
ctk_widget_destroyed))), (&window), ((void*)0), (GConnectFlags
) 0)
;
9714 }
9715
9716 if (!ctk_widget_get_visible (window))
9717 ctk_widget_show_all (window);
9718 else
9719 ctk_widget_destroy (window);
9720}
9721
9722/*
9723 * Main Window and Exit
9724 */
9725
9726void
9727do_exit (CtkWidget *widget G_GNUC_UNUSED__attribute__ ((__unused__)),
9728 CtkWidget *window)
9729{
9730 ctk_widget_destroy (window);
9731 ctk_main_quit ();
9732}
9733
9734struct {
9735 char *label;
9736 void (*func) (CtkWidget *widget);
9737 gboolean do_not_benchmark;
9738} buttons[] =
9739{
9740 { .label = "alpha window", .func = create_alpha_window },
9741 { .label = "alpha widget", .func = create_alpha_widgets },
9742 { .label = "big windows", .func = create_big_windows },
9743 { .label = "button box", .func = create_button_box },
9744 { .label = "buttons", .func = create_buttons },
9745 { .label = "check buttons", .func = create_check_buttons },
9746 { .label = "color selection", .func = create_color_selection },
9747 { .label = "composited window", .func = create_composited_window },
9748 { .label = "cursors", .func = create_cursors },
9749 { .label = "dialog", .func = create_dialog },
9750 { .label = "display", .func = create_display_screen, .do_not_benchmark = TRUE(!(0)) },
9751 { .label = "entry", .func = create_entry },
9752 { .label = "event box", .func = create_event_box },
9753 { .label = "event watcher", .func = create_event_watcher },
9754 { .label = "expander", .func = create_expander },
9755 { .label = "flipping", .func = create_flipping },
9756 { .label = "focus", .func = create_focus },
9757 { .label = "font selection", .func = create_font_selection },
9758 { .label = "image", .func = create_image },
9759 { .label = "key lookup", .func = create_key_lookup },
9760 { .label = "labels", .func = create_labels },
9761 { .label = "layout", .func = create_layout },
9762 { .label = "listbox", .func = create_listbox },
9763 { .label = "menus", .func = create_menus },
9764 { .label = "message dialog", .func = create_message_dialog },
9765 { .label = "modal window", .func = create_modal_window, .do_not_benchmark = TRUE(!(0)) },
9766 { .label = "native dialogs", .func = create_native_dialogs },
9767 { .label = "notebook", .func = create_notebook },
9768 { .label = "panes", .func = create_panes },
9769 { .label = "paned keyboard", .func = create_paned_keyboard_navigation },
9770 { .label = "pixbuf", .func = create_pixbuf },
9771 { .label = "progress bar", .func = create_progress_bar },
9772 { .label = "radio buttons", .func = create_radio_buttons },
9773 { .label = "range controls", .func = create_range_controls },
9774 { .label = "reparent", .func = create_reparent },
9775 { .label = "resize grips", .func = create_resize_grips },
9776 { .label = "rotated label", .func = create_rotated_label },
9777 { .label = "rotated text", .func = create_rotated_text },
9778 { .label = "saved position", .func = create_saved_position },
9779 { .label = "scrolled windows", .func = create_scrolled_windows },
9780 { .label = "shapes", .func = create_shapes },
9781 { .label = "size groups", .func = create_size_groups },
9782 { .label = "snapshot", .func = create_snapshot },
9783 { .label = "spinbutton", .func = create_spins },
9784 { .label = "statusbar", .func = create_statusbar },
9785 { .label = "test mainloop", .func = create_mainloop, .do_not_benchmark = TRUE(!(0)) },
9786 { .label = "test scrolling", .func = create_scroll_test },
9787 { .label = "test selection", .func = create_selection_test },
9788 { .label = "test timeout", .func = create_timeout_test },
9789 { .label = "toggle buttons", .func = create_toggle_buttons },
9790 { .label = "toolbar", .func = create_toolbar },
9791 { .label = "tooltips", .func = create_tooltips },
9792 { .label = "WM hints", .func = create_wmhints },
9793 { .label = "window sizing", .func = create_window_sizing },
9794 { .label = "window states", .func = create_window_states }
9795};
9796int nbuttons = sizeof (buttons) / sizeof (buttons[0]);
9797
9798void
9799create_main_window (void)
9800{
9801 CtkWidget *window;
9802 CtkWidget *box1;
9803 CtkWidget *box2;
9804 CtkWidget *scrolled_window;
9805 CtkWidget *button;
9806 CtkWidget *label;
9807 gchar buffer[64];
9808 CtkWidget *separator;
9809 CdkGeometry geometry;
9810 int i;
9811
9812 window = ctk_window_new (CTK_WINDOW_TOPLEVEL);
9813 ctk_widget_set_name (window, "main_window");
9814 ctk_window_move (CTK_WINDOW (window)((((CtkWindow*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((window)), ((ctk_window_get_type ()))))))
, 50, 20);
9815 ctk_window_set_default_size (CTK_WINDOW (window)((((CtkWindow*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((window)), ((ctk_window_get_type ()))))))
, -1, 400);
9816
9817 geometry.min_width = -1;
9818 geometry.min_height = -1;
9819 geometry.max_width = -1;
9820 geometry.max_height = G_MAXSHORT32767;
9821 ctk_window_set_geometry_hints (CTK_WINDOW (window)((((CtkWindow*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((window)), ((ctk_window_get_type ()))))))
, NULL((void*)0),
9822 &geometry,
9823 CDK_HINT_MIN_SIZE | CDK_HINT_MAX_SIZE);
9824
9825 g_signal_connect (window, "destroy",g_signal_connect_data ((window), ("destroy"), (((GCallback) (
ctk_main_quit))), (((void*)0)), ((void*)0), (GConnectFlags) 0
)
9826 G_CALLBACK (ctk_main_quit),g_signal_connect_data ((window), ("destroy"), (((GCallback) (
ctk_main_quit))), (((void*)0)), ((void*)0), (GConnectFlags) 0
)
9827 NULL)g_signal_connect_data ((window), ("destroy"), (((GCallback) (
ctk_main_quit))), (((void*)0)), ((void*)0), (GConnectFlags) 0
)
;
9828 g_signal_connect (window, "delete-event",g_signal_connect_data ((window), ("delete-event"), (((GCallback
) (ctk_false))), (((void*)0)), ((void*)0), (GConnectFlags) 0)
9829 G_CALLBACK (ctk_false),g_signal_connect_data ((window), ("delete-event"), (((GCallback
) (ctk_false))), (((void*)0)), ((void*)0), (GConnectFlags) 0)
9830 NULL)g_signal_connect_data ((window), ("delete-event"), (((GCallback
) (ctk_false))), (((void*)0)), ((void*)0), (GConnectFlags) 0)
;
9831
9832 box1 = ctk_box_new (CTK_ORIENTATION_VERTICAL, 0);
9833 ctk_container_add (CTK_CONTAINER (window)((((CtkContainer*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((window)), ((ctk_container_get_type ()))))))
, box1);
9834
9835 if (ctk_micro_versionctk_get_micro_version () > 0)
9836 sprintf (buffer,
9837 "Ctk+ v%d.%d.%d",
9838 ctk_get_major_version (),
9839 ctk_get_minor_version (),
9840 ctk_get_micro_version ());
9841 else
9842 sprintf (buffer,
9843 "Ctk+ v%d.%d",
9844 ctk_get_major_version (),
9845 ctk_get_minor_version ());
9846
9847 label = ctk_label_new (buffer);
9848 ctk_box_pack_start (CTK_BOX (box1)((((CtkBox*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((box1)), ((ctk_box_get_type ()))))))
, label, FALSE(0), FALSE(0), 0);
9849 ctk_widget_set_name (label, "testctk-version-label");
9850
9851 scrolled_window = ctk_scrolled_window_new (NULL((void*)0), NULL((void*)0));
9852 ctk_container_set_border_width (CTK_CONTAINER (scrolled_window)((((CtkContainer*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((scrolled_window)), ((ctk_container_get_type ()))))))
, 10);
9853 ctk_scrolled_window_set_policy (CTK_SCROLLED_WINDOW (scrolled_window)((((CtkScrolledWindow*) (void *) g_type_check_instance_cast (
(GTypeInstance*) ((scrolled_window)), ((ctk_scrolled_window_get_type
()))))))
,
9854 CTK_POLICY_NEVER,
9855 CTK_POLICY_AUTOMATIC);
9856 ctk_box_pack_start (CTK_BOX (box1)((((CtkBox*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((box1)), ((ctk_box_get_type ()))))))
, scrolled_window, TRUE(!(0)), TRUE(!(0)), 0);
9857
9858 box2 = ctk_box_new (CTK_ORIENTATION_VERTICAL, 0);
9859 ctk_container_set_border_width (CTK_CONTAINER (box2)((((CtkContainer*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((box2)), ((ctk_container_get_type ()))))))
, 10);
9860 ctk_container_add (CTK_CONTAINER (scrolled_window)((((CtkContainer*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((scrolled_window)), ((ctk_container_get_type ()))))))
, box2);
9861 ctk_container_set_focus_vadjustment (CTK_CONTAINER (box2)((((CtkContainer*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((box2)), ((ctk_container_get_type ()))))))
,
9862 ctk_scrolled_window_get_vadjustment (CTK_SCROLLED_WINDOW (scrolled_window)((((CtkScrolledWindow*) (void *) g_type_check_instance_cast (
(GTypeInstance*) ((scrolled_window)), ((ctk_scrolled_window_get_type
()))))))
));
9863 ctk_widget_show (box2);
9864
9865 for (i = 0; i < nbuttons; i++)
9866 {
9867 button = ctk_button_new_with_label (buttons[i].label);
9868 if (buttons[i].func)
9869 g_signal_connect (button,g_signal_connect_data ((button), ("clicked"), (((GCallback) (
buttons[i].func))), (((void*)0)), ((void*)0), (GConnectFlags)
0)
9870 "clicked",g_signal_connect_data ((button), ("clicked"), (((GCallback) (
buttons[i].func))), (((void*)0)), ((void*)0), (GConnectFlags)
0)
9871 G_CALLBACK(buttons[i].func),g_signal_connect_data ((button), ("clicked"), (((GCallback) (
buttons[i].func))), (((void*)0)), ((void*)0), (GConnectFlags)
0)
9872 NULL)g_signal_connect_data ((button), ("clicked"), (((GCallback) (
buttons[i].func))), (((void*)0)), ((void*)0), (GConnectFlags)
0)
;
9873 else
9874 ctk_widget_set_sensitive (button, FALSE(0));
9875 ctk_box_pack_start (CTK_BOX (box2)((((CtkBox*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((box2)), ((ctk_box_get_type ()))))))
, button, TRUE(!(0)), TRUE(!(0)), 0);
9876 }
9877
9878 separator = ctk_separator_new (CTK_ORIENTATION_HORIZONTAL);
9879 ctk_box_pack_start (CTK_BOX (box1)((((CtkBox*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((box1)), ((ctk_box_get_type ()))))))
, separator, FALSE(0), TRUE(!(0)), 0);
9880
9881 box2 = ctk_box_new (CTK_ORIENTATION_VERTICAL, 10);
9882 ctk_container_set_border_width (CTK_CONTAINER (box2)((((CtkContainer*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((box2)), ((ctk_container_get_type ()))))))
, 10);
9883 ctk_box_pack_start (CTK_BOX (box1)((((CtkBox*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((box1)), ((ctk_box_get_type ()))))))
, box2, FALSE(0), TRUE(!(0)), 0);
9884
9885 button = ctk_button_new_with_mnemonic ("_Close");
9886 g_signal_connect (button, "clicked",g_signal_connect_data ((button), ("clicked"), (((GCallback) (
do_exit))), (window), ((void*)0), (GConnectFlags) 0)
9887 G_CALLBACK (do_exit),g_signal_connect_data ((button), ("clicked"), (((GCallback) (
do_exit))), (window), ((void*)0), (GConnectFlags) 0)
9888 window)g_signal_connect_data ((button), ("clicked"), (((GCallback) (
do_exit))), (window), ((void*)0), (GConnectFlags) 0)
;
9889 ctk_box_pack_start (CTK_BOX (box2)((((CtkBox*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((box2)), ((ctk_box_get_type ()))))))
, button, TRUE(!(0)), TRUE(!(0)), 0);
9890 ctk_widget_set_can_default (button, TRUE(!(0)));
9891 ctk_widget_grab_default (button);
9892
9893 ctk_widget_show_all (window);
9894}
9895
9896static void
9897test_init (void)
9898{
9899 if (g_file_test ("../modules/input/immodules.cache", G_FILE_TEST_EXISTS))
9900 g_setenv ("CTK_IM_MODULE_FILE", "../modules/input/immodules.cache", TRUE(!(0)));
9901}
9902
9903static char *
9904pad (const char *str, int to)
9905{
9906 static char buf[256];
9907 int len = strlen (str);
9908 int i;
9909
9910 for (i = 0; i < to; i++)
9911 buf[i] = ' ';
9912
9913 buf[to] = '\0';
9914
9915 memcpy (buf, str, len);
9916
9917 return buf;
9918}
9919
9920static void
9921bench_iteration (CtkWidget *widget, void (* fn) (CtkWidget *widget))
9922{
9923 fn (widget); /* on */
9924 while (g_main_context_iteration (NULL((void*)0), FALSE(0)));
9925 fn (widget); /* off */
9926 while (g_main_context_iteration (NULL((void*)0), FALSE(0)));
9927}
9928
9929void
9930do_real_bench (CtkWidget *widget, void (* fn) (CtkWidget *widget), char *name, int num)
9931{
9932 gint64 t0, t1;
9933 double dt_first;
9934 double dt;
9935 int n;
9936 static gboolean printed_headers = FALSE(0);
9937
9938 if (!printed_headers) {
9939 g_print ("Test Iters First Other\n");
9940 g_print ("-------------------- ----- ---------- ----------\n");
9941 printed_headers = TRUE(!(0));
9942 }
9943
9944 t0 = g_get_monotonic_time ();
9945 bench_iteration (widget, fn);
9946 t1 = g_get_monotonic_time ();
9947
9948 dt_first = ((double)(t1 - t0)) / 1000.0;
9949
9950 t0 = g_get_monotonic_time ();
9951 for (n = 0; n < num - 1; n++)
9952 bench_iteration (widget, fn);
9953 t1 = g_get_monotonic_time ();
9954 dt = ((double)(t1 - t0)) / 1000.0;
9955
9956 g_print ("%s %5d ", pad (name, 20), num);
9957 if (num > 1)
9958 g_print ("%10.1f %10.1f\n", dt_first, dt/(num-1));
9959 else
9960 g_print ("%10.1f\n", dt_first);
9961}
9962
9963void
9964do_bench (char* what, int num)
9965{
9966 int i;
9967 CtkWidget *widget;
9968 void (* fn) (CtkWidget *widget);
9969 fn = NULL((void*)0);
9970 widget = ctk_window_new (CTK_WINDOW_TOPLEVEL);
9971
9972 if (g_ascii_strcasecmp (what, "ALL") == 0)
9973 {
9974 for (i = 0; i < nbuttons; i++)
9975 {
9976 if (!buttons[i].do_not_benchmark)
9977 do_real_bench (widget, buttons[i].func, buttons[i].label, num);
9978 }
9979
9980 return;
9981 }
9982 else
9983 {
9984 for (i = 0; i < nbuttons; i++)
9985 {
9986 if (strcmp (buttons[i].label, what) == 0)
9987 {
9988 fn = buttons[i].func;
9989 break;
9990 }
9991 }
9992
9993 if (!fn)
9994 g_print ("Can't bench: \"%s\" not found.\n", what);
9995 else
9996 do_real_bench (widget, fn, buttons[i].label, num);
9997 }
9998}
9999
10000void
10001usage (void)
10002{
10003 fprintf (stderrstderr, "Usage: testctk [--bench ALL|<bench>[:<count>]]\n");
10004 exit (1);
10005}
10006
10007int
10008main (int argc, char *argv[])
10009{
10010 CtkCssProvider *provider, *memory_provider;
10011 CdkDisplay *display;
10012 CdkScreen *screen;
10013 CtkBindingSet *binding_set;
10014 int i;
10015 gboolean done_benchmarks = FALSE(0);
10016
10017 srand (time (NULL((void*)0)));
10018
10019 test_init ();
10020
10021 g_set_application_name ("CTK+ Test Program");
10022
10023 ctk_init (&argc, &argv);
10024
10025 provider = ctk_css_provider_new ();
10026
10027 /* Check to see if we are being run from the correct
10028 * directory.
10029 */
10030 if (file_exists ("testctk.css"))
10031 ctk_css_provider_load_from_path (provider, "testctk.css", NULL((void*)0));
10032 else if (file_exists ("tests/testctk.css"))
10033 ctk_css_provider_load_from_path (provider, "tests/testctk.css", NULL((void*)0));
10034 else
10035 g_warning ("Couldn't find file \"testctk.css\".");
10036
10037 display = cdk_display_get_default ();
10038 screen = cdk_display_get_default_screen (display);
10039
10040 ctk_style_context_add_provider_for_screen (screen, CTK_STYLE_PROVIDER (provider)((((CtkStyleProvider*) (void *) g_type_check_instance_cast ((
GTypeInstance*) ((provider)), ((ctk_style_provider_get_type (
)))))))
,
10041 CTK_STYLE_PROVIDER_PRIORITY_APPLICATION600);
10042 g_object_unref (provider);
10043
10044 ctk_accelerator_set_default_mod_mask (CDK_SHIFT_MASK |
10045 CDK_CONTROL_MASK |
10046 CDK_MOD1_MASK |
10047 CDK_META_MASK |
10048 CDK_SUPER_MASK |
10049 CDK_HYPER_MASK |
10050 CDK_MOD4_MASK);
10051 /* benchmarking
10052 */
10053 for (i = 1; i < argc; i++)
10054 {
10055 if (strncmp (argv[i], "--bench", strlen("--bench")) == 0)
10056 {
10057 int num = 1;
10058 char *nextarg;
10059 char *what;
10060 char *count;
10061
10062 nextarg = strchr (argv[i], '=');
10063 if (nextarg)
10064 nextarg++;
10065 else
10066 {
10067 i++;
10068 if (i == argc)
10069 usage ();
10070 nextarg = argv[i];
10071 }
10072
10073 count = strchr (nextarg, ':');
10074 if (count)
10075 {
10076 what = g_strndup (nextarg, count - nextarg);
10077 count++;
10078 num = atoi (count);
10079 if (num <= 0)
10080 usage ();
10081 }
10082 else
10083 what = g_strdup (nextarg)g_strdup_inline (nextarg);
10084
10085 do_bench (what, num ? num : 1);
10086 done_benchmarks = TRUE(!(0));
10087 }
10088 else
10089 usage ();
10090 }
10091 if (done_benchmarks)
10092 return 0;
10093
10094 /* bindings test
10095 */
10096 binding_set = ctk_binding_set_by_class (g_type_class_ref (CTK_TYPE_WIDGET(ctk_widget_get_type ())));
10097 ctk_binding_entry_add_signal (binding_set,
10098 '9', CDK_CONTROL_MASK | CDK_RELEASE_MASK,
10099 "debug_msg",
10100 1,
10101 G_TYPE_STRING((GType) ((16) << (2))), "CtkWidgetClass <ctrl><release>9 test");
10102
10103 memory_provider = ctk_css_provider_new ();
10104 ctk_css_provider_load_from_data (memory_provider,
10105 "#testctk-version-label {\n"
10106 " color: #f00;\n"
10107 " font-family: Sans;\n"
10108 " font-size: 18px;\n"
10109 "}",
10110 -1, NULL((void*)0));
10111 ctk_style_context_add_provider_for_screen (screen, CTK_STYLE_PROVIDER (memory_provider)((((CtkStyleProvider*) (void *) g_type_check_instance_cast ((
GTypeInstance*) ((memory_provider)), ((ctk_style_provider_get_type
()))))))
,
10112 CTK_STYLE_PROVIDER_PRIORITY_APPLICATION600 + 1);
10113
10114 create_main_window ();
10115
10116 ctk_main ();
10117
10118 if (1)
10119 {
10120 while (g_main_context_pending (NULL((void*)0)))
10121 g_main_context_iteration (NULL((void*)0), FALSE(0));
10122#if 0
10123 sleep (1);
10124 while (g_main_context_pending (NULL((void*)0)))
10125 g_main_context_iteration (NULL((void*)0), FALSE(0));
10126#endif
10127 }
10128 return 0;
10129}