| File: | tests/testcombo.c |
| Warning: | line 44, column 13 Although the value stored to 'pixels' is used in the enclosing expression, the value is never actually read from 'pixels' |
Press '?' to see keyboard shortcuts
Keyboard shortcuts:
| 1 | /* testcombo.c |
| 2 | * Copyright (C) 2003 Kristian Rietveld |
| 3 | * |
| 4 | * This library is free software; you can redistribute it and/or |
| 5 | * modify it under the terms of the GNU Library 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 | * Library General Public License for more details. |
| 13 | * |
| 14 | * You should have received a copy of the GNU Library General Public |
| 15 | * License along with this library. If not, see <http://www.gnu.org/licenses/>. |
| 16 | */ |
| 17 | #include <ctk/ctk.h> |
| 18 | |
| 19 | #include <string.h> |
| 20 | #include <stdio.h> |
| 21 | |
| 22 | /** |
| 23 | * oh yes, this test app surely has a lot of ugly code |
| 24 | */ |
| 25 | |
| 26 | /* grid combo demo */ |
| 27 | static GdkPixbuf * |
| 28 | create_color_pixbuf (const char *color) |
| 29 | { |
| 30 | GdkPixbuf *pixbuf; |
| 31 | CdkRGBA rgba; |
| 32 | |
| 33 | int x; |
| 34 | int num; |
| 35 | guchar *pixels, *p; |
| 36 | |
| 37 | if (!cdk_rgba_parse (&rgba, color)) |
| 38 | return NULL((void*)0); |
| 39 | |
| 40 | pixbuf = gdk_pixbuf_new (GDK_COLORSPACE_RGB, |
| 41 | FALSE(0), 8, |
| 42 | 16, 16); |
| 43 | |
| 44 | p = pixels = gdk_pixbuf_get_pixels (pixbuf); |
Although the value stored to 'pixels' is used in the enclosing expression, the value is never actually read from 'pixels' | |
| 45 | |
| 46 | num = gdk_pixbuf_get_width (pixbuf) * |
| 47 | gdk_pixbuf_get_height (pixbuf); |
| 48 | |
| 49 | for (x = 0; x < num; x++) { |
| 50 | p[0] = rgba.red * 255; |
| 51 | p[1] = rgba.green * 255; |
| 52 | p[2] = rgba.blue * 255; |
| 53 | p += 3; |
| 54 | } |
| 55 | |
| 56 | return pixbuf; |
| 57 | } |
| 58 | |
| 59 | static CtkWidget * |
| 60 | create_combo_box_grid_demo (void) |
| 61 | { |
| 62 | CtkWidget *combo; |
| 63 | CtkTreeIter iter; |
| 64 | GdkPixbuf *pixbuf; |
| 65 | CtkCellRenderer *cell = ctk_cell_renderer_pixbuf_new (); |
| 66 | CtkListStore *store; |
| 67 | |
| 68 | store = ctk_list_store_new (3, GDK_TYPE_PIXBUF(gdk_pixbuf_get_type ()), G_TYPE_INT((GType) ((6) << (2))), G_TYPE_INT((GType) ((6) << (2)))); |
| 69 | |
| 70 | /* first row */ |
| 71 | pixbuf = create_color_pixbuf ("red"); |
| 72 | ctk_list_store_append (store, &iter); |
| 73 | ctk_list_store_set (store, &iter, |
| 74 | 0, pixbuf, |
| 75 | 1, 1, /* row span */ |
| 76 | 2, 1, /* column span */ |
| 77 | -1); |
| 78 | g_object_unref (pixbuf); |
| 79 | |
| 80 | pixbuf = create_color_pixbuf ("green"); |
| 81 | ctk_list_store_append (store, &iter); |
| 82 | ctk_list_store_set (store, &iter, |
| 83 | 0, pixbuf, |
| 84 | 1, 1, |
| 85 | 2, 1, |
| 86 | -1); |
| 87 | g_object_unref (pixbuf); |
| 88 | |
| 89 | pixbuf = create_color_pixbuf ("blue"); |
| 90 | ctk_list_store_append (store, &iter); |
| 91 | ctk_list_store_set (store, &iter, |
| 92 | 0, pixbuf, |
| 93 | 1, 1, |
| 94 | 2, 1, |
| 95 | -1); |
| 96 | g_object_unref (pixbuf); |
| 97 | |
| 98 | /* second row */ |
| 99 | pixbuf = create_color_pixbuf ("yellow"); |
| 100 | ctk_list_store_append (store, &iter); |
| 101 | ctk_list_store_set (store, &iter, |
| 102 | 0, pixbuf, |
| 103 | 1, 1, |
| 104 | 2, 2, /* Span 2 columns */ |
| 105 | -1); |
| 106 | g_object_unref (pixbuf); |
| 107 | |
| 108 | pixbuf = create_color_pixbuf ("black"); |
| 109 | ctk_list_store_append (store, &iter); |
| 110 | ctk_list_store_set (store, &iter, |
| 111 | 0, pixbuf, |
| 112 | 1, 2, /* Span 2 rows */ |
| 113 | 2, 1, |
| 114 | -1); |
| 115 | g_object_unref (pixbuf); |
| 116 | |
| 117 | /* third row */ |
| 118 | pixbuf = create_color_pixbuf ("gray"); |
| 119 | ctk_list_store_append (store, &iter); |
| 120 | ctk_list_store_set (store, &iter, |
| 121 | 0, pixbuf, |
| 122 | 1, 1, |
| 123 | 2, 1, |
| 124 | -1); |
| 125 | g_object_unref (pixbuf); |
| 126 | |
| 127 | pixbuf = create_color_pixbuf ("magenta"); |
| 128 | ctk_list_store_append (store, &iter); |
| 129 | ctk_list_store_set (store, &iter, |
| 130 | 0, pixbuf, |
| 131 | 1, 1, |
| 132 | 2, 1, |
| 133 | -1); |
| 134 | g_object_unref (pixbuf); |
| 135 | |
| 136 | /* Create ComboBox after model to avoid ctk_menu_attach() warnings(?) */ |
| 137 | combo = ctk_combo_box_new_with_model (CTK_TREE_MODEL (store)((((CtkTreeModel*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((store)), ((ctk_tree_model_get_type ()))))))); |
| 138 | g_object_unref (store); |
| 139 | |
| 140 | ctk_cell_layout_pack_start (CTK_CELL_LAYOUT (combo)((((CtkCellLayout*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((combo)), ((ctk_cell_layout_get_type ())))))), |
| 141 | cell, TRUE(!(0))); |
| 142 | ctk_cell_layout_set_attributes (CTK_CELL_LAYOUT (combo)((((CtkCellLayout*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((combo)), ((ctk_cell_layout_get_type ())))))), |
| 143 | cell, "pixbuf", 0, NULL((void*)0)); |
| 144 | |
| 145 | /* Set wrap-width != 0 to enforce grid mode */ |
| 146 | ctk_combo_box_set_wrap_width (CTK_COMBO_BOX (combo)((((CtkComboBox*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((combo)), ((ctk_combo_box_get_type ())))))), 3); |
| 147 | ctk_combo_box_set_row_span_column (CTK_COMBO_BOX (combo)((((CtkComboBox*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((combo)), ((ctk_combo_box_get_type ())))))), 1); |
| 148 | ctk_combo_box_set_column_span_column (CTK_COMBO_BOX (combo)((((CtkComboBox*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((combo)), ((ctk_combo_box_get_type ())))))), 2); |
| 149 | |
| 150 | ctk_combo_box_set_active (CTK_COMBO_BOX (combo)((((CtkComboBox*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((combo)), ((ctk_combo_box_get_type ())))))), 0); |
| 151 | |
| 152 | return combo; |
| 153 | } |
| 154 | |
| 155 | /* blaat */ |
| 156 | static CtkTreeModel * |
| 157 | create_tree_blaat (void) |
| 158 | { |
| 159 | CtkWidget *cellview; |
| 160 | CtkTreeIter iter, iter2; |
| 161 | CtkTreeStore *store; |
| 162 | |
| 163 | cellview = ctk_cell_view_new (); |
| 164 | |
| 165 | store = ctk_tree_store_new (3, G_TYPE_STRING((GType) ((16) << (2))), G_TYPE_STRING((GType) ((16) << (2))), G_TYPE_BOOLEAN((GType) ((5) << (2)))); |
| 166 | |
| 167 | ctk_tree_store_append (store, &iter, NULL((void*)0)); |
| 168 | ctk_tree_store_set (store, &iter, |
| 169 | 0, "dialog-warning", |
| 170 | 1, "dialog-warning", |
| 171 | 2, FALSE(0), |
| 172 | -1); |
| 173 | |
| 174 | ctk_tree_store_append (store, &iter2, &iter); |
| 175 | ctk_tree_store_set (store, &iter2, |
| 176 | 0, "process-stop", |
| 177 | 1, "process-stop", |
| 178 | 2, FALSE(0), |
| 179 | -1); |
| 180 | |
| 181 | ctk_tree_store_append (store, &iter2, &iter); |
| 182 | ctk_tree_store_set (store, &iter2, |
| 183 | 0, "document-new", |
| 184 | 1, "document-new", |
| 185 | 2, FALSE(0), |
| 186 | -1); |
| 187 | |
| 188 | ctk_tree_store_append (store, &iter, NULL((void*)0)); |
| 189 | ctk_tree_store_set (store, &iter, |
| 190 | 0, "edit-clear", |
| 191 | 1, "edit-clear", |
| 192 | 2, FALSE(0), |
| 193 | -1); |
| 194 | |
| 195 | #if 0 |
| 196 | ctk_tree_store_append (store, &iter, NULL((void*)0)); |
| 197 | ctk_tree_store_set (store, &iter, |
| 198 | 0, NULL((void*)0), |
| 199 | 1, "separator", |
| 200 | 2, TRUE(!(0)), |
| 201 | -1); |
| 202 | #endif |
| 203 | |
| 204 | ctk_tree_store_append (store, &iter, NULL((void*)0)); |
| 205 | ctk_tree_store_set (store, &iter, |
| 206 | 0, "document-open", |
| 207 | 1, "document-open", |
| 208 | 2, FALSE(0), |
| 209 | -1); |
| 210 | |
| 211 | ctk_widget_destroy (cellview); |
| 212 | |
| 213 | return CTK_TREE_MODEL (store)((((CtkTreeModel*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((store)), ((ctk_tree_model_get_type ())))))); |
| 214 | } |
| 215 | |
| 216 | static CtkTreeModel * |
| 217 | create_empty_list_blaat (void) |
| 218 | { |
| 219 | CtkWidget *cellview; |
| 220 | CtkTreeIter iter; |
| 221 | CtkListStore *store; |
| 222 | |
| 223 | cellview = ctk_cell_view_new (); |
| 224 | |
| 225 | store = ctk_list_store_new (2, G_TYPE_STRING((GType) ((16) << (2))), G_TYPE_STRING((GType) ((16) << (2)))); |
| 226 | |
| 227 | ctk_list_store_append (store, &iter); |
| 228 | ctk_list_store_set (store, &iter, |
| 229 | 0, "dialog-warning", |
| 230 | 1, "dialog-warning", |
| 231 | -1); |
| 232 | |
| 233 | ctk_widget_destroy (cellview); |
| 234 | |
| 235 | return CTK_TREE_MODEL (store)((((CtkTreeModel*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((store)), ((ctk_tree_model_get_type ())))))); |
| 236 | } |
| 237 | |
| 238 | static void |
| 239 | populate_list_blaat (gpointer data) |
| 240 | { |
| 241 | CtkComboBox *combo_box = CTK_COMBO_BOX (data)((((CtkComboBox*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((data)), ((ctk_combo_box_get_type ())))))); |
| 242 | CtkListStore *store; |
| 243 | CtkWidget *cellview; |
| 244 | CtkTreeIter iter; |
| 245 | |
| 246 | store = CTK_LIST_STORE (ctk_combo_box_get_model (combo_box))((((CtkListStore*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((ctk_combo_box_get_model (combo_box))), ((ctk_list_store_get_type ())))))); |
| 247 | |
| 248 | ctk_tree_model_get_iter_first (CTK_TREE_MODEL (store)((((CtkTreeModel*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((store)), ((ctk_tree_model_get_type ())))))), &iter); |
| 249 | |
| 250 | if (ctk_tree_model_iter_next (CTK_TREE_MODEL (store)((((CtkTreeModel*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((store)), ((ctk_tree_model_get_type ())))))), &iter)) |
| 251 | return; |
| 252 | |
| 253 | cellview = ctk_cell_view_new (); |
| 254 | |
| 255 | ctk_list_store_append (store, &iter); |
| 256 | ctk_list_store_set (store, &iter, |
| 257 | 0, "process-stop", |
| 258 | 1, "process-stop", |
| 259 | -1); |
| 260 | |
| 261 | ctk_list_store_append (store, &iter); |
| 262 | ctk_list_store_set (store, &iter, |
| 263 | 0, "document-new", |
| 264 | 1, "document-new", |
| 265 | -1); |
| 266 | |
| 267 | ctk_list_store_append (store, &iter); |
| 268 | ctk_list_store_set (store, &iter, |
| 269 | 0, "edit-clear", |
| 270 | 1, "edit-clear", |
| 271 | -1); |
| 272 | |
| 273 | ctk_list_store_append (store, &iter); |
| 274 | ctk_list_store_set (store, &iter, |
| 275 | 0, NULL((void*)0), |
| 276 | 1, "separator", |
| 277 | -1); |
| 278 | |
| 279 | ctk_list_store_append (store, &iter); |
| 280 | ctk_list_store_set (store, &iter, |
| 281 | 0, "document-open", |
| 282 | 1, "document-open", |
| 283 | -1); |
| 284 | |
| 285 | ctk_widget_destroy (cellview); |
| 286 | } |
| 287 | |
| 288 | static CtkTreeModel * |
| 289 | create_list_blaat (void) |
| 290 | { |
| 291 | CtkWidget *cellview; |
| 292 | CtkTreeIter iter; |
| 293 | CtkListStore *store; |
| 294 | |
| 295 | cellview = ctk_cell_view_new (); |
| 296 | |
| 297 | store = ctk_list_store_new (2, G_TYPE_STRING((GType) ((16) << (2))), G_TYPE_STRING((GType) ((16) << (2)))); |
| 298 | |
| 299 | ctk_list_store_append (store, &iter); |
| 300 | ctk_list_store_set (store, &iter, |
| 301 | 0, "dialog-warning", |
| 302 | 1, "dialog-warning", |
| 303 | -1); |
| 304 | |
| 305 | ctk_list_store_append (store, &iter); |
| 306 | ctk_list_store_set (store, &iter, |
| 307 | 0, "process-stop", |
| 308 | 1, "process-stop", |
| 309 | -1); |
| 310 | |
| 311 | ctk_list_store_append (store, &iter); |
| 312 | ctk_list_store_set (store, &iter, |
| 313 | 0, "document-new", |
| 314 | 1, "document-new", |
| 315 | -1); |
| 316 | |
| 317 | ctk_list_store_append (store, &iter); |
| 318 | ctk_list_store_set (store, &iter, |
| 319 | 0, "edit-clear", |
| 320 | 1, "edit-clear", |
| 321 | -1); |
| 322 | |
| 323 | ctk_list_store_append (store, &iter); |
| 324 | ctk_list_store_set (store, &iter, |
| 325 | 0, NULL((void*)0), |
| 326 | 1, "separator", |
| 327 | -1); |
| 328 | |
| 329 | ctk_list_store_append (store, &iter); |
| 330 | ctk_list_store_set (store, &iter, |
| 331 | 0, "document-open", |
| 332 | 1, "document-open", |
| 333 | -1); |
| 334 | |
| 335 | ctk_widget_destroy (cellview); |
| 336 | |
| 337 | return CTK_TREE_MODEL (store)((((CtkTreeModel*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((store)), ((ctk_tree_model_get_type ())))))); |
| 338 | } |
| 339 | |
| 340 | |
| 341 | static CtkTreeModel * |
| 342 | create_list_long (void) |
| 343 | { |
| 344 | CtkTreeIter iter; |
| 345 | CtkListStore *store; |
| 346 | |
| 347 | store = ctk_list_store_new (1, G_TYPE_STRING((GType) ((16) << (2)))); |
| 348 | |
| 349 | ctk_list_store_append (store, &iter); |
| 350 | ctk_list_store_set (store, &iter, |
| 351 | 0, "here is some long long text that grows out of the combo's allocation", |
| 352 | -1); |
| 353 | |
| 354 | |
| 355 | ctk_list_store_append (store, &iter); |
| 356 | ctk_list_store_set (store, &iter, |
| 357 | 0, "with at least a few of these rows", |
| 358 | -1); |
| 359 | |
| 360 | ctk_list_store_append (store, &iter); |
| 361 | ctk_list_store_set (store, &iter, |
| 362 | 0, "so that we can get some ellipsized text here", |
| 363 | -1); |
| 364 | |
| 365 | ctk_list_store_append (store, &iter); |
| 366 | ctk_list_store_set (store, &iter, |
| 367 | 0, "and see the combo box menu being allocated without any constraints", |
| 368 | -1); |
| 369 | |
| 370 | return CTK_TREE_MODEL (store)((((CtkTreeModel*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((store)), ((ctk_tree_model_get_type ())))))); |
| 371 | } |
| 372 | |
| 373 | static CtkTreeModel * |
| 374 | create_food_list (void) |
| 375 | { |
| 376 | CtkTreeIter iter; |
| 377 | CtkListStore *store; |
| 378 | |
| 379 | store = ctk_list_store_new (2, G_TYPE_STRING((GType) ((16) << (2))), G_TYPE_STRING((GType) ((16) << (2)))); |
| 380 | ctk_list_store_append (store, &iter); |
| 381 | ctk_list_store_set (store, &iter, |
| 382 | 0, "Pepperoni", |
| 383 | 1, "Pizza", |
| 384 | -1); |
| 385 | |
| 386 | ctk_list_store_append (store, &iter); |
| 387 | ctk_list_store_set (store, &iter, |
| 388 | 0, "Cheese", |
| 389 | 1, "Burger", |
| 390 | -1); |
| 391 | |
| 392 | ctk_list_store_append (store, &iter); |
| 393 | ctk_list_store_set (store, &iter, |
| 394 | 0, "Pineapple", |
| 395 | 1, "Milkshake", |
| 396 | -1); |
| 397 | |
| 398 | ctk_list_store_append (store, &iter); |
| 399 | ctk_list_store_set (store, &iter, |
| 400 | 0, "Orange", |
| 401 | 1, "Soda", |
| 402 | -1); |
| 403 | |
| 404 | ctk_list_store_append (store, &iter); |
| 405 | ctk_list_store_set (store, &iter, |
| 406 | 0, "Club", |
| 407 | 1, "Sandwich", |
| 408 | -1); |
| 409 | |
| 410 | return CTK_TREE_MODEL (store)((((CtkTreeModel*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((store)), ((ctk_tree_model_get_type ())))))); |
| 411 | } |
| 412 | |
| 413 | |
| 414 | /* blaat */ |
| 415 | static CtkTreeModel * |
| 416 | create_phylogenetic_tree (void) |
| 417 | { |
| 418 | CtkTreeIter iter, iter2, iter3; |
| 419 | CtkTreeStore *store; |
| 420 | |
| 421 | store = ctk_tree_store_new (1,G_TYPE_STRING((GType) ((16) << (2)))); |
| 422 | |
| 423 | ctk_tree_store_append (store, &iter, NULL((void*)0)); |
| 424 | ctk_tree_store_set (store, &iter, |
| 425 | 0, "Eubacteria", |
| 426 | -1); |
| 427 | |
| 428 | ctk_tree_store_append (store, &iter2, &iter); |
| 429 | ctk_tree_store_set (store, &iter2, |
| 430 | 0, "Aquifecales", |
| 431 | -1); |
| 432 | |
| 433 | ctk_tree_store_append (store, &iter2, &iter); |
| 434 | ctk_tree_store_set (store, &iter2, |
| 435 | 0, "Thermotogales", |
| 436 | -1); |
| 437 | |
| 438 | ctk_tree_store_append (store, &iter2, &iter); |
| 439 | ctk_tree_store_set (store, &iter2, |
| 440 | 0, "Thermodesulfobacterium", |
| 441 | -1); |
| 442 | |
| 443 | ctk_tree_store_append (store, &iter2, &iter); |
| 444 | ctk_tree_store_set (store, &iter2, |
| 445 | 0, "Thermus-Deinococcus group", |
| 446 | -1); |
| 447 | |
| 448 | ctk_tree_store_append (store, &iter2, &iter); |
| 449 | ctk_tree_store_set (store, &iter2, |
| 450 | 0, "Chloroflecales", |
| 451 | -1); |
| 452 | |
| 453 | ctk_tree_store_append (store, &iter2, &iter); |
| 454 | ctk_tree_store_set (store, &iter2, |
| 455 | 0, "Cyanobacteria", |
| 456 | -1); |
| 457 | |
| 458 | ctk_tree_store_append (store, &iter2, &iter); |
| 459 | ctk_tree_store_set (store, &iter2, |
| 460 | 0, "Firmicutes", |
| 461 | -1); |
| 462 | |
| 463 | ctk_tree_store_append (store, &iter2, &iter); |
| 464 | ctk_tree_store_set (store, &iter2, |
| 465 | 0, "Leptospirillium Group", |
| 466 | -1); |
| 467 | |
| 468 | ctk_tree_store_append (store, &iter2, &iter); |
| 469 | ctk_tree_store_set (store, &iter2, |
| 470 | 0, "Synergistes", |
| 471 | -1); |
| 472 | ctk_tree_store_append (store, &iter2, &iter); |
| 473 | ctk_tree_store_set (store, &iter2, |
| 474 | 0, "Chlorobium-Flavobacteria group", |
| 475 | -1); |
| 476 | ctk_tree_store_append (store, &iter2, &iter); |
| 477 | ctk_tree_store_set (store, &iter2, |
| 478 | 0, "Chlamydia-Verrucomicrobia group", |
| 479 | -1); |
| 480 | |
| 481 | ctk_tree_store_append (store, &iter3, &iter2); |
| 482 | ctk_tree_store_set (store, &iter3, |
| 483 | 0, "Verrucomicrobia", |
| 484 | -1); |
| 485 | ctk_tree_store_append (store, &iter3, &iter2); |
| 486 | ctk_tree_store_set (store, &iter3, |
| 487 | 0, "Chlamydia", |
| 488 | -1); |
| 489 | |
| 490 | ctk_tree_store_append (store, &iter2, &iter); |
| 491 | ctk_tree_store_set (store, &iter2, |
| 492 | 0, "Flexistipes", |
| 493 | -1); |
| 494 | |
| 495 | |
| 496 | ctk_tree_store_append (store, &iter2, &iter); |
| 497 | ctk_tree_store_set (store, &iter2, |
| 498 | 0, "Fibrobacter group", |
| 499 | -1); |
| 500 | |
| 501 | |
| 502 | ctk_tree_store_append (store, &iter2, &iter); |
| 503 | ctk_tree_store_set (store, &iter2, |
| 504 | 0, "spirocheteus", |
| 505 | -1); |
| 506 | |
| 507 | |
| 508 | ctk_tree_store_append (store, &iter2, &iter); |
| 509 | ctk_tree_store_set (store, &iter2, |
| 510 | 0, "Proteobacteria", |
| 511 | -1); |
| 512 | |
| 513 | |
| 514 | ctk_tree_store_append (store, &iter3, &iter2); |
| 515 | ctk_tree_store_set (store, &iter3, |
| 516 | 0, "alpha", |
| 517 | -1); |
| 518 | |
| 519 | |
| 520 | ctk_tree_store_append (store, &iter3, &iter2); |
| 521 | ctk_tree_store_set (store, &iter3, |
| 522 | 0, "beta", |
| 523 | -1); |
| 524 | |
| 525 | |
| 526 | ctk_tree_store_append (store, &iter3, &iter2); |
| 527 | ctk_tree_store_set (store, &iter3, |
| 528 | 0, "delta ", |
| 529 | -1); |
| 530 | |
| 531 | |
| 532 | ctk_tree_store_append (store, &iter3, &iter2); |
| 533 | ctk_tree_store_set (store, &iter3, |
| 534 | 0, "epsilon", |
| 535 | -1); |
| 536 | |
| 537 | |
| 538 | ctk_tree_store_append (store, &iter3, &iter2); |
| 539 | ctk_tree_store_set (store, &iter3, |
| 540 | 0, "gamma ", |
| 541 | -1); |
| 542 | |
| 543 | |
| 544 | ctk_tree_store_append (store, &iter, NULL((void*)0)); |
| 545 | ctk_tree_store_set (store, &iter, |
| 546 | 0, "Eukaryotes", |
| 547 | -1); |
| 548 | |
| 549 | |
| 550 | ctk_tree_store_append (store, &iter2, &iter); |
| 551 | ctk_tree_store_set (store, &iter2, |
| 552 | 0, "Metazoa", |
| 553 | -1); |
| 554 | |
| 555 | |
| 556 | ctk_tree_store_append (store, &iter2, &iter); |
| 557 | ctk_tree_store_set (store, &iter2, |
| 558 | 0, "Bilateria", |
| 559 | -1); |
| 560 | |
| 561 | |
| 562 | ctk_tree_store_append (store, &iter2, &iter); |
| 563 | ctk_tree_store_set (store, &iter2, |
| 564 | 0, "Myxozoa", |
| 565 | -1); |
| 566 | |
| 567 | |
| 568 | ctk_tree_store_append (store, &iter2, &iter); |
| 569 | ctk_tree_store_set (store, &iter2, |
| 570 | 0, "Cnidaria", |
| 571 | -1); |
| 572 | |
| 573 | |
| 574 | ctk_tree_store_append (store, &iter2, &iter); |
| 575 | ctk_tree_store_set (store, &iter2, |
| 576 | 0, "Ctenophora", |
| 577 | -1); |
| 578 | |
| 579 | |
| 580 | ctk_tree_store_append (store, &iter2, &iter); |
| 581 | ctk_tree_store_set (store, &iter2, |
| 582 | 0, "Placozoa", |
| 583 | -1); |
| 584 | |
| 585 | |
| 586 | ctk_tree_store_append (store, &iter2, &iter); |
| 587 | ctk_tree_store_set (store, &iter2, |
| 588 | 0, "Porifera", |
| 589 | -1); |
| 590 | |
| 591 | |
| 592 | ctk_tree_store_append (store, &iter2, &iter); |
| 593 | ctk_tree_store_set (store, &iter2, |
| 594 | 0, "choanoflagellates", |
| 595 | -1); |
| 596 | |
| 597 | |
| 598 | ctk_tree_store_append (store, &iter2, &iter); |
| 599 | ctk_tree_store_set (store, &iter2, |
| 600 | 0, "Fungi", |
| 601 | -1); |
| 602 | |
| 603 | |
| 604 | ctk_tree_store_append (store, &iter2, &iter); |
| 605 | ctk_tree_store_set (store, &iter2, |
| 606 | 0, "Microsporidia", |
| 607 | -1); |
| 608 | |
| 609 | |
| 610 | ctk_tree_store_append (store, &iter2, &iter); |
| 611 | ctk_tree_store_set (store, &iter2, |
| 612 | 0, "Aleveolates", |
| 613 | -1); |
| 614 | |
| 615 | |
| 616 | ctk_tree_store_append (store, &iter2, &iter); |
| 617 | ctk_tree_store_set (store, &iter2, |
| 618 | 0, "Stramenopiles", |
| 619 | -1); |
| 620 | |
| 621 | |
| 622 | ctk_tree_store_append (store, &iter2, &iter); |
| 623 | ctk_tree_store_set (store, &iter2, |
| 624 | 0, "Rhodophyta", |
| 625 | -1); |
| 626 | |
| 627 | |
| 628 | ctk_tree_store_append (store, &iter2, &iter); |
| 629 | ctk_tree_store_set (store, &iter2, |
| 630 | 0, "Viridaeplantae", |
| 631 | -1); |
| 632 | |
| 633 | |
| 634 | ctk_tree_store_append (store, &iter2, &iter); |
| 635 | ctk_tree_store_set (store, &iter2, |
| 636 | 0, "crytomonads et al", |
| 637 | -1); |
| 638 | |
| 639 | |
| 640 | ctk_tree_store_append (store, &iter, NULL((void*)0)); |
| 641 | ctk_tree_store_set (store, &iter, |
| 642 | 0, "Archaea ", |
| 643 | -1); |
| 644 | |
| 645 | |
| 646 | ctk_tree_store_append (store, &iter2, &iter); |
| 647 | ctk_tree_store_set (store, &iter2, |
| 648 | 0, "Korarchaeota", |
| 649 | -1); |
| 650 | |
| 651 | |
| 652 | ctk_tree_store_append (store, &iter2, &iter); |
| 653 | ctk_tree_store_set (store, &iter2, |
| 654 | 0, "Crenarchaeota", |
| 655 | -1); |
| 656 | |
| 657 | |
| 658 | ctk_tree_store_append (store, &iter2, &iter); |
| 659 | ctk_tree_store_set (store, &iter2, |
| 660 | 0, "Buryarchaeota", |
| 661 | -1); |
| 662 | |
| 663 | return CTK_TREE_MODEL (store)((((CtkTreeModel*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((store)), ((ctk_tree_model_get_type ())))))); |
| 664 | } |
| 665 | |
| 666 | |
| 667 | /* blaat */ |
| 668 | static CtkTreeModel * |
| 669 | create_capital_tree (void) |
| 670 | { |
| 671 | CtkTreeIter iter, iter2; |
| 672 | CtkTreeStore *store; |
| 673 | |
| 674 | store = ctk_tree_store_new (1, G_TYPE_STRING((GType) ((16) << (2)))); |
| 675 | |
| 676 | ctk_tree_store_append (store, &iter, NULL((void*)0)); |
| 677 | ctk_tree_store_set (store, &iter, 0, "A - B", -1); |
| 678 | |
| 679 | ctk_tree_store_append (store, &iter2, &iter); |
| 680 | ctk_tree_store_set (store, &iter2, 0, "Albany", -1); |
| 681 | |
| 682 | ctk_tree_store_append (store, &iter2, &iter); |
| 683 | ctk_tree_store_set (store, &iter2, 0, "Annapolis", -1); |
| 684 | |
| 685 | ctk_tree_store_append (store, &iter2, &iter); |
| 686 | ctk_tree_store_set (store, &iter2, 0, "Atlanta", -1); |
| 687 | |
| 688 | ctk_tree_store_append (store, &iter2, &iter); |
| 689 | ctk_tree_store_set (store, &iter2, 0, "Augusta", -1); |
| 690 | |
| 691 | ctk_tree_store_append (store, &iter2, &iter); |
| 692 | ctk_tree_store_set (store, &iter2, 0, "Austin", -1); |
| 693 | |
| 694 | ctk_tree_store_append (store, &iter2, &iter); |
| 695 | ctk_tree_store_set (store, &iter2, 0, "Baton Rouge", -1); |
| 696 | |
| 697 | ctk_tree_store_append (store, &iter2, &iter); |
| 698 | ctk_tree_store_set (store, &iter2, 0, "Bismarck", -1); |
| 699 | |
| 700 | ctk_tree_store_append (store, &iter2, &iter); |
| 701 | ctk_tree_store_set (store, &iter2, 0, "Boise", -1); |
| 702 | |
| 703 | ctk_tree_store_append (store, &iter2, &iter); |
| 704 | ctk_tree_store_set (store, &iter2, 0, "Boston", -1); |
| 705 | |
| 706 | ctk_tree_store_append (store, &iter, NULL((void*)0)); |
| 707 | ctk_tree_store_set (store, &iter, 0, "C - D", -1); |
| 708 | |
| 709 | ctk_tree_store_append (store, &iter2, &iter); |
| 710 | ctk_tree_store_set (store, &iter2, 0, "Carson City", -1); |
| 711 | |
| 712 | ctk_tree_store_append (store, &iter2, &iter); |
| 713 | ctk_tree_store_set (store, &iter2, 0, "Charleston", -1); |
| 714 | |
| 715 | ctk_tree_store_append (store, &iter2, &iter); |
| 716 | ctk_tree_store_set (store, &iter2, 0, "Cheyenne", -1); |
| 717 | |
| 718 | ctk_tree_store_append (store, &iter2, &iter); |
| 719 | ctk_tree_store_set (store, &iter2, 0, "Columbia", -1); |
| 720 | |
| 721 | ctk_tree_store_append (store, &iter2, &iter); |
| 722 | ctk_tree_store_set (store, &iter2, 0, "Columbus", -1); |
| 723 | |
| 724 | ctk_tree_store_append (store, &iter2, &iter); |
| 725 | ctk_tree_store_set (store, &iter2, 0, "Concord", -1); |
| 726 | |
| 727 | ctk_tree_store_append (store, &iter2, &iter); |
| 728 | ctk_tree_store_set (store, &iter2, 0, "Denver", -1); |
| 729 | |
| 730 | ctk_tree_store_append (store, &iter2, &iter); |
| 731 | ctk_tree_store_set (store, &iter2, 0, "Des Moines", -1); |
| 732 | |
| 733 | ctk_tree_store_append (store, &iter2, &iter); |
| 734 | ctk_tree_store_set (store, &iter2, 0, "Dover", -1); |
| 735 | |
| 736 | |
| 737 | ctk_tree_store_append (store, &iter, NULL((void*)0)); |
| 738 | ctk_tree_store_set (store, &iter, 0, "E - J", -1); |
| 739 | |
| 740 | ctk_tree_store_append (store, &iter2, &iter); |
| 741 | ctk_tree_store_set (store, &iter2, 0, "Frankfort", -1); |
| 742 | |
| 743 | ctk_tree_store_append (store, &iter2, &iter); |
| 744 | ctk_tree_store_set (store, &iter2, 0, "Harrisburg", -1); |
| 745 | |
| 746 | ctk_tree_store_append (store, &iter2, &iter); |
| 747 | ctk_tree_store_set (store, &iter2, 0, "Hartford", -1); |
| 748 | |
| 749 | ctk_tree_store_append (store, &iter2, &iter); |
| 750 | ctk_tree_store_set (store, &iter2, 0, "Helena", -1); |
| 751 | |
| 752 | ctk_tree_store_append (store, &iter2, &iter); |
| 753 | ctk_tree_store_set (store, &iter2, 0, "Honolulu", -1); |
| 754 | |
| 755 | ctk_tree_store_append (store, &iter2, &iter); |
| 756 | ctk_tree_store_set (store, &iter2, 0, "Indianapolis", -1); |
| 757 | |
| 758 | ctk_tree_store_append (store, &iter2, &iter); |
| 759 | ctk_tree_store_set (store, &iter2, 0, "Jackson", -1); |
| 760 | |
| 761 | ctk_tree_store_append (store, &iter2, &iter); |
| 762 | ctk_tree_store_set (store, &iter2, 0, "Jefferson City", -1); |
| 763 | |
| 764 | ctk_tree_store_append (store, &iter2, &iter); |
| 765 | ctk_tree_store_set (store, &iter2, 0, "Juneau", -1); |
| 766 | |
| 767 | |
| 768 | ctk_tree_store_append (store, &iter, NULL((void*)0)); |
| 769 | ctk_tree_store_set (store, &iter, 0, "K - O", -1); |
| 770 | |
| 771 | ctk_tree_store_append (store, &iter2, &iter); |
| 772 | ctk_tree_store_set (store, &iter2, 0, "Lansing", -1); |
| 773 | |
| 774 | ctk_tree_store_append (store, &iter2, &iter); |
| 775 | ctk_tree_store_set (store, &iter2, 0, "Lincoln", -1); |
| 776 | |
| 777 | ctk_tree_store_append (store, &iter2, &iter); |
| 778 | ctk_tree_store_set (store, &iter2, 0, "Little Rock", -1); |
| 779 | |
| 780 | ctk_tree_store_append (store, &iter2, &iter); |
| 781 | ctk_tree_store_set (store, &iter2, 0, "Madison", -1); |
| 782 | |
| 783 | ctk_tree_store_append (store, &iter2, &iter); |
| 784 | ctk_tree_store_set (store, &iter2, 0, "Montgomery", -1); |
| 785 | |
| 786 | ctk_tree_store_append (store, &iter2, &iter); |
| 787 | ctk_tree_store_set (store, &iter2, 0, "Montpelier", -1); |
| 788 | |
| 789 | ctk_tree_store_append (store, &iter2, &iter); |
| 790 | ctk_tree_store_set (store, &iter2, 0, "Nashville", -1); |
| 791 | |
| 792 | ctk_tree_store_append (store, &iter2, &iter); |
| 793 | ctk_tree_store_set (store, &iter2, 0, "Oklahoma City", -1); |
| 794 | |
| 795 | ctk_tree_store_append (store, &iter2, &iter); |
| 796 | ctk_tree_store_set (store, &iter2, 0, "Olympia", -1); |
| 797 | |
| 798 | |
| 799 | ctk_tree_store_append (store, &iter, NULL((void*)0)); |
| 800 | ctk_tree_store_set (store, &iter, 0, "P - S", -1); |
| 801 | |
| 802 | ctk_tree_store_append (store, &iter2, &iter); |
| 803 | ctk_tree_store_set (store, &iter2, 0, "Phoenix", -1); |
| 804 | |
| 805 | ctk_tree_store_append (store, &iter2, &iter); |
| 806 | ctk_tree_store_set (store, &iter2, 0, "Pierre", -1); |
| 807 | |
| 808 | ctk_tree_store_append (store, &iter2, &iter); |
| 809 | ctk_tree_store_set (store, &iter2, 0, "Providence", -1); |
| 810 | |
| 811 | ctk_tree_store_append (store, &iter2, &iter); |
| 812 | ctk_tree_store_set (store, &iter2, 0, "Raleigh", -1); |
| 813 | |
| 814 | ctk_tree_store_append (store, &iter2, &iter); |
| 815 | ctk_tree_store_set (store, &iter2, 0, "Richmond", -1); |
| 816 | |
| 817 | ctk_tree_store_append (store, &iter2, &iter); |
| 818 | ctk_tree_store_set (store, &iter2, 0, "Sacramento", -1); |
| 819 | |
| 820 | ctk_tree_store_append (store, &iter2, &iter); |
| 821 | ctk_tree_store_set (store, &iter2, 0, "Salem", -1); |
| 822 | |
| 823 | ctk_tree_store_append (store, &iter2, &iter); |
| 824 | ctk_tree_store_set (store, &iter2, 0, "Salt Lake City", -1); |
| 825 | |
| 826 | ctk_tree_store_append (store, &iter2, &iter); |
| 827 | ctk_tree_store_set (store, &iter2, 0, "Santa Fe", -1); |
| 828 | |
| 829 | ctk_tree_store_append (store, &iter2, &iter); |
| 830 | ctk_tree_store_set (store, &iter2, 0, "Springfield", -1); |
| 831 | |
| 832 | ctk_tree_store_append (store, &iter2, &iter); |
| 833 | ctk_tree_store_set (store, &iter2, 0, "St. Paul", -1); |
| 834 | |
| 835 | |
| 836 | ctk_tree_store_append (store, &iter, NULL((void*)0)); |
| 837 | ctk_tree_store_set (store, &iter, 0, "T - Z", -1); |
| 838 | |
| 839 | ctk_tree_store_append (store, &iter2, &iter); |
| 840 | ctk_tree_store_set (store, &iter2, 0, "Tallahassee", -1); |
| 841 | |
| 842 | ctk_tree_store_append (store, &iter2, &iter); |
| 843 | ctk_tree_store_set (store, &iter2, 0, "Topeka", -1); |
| 844 | |
| 845 | ctk_tree_store_append (store, &iter2, &iter); |
| 846 | ctk_tree_store_set (store, &iter2, 0, "Trenton", -1); |
| 847 | |
| 848 | return CTK_TREE_MODEL (store)((((CtkTreeModel*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((store)), ((ctk_tree_model_get_type ())))))); |
| 849 | } |
| 850 | |
| 851 | static void |
| 852 | capital_sensitive (CtkCellLayout *cell_layout G_GNUC_UNUSED__attribute__ ((__unused__)), |
| 853 | CtkCellRenderer *cell, |
| 854 | CtkTreeModel *tree_model, |
| 855 | CtkTreeIter *iter, |
| 856 | gpointer data G_GNUC_UNUSED__attribute__ ((__unused__))) |
| 857 | { |
| 858 | gboolean sensitive; |
| 859 | |
| 860 | sensitive = !ctk_tree_model_iter_has_child (tree_model, iter); |
| 861 | |
| 862 | g_object_set (cell, "sensitive", sensitive, NULL((void*)0)); |
| 863 | } |
| 864 | |
| 865 | static gboolean |
| 866 | capital_animation (gpointer data) |
| 867 | { |
| 868 | static gint insert_count = 0; |
| 869 | CtkTreeModel *model = CTK_TREE_MODEL (data)((((CtkTreeModel*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((data)), ((ctk_tree_model_get_type ())))))); |
| 870 | CtkTreePath *path; |
| 871 | CtkTreeIter iter, parent; |
| 872 | |
| 873 | switch (insert_count % 8) |
| 874 | { |
| 875 | case 0: |
| 876 | ctk_tree_store_insert (CTK_TREE_STORE (model)((((CtkTreeStore*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((model)), ((ctk_tree_store_get_type ())))))), &iter, NULL((void*)0), 0); |
| 877 | ctk_tree_store_set (CTK_TREE_STORE (model)((((CtkTreeStore*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((model)), ((ctk_tree_store_get_type ())))))), |
| 878 | &iter, |
| 879 | 0, "Europe", -1); |
| 880 | break; |
| 881 | |
| 882 | case 1: |
| 883 | path = ctk_tree_path_new_from_indices (0, -1); |
| 884 | ctk_tree_model_get_iter (model, &parent, path); |
| 885 | ctk_tree_path_free (path); |
| 886 | ctk_tree_store_insert (CTK_TREE_STORE (model)((((CtkTreeStore*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((model)), ((ctk_tree_store_get_type ())))))), &iter, &parent, 0); |
| 887 | ctk_tree_store_set (CTK_TREE_STORE (model)((((CtkTreeStore*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((model)), ((ctk_tree_store_get_type ())))))), |
| 888 | &iter, |
| 889 | 0, "Berlin", -1); |
| 890 | break; |
| 891 | |
| 892 | case 2: |
| 893 | path = ctk_tree_path_new_from_indices (0, -1); |
| 894 | ctk_tree_model_get_iter (model, &parent, path); |
| 895 | ctk_tree_path_free (path); |
| 896 | ctk_tree_store_insert (CTK_TREE_STORE (model)((((CtkTreeStore*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((model)), ((ctk_tree_store_get_type ())))))), &iter, &parent, 1); |
| 897 | ctk_tree_store_set (CTK_TREE_STORE (model)((((CtkTreeStore*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((model)), ((ctk_tree_store_get_type ())))))), |
| 898 | &iter, |
| 899 | 0, "London", -1); |
| 900 | break; |
| 901 | |
| 902 | case 3: |
| 903 | path = ctk_tree_path_new_from_indices (0, -1); |
| 904 | ctk_tree_model_get_iter (model, &parent, path); |
| 905 | ctk_tree_path_free (path); |
| 906 | ctk_tree_store_insert (CTK_TREE_STORE (model)((((CtkTreeStore*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((model)), ((ctk_tree_store_get_type ())))))), &iter, &parent, 2); |
| 907 | ctk_tree_store_set (CTK_TREE_STORE (model)((((CtkTreeStore*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((model)), ((ctk_tree_store_get_type ())))))), |
| 908 | &iter, |
| 909 | 0, "Paris", -1); |
| 910 | break; |
| 911 | |
| 912 | case 4: |
| 913 | path = ctk_tree_path_new_from_indices (0, 2, -1); |
| 914 | ctk_tree_model_get_iter (model, &iter, path); |
| 915 | ctk_tree_path_free (path); |
| 916 | ctk_tree_store_remove (CTK_TREE_STORE (model)((((CtkTreeStore*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((model)), ((ctk_tree_store_get_type ())))))), &iter); |
| 917 | break; |
| 918 | |
| 919 | case 5: |
| 920 | path = ctk_tree_path_new_from_indices (0, 1, -1); |
| 921 | ctk_tree_model_get_iter (model, &iter, path); |
| 922 | ctk_tree_path_free (path); |
| 923 | ctk_tree_store_remove (CTK_TREE_STORE (model)((((CtkTreeStore*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((model)), ((ctk_tree_store_get_type ())))))), &iter); |
| 924 | break; |
| 925 | |
| 926 | case 6: |
| 927 | path = ctk_tree_path_new_from_indices (0, 0, -1); |
| 928 | ctk_tree_model_get_iter (model, &iter, path); |
| 929 | ctk_tree_path_free (path); |
| 930 | ctk_tree_store_remove (CTK_TREE_STORE (model)((((CtkTreeStore*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((model)), ((ctk_tree_store_get_type ())))))), &iter); |
| 931 | break; |
| 932 | |
| 933 | case 7: |
| 934 | path = ctk_tree_path_new_from_indices (0, -1); |
| 935 | ctk_tree_model_get_iter (model, &iter, path); |
| 936 | ctk_tree_path_free (path); |
| 937 | ctk_tree_store_remove (CTK_TREE_STORE (model)((((CtkTreeStore*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((model)), ((ctk_tree_store_get_type ())))))), &iter); |
| 938 | break; |
| 939 | |
| 940 | default: ; |
| 941 | |
| 942 | } |
| 943 | insert_count++; |
| 944 | |
| 945 | return TRUE(!(0)); |
| 946 | } |
| 947 | |
| 948 | static void |
| 949 | setup_combo_entry (CtkComboBoxText *combo) |
| 950 | { |
| 951 | ctk_combo_box_text_append_text (combo, |
| 952 | "dum de dum"); |
| 953 | ctk_combo_box_text_append_text (combo, |
| 954 | "la la la"); |
| 955 | ctk_combo_box_text_append_text (combo, |
| 956 | "la la la dum de dum la la la la la la boom de da la la"); |
| 957 | ctk_combo_box_text_append_text (combo, |
| 958 | "bloop"); |
| 959 | ctk_combo_box_text_append_text (combo, |
| 960 | "bleep"); |
| 961 | ctk_combo_box_text_append_text (combo, |
| 962 | "klaas"); |
| 963 | ctk_combo_box_text_append_text (combo, |
| 964 | "klaas0"); |
| 965 | ctk_combo_box_text_append_text (combo, |
| 966 | "klaas1"); |
| 967 | ctk_combo_box_text_append_text (combo, |
| 968 | "klaas2"); |
| 969 | ctk_combo_box_text_append_text (combo, |
| 970 | "klaas3"); |
| 971 | ctk_combo_box_text_append_text (combo, |
| 972 | "klaas4"); |
| 973 | ctk_combo_box_text_append_text (combo, |
| 974 | "klaas5"); |
| 975 | ctk_combo_box_text_append_text (combo, |
| 976 | "klaas6"); |
| 977 | ctk_combo_box_text_append_text (combo, |
| 978 | "klaas7"); |
| 979 | ctk_combo_box_text_append_text (combo, |
| 980 | "klaas8"); |
| 981 | ctk_combo_box_text_append_text (combo, |
| 982 | "klaas9"); |
| 983 | ctk_combo_box_text_append_text (combo, |
| 984 | "klaasa"); |
| 985 | ctk_combo_box_text_append_text (combo, |
| 986 | "klaasb"); |
| 987 | ctk_combo_box_text_append_text (combo, |
| 988 | "klaasc"); |
| 989 | ctk_combo_box_text_append_text (combo, |
| 990 | "klaasd"); |
| 991 | ctk_combo_box_text_append_text (combo, |
| 992 | "klaase"); |
| 993 | ctk_combo_box_text_append_text (combo, |
| 994 | "klaasf"); |
| 995 | ctk_combo_box_text_append_text (combo, |
| 996 | "klaas10"); |
| 997 | ctk_combo_box_text_append_text (combo, |
| 998 | "klaas11"); |
| 999 | ctk_combo_box_text_append_text (combo, |
| 1000 | "klaas12"); |
| 1001 | } |
| 1002 | |
| 1003 | static void |
| 1004 | set_sensitive (CtkCellLayout *cell_layout G_GNUC_UNUSED__attribute__ ((__unused__)), |
| 1005 | CtkCellRenderer *cell, |
| 1006 | CtkTreeModel *tree_model, |
| 1007 | CtkTreeIter *iter, |
| 1008 | gpointer data G_GNUC_UNUSED__attribute__ ((__unused__))) |
| 1009 | { |
| 1010 | CtkTreePath *path; |
| 1011 | gint *indices; |
| 1012 | gboolean sensitive; |
| 1013 | |
| 1014 | path = ctk_tree_model_get_path (tree_model, iter); |
| 1015 | indices = ctk_tree_path_get_indices (path); |
| 1016 | sensitive = indices[0] != 1; |
| 1017 | ctk_tree_path_free (path); |
| 1018 | |
| 1019 | g_object_set (cell, "sensitive", sensitive, NULL((void*)0)); |
| 1020 | } |
| 1021 | |
| 1022 | static gboolean |
| 1023 | is_separator (CtkTreeModel *model, |
| 1024 | CtkTreeIter *iter, |
| 1025 | gpointer data G_GNUC_UNUSED__attribute__ ((__unused__))) |
| 1026 | { |
| 1027 | CtkTreePath *path; |
| 1028 | gboolean result; |
| 1029 | |
| 1030 | path = ctk_tree_model_get_path (model, iter); |
| 1031 | result = ctk_tree_path_get_indices (path)[0] == 4; |
| 1032 | ctk_tree_path_free (path); |
| 1033 | |
| 1034 | return result; |
| 1035 | |
| 1036 | } |
| 1037 | |
| 1038 | static void |
| 1039 | displayed_row_changed (CtkComboBox *combo, |
| 1040 | CtkCellView *cell) |
| 1041 | { |
| 1042 | gint row; |
| 1043 | CtkTreePath *path; |
| 1044 | |
| 1045 | row = ctk_combo_box_get_active (combo); |
| 1046 | path = ctk_tree_path_new_from_indices (row, -1); |
| 1047 | ctk_cell_view_set_displayed_row (cell, path); |
| 1048 | ctk_tree_path_free (path); |
| 1049 | } |
| 1050 | |
| 1051 | int |
| 1052 | main (int argc, char **argv) |
| 1053 | { |
| 1054 | CtkWidget *window, *cellview, *mainbox; |
| 1055 | CtkWidget *combobox, *comboboxtext, *comboboxgrid; |
| 1056 | CtkWidget *tmp, *boom; |
| 1057 | CtkCellRenderer *renderer; |
| 1058 | CtkTreeModel *model; |
| 1059 | CtkTreePath *path; |
| 1060 | CtkTreeIter iter; |
| 1061 | CdkRGBA color; |
| 1062 | CtkCellArea *area; |
| 1063 | gchar *text; |
| 1064 | gint i; |
| 1065 | |
| 1066 | ctk_init (&argc, &argv); |
| 1067 | |
| 1068 | if (g_getenv ("RTL")) |
| 1069 | ctk_widget_set_default_direction (CTK_TEXT_DIR_RTL); |
| 1070 | |
| 1071 | if (g_getenv ("LISTMODE")) |
| 1072 | { |
| 1073 | CtkCssProvider *provider = ctk_css_provider_new (); |
| 1074 | |
| 1075 | ctk_css_provider_load_from_data (provider, |
| 1076 | "* { -CtkComboBox-appears-as-list: true; }", |
| 1077 | -1, NULL((void*)0)); |
| 1078 | |
| 1079 | ctk_style_context_add_provider_for_screen (cdk_screen_get_default (), |
| 1080 | CTK_STYLE_PROVIDER (provider)((((CtkStyleProvider*) (void *) g_type_check_instance_cast (( GTypeInstance*) ((provider)), ((ctk_style_provider_get_type ( ))))))), |
| 1081 | CTK_STYLE_PROVIDER_PRIORITY_FALLBACK1); |
| 1082 | |
| 1083 | } |
| 1084 | |
| 1085 | window = ctk_window_new (CTK_WINDOW_TOPLEVEL); |
| 1086 | ctk_container_set_border_width (CTK_CONTAINER (window)((((CtkContainer*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((window)), ((ctk_container_get_type ())))))), 5); |
| 1087 | g_signal_connect (window, "destroy", ctk_main_quit, NULL)g_signal_connect_data ((window), ("destroy"), (ctk_main_quit) , (((void*)0)), ((void*)0), (GConnectFlags) 0); |
| 1088 | |
| 1089 | mainbox = ctk_box_new (CTK_ORIENTATION_VERTICAL, 2); |
| 1090 | ctk_container_add (CTK_CONTAINER (window)((((CtkContainer*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((window)), ((ctk_container_get_type ())))))), mainbox); |
| 1091 | |
| 1092 | /* CtkCellView */ |
| 1093 | tmp = ctk_frame_new ("CtkCellView"); |
| 1094 | ctk_box_pack_start (CTK_BOX (mainbox)((((CtkBox*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((mainbox)), ((ctk_box_get_type ())))))), tmp, FALSE(0), FALSE(0), 0); |
| 1095 | |
| 1096 | boom = ctk_box_new (CTK_ORIENTATION_VERTICAL, 0); |
| 1097 | ctk_container_set_border_width (CTK_CONTAINER (boom)((((CtkContainer*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((boom)), ((ctk_container_get_type ())))))), 5); |
| 1098 | ctk_container_add (CTK_CONTAINER (tmp)((((CtkContainer*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((tmp)), ((ctk_container_get_type ())))))), boom); |
| 1099 | |
| 1100 | cellview = ctk_cell_view_new (); |
| 1101 | renderer = ctk_cell_renderer_pixbuf_new (); |
| 1102 | ctk_cell_layout_pack_start (CTK_CELL_LAYOUT (cellview)((((CtkCellLayout*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((cellview)), ((ctk_cell_layout_get_type ())))))), |
| 1103 | renderer, |
| 1104 | FALSE(0)); |
| 1105 | g_object_set (renderer, "icon-name", "dialog-warning", NULL((void*)0)); |
| 1106 | |
| 1107 | renderer = ctk_cell_renderer_text_new (); |
| 1108 | ctk_cell_layout_pack_start (CTK_CELL_LAYOUT (cellview)((((CtkCellLayout*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((cellview)), ((ctk_cell_layout_get_type ())))))), |
| 1109 | renderer, |
| 1110 | TRUE(!(0))); |
| 1111 | g_object_set (renderer, "text", "la la la", NULL((void*)0)); |
| 1112 | ctk_container_add (CTK_CONTAINER (boom)((((CtkContainer*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((boom)), ((ctk_container_get_type ())))))), cellview); |
| 1113 | |
| 1114 | /* CtkComboBox list */ |
| 1115 | tmp = ctk_frame_new ("CtkComboBox (list)"); |
| 1116 | ctk_box_pack_start (CTK_BOX (mainbox)((((CtkBox*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((mainbox)), ((ctk_box_get_type ())))))), tmp, FALSE(0), FALSE(0), 0); |
| 1117 | |
| 1118 | boom = ctk_box_new (CTK_ORIENTATION_VERTICAL, 0); |
| 1119 | ctk_container_set_border_width (CTK_CONTAINER (boom)((((CtkContainer*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((boom)), ((ctk_container_get_type ())))))), 5); |
| 1120 | ctk_container_add (CTK_CONTAINER (tmp)((((CtkContainer*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((tmp)), ((ctk_container_get_type ())))))), boom); |
| 1121 | |
| 1122 | model = create_list_blaat (); |
| 1123 | combobox = ctk_combo_box_new_with_model (model); |
| 1124 | g_object_unref (model); |
| 1125 | ctk_container_add (CTK_CONTAINER (boom)((((CtkContainer*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((boom)), ((ctk_container_get_type ())))))), combobox); |
| 1126 | |
| 1127 | renderer = ctk_cell_renderer_pixbuf_new (); |
| 1128 | ctk_cell_layout_pack_start (CTK_CELL_LAYOUT (combobox)((((CtkCellLayout*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((combobox)), ((ctk_cell_layout_get_type ())))))), |
| 1129 | renderer, |
| 1130 | FALSE(0)); |
| 1131 | ctk_cell_layout_set_attributes (CTK_CELL_LAYOUT (combobox)((((CtkCellLayout*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((combobox)), ((ctk_cell_layout_get_type ())))))), renderer, |
| 1132 | "icon-name", 0, |
| 1133 | NULL((void*)0)); |
| 1134 | ctk_cell_layout_set_cell_data_func (CTK_CELL_LAYOUT (combobox)((((CtkCellLayout*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((combobox)), ((ctk_cell_layout_get_type ())))))), |
| 1135 | renderer, |
| 1136 | set_sensitive, |
| 1137 | NULL((void*)0), NULL((void*)0)); |
| 1138 | |
| 1139 | renderer = ctk_cell_renderer_text_new (); |
| 1140 | ctk_cell_layout_pack_start (CTK_CELL_LAYOUT (combobox)((((CtkCellLayout*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((combobox)), ((ctk_cell_layout_get_type ())))))), |
| 1141 | renderer, |
| 1142 | TRUE(!(0))); |
| 1143 | ctk_cell_layout_set_attributes (CTK_CELL_LAYOUT (combobox)((((CtkCellLayout*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((combobox)), ((ctk_cell_layout_get_type ())))))), renderer, |
| 1144 | "text", 1, |
| 1145 | NULL((void*)0)); |
| 1146 | ctk_cell_layout_set_cell_data_func (CTK_CELL_LAYOUT (combobox)((((CtkCellLayout*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((combobox)), ((ctk_cell_layout_get_type ())))))), |
| 1147 | renderer, |
| 1148 | set_sensitive, |
| 1149 | NULL((void*)0), NULL((void*)0)); |
| 1150 | ctk_combo_box_set_row_separator_func (CTK_COMBO_BOX (combobox)((((CtkComboBox*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((combobox)), ((ctk_combo_box_get_type ())))))), |
| 1151 | is_separator, NULL((void*)0), NULL((void*)0)); |
| 1152 | |
| 1153 | ctk_combo_box_set_active (CTK_COMBO_BOX (combobox)((((CtkComboBox*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((combobox)), ((ctk_combo_box_get_type ())))))), 0); |
| 1154 | |
| 1155 | /* CtkComboBox dynamic list */ |
| 1156 | tmp = ctk_frame_new ("CtkComboBox (dynamic list)"); |
| 1157 | ctk_box_pack_start (CTK_BOX (mainbox)((((CtkBox*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((mainbox)), ((ctk_box_get_type ())))))), tmp, FALSE(0), FALSE(0), 0); |
| 1158 | |
| 1159 | boom = ctk_box_new (CTK_ORIENTATION_VERTICAL, 0); |
| 1160 | ctk_container_set_border_width (CTK_CONTAINER (boom)((((CtkContainer*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((boom)), ((ctk_container_get_type ())))))), 5); |
| 1161 | ctk_container_add (CTK_CONTAINER (tmp)((((CtkContainer*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((tmp)), ((ctk_container_get_type ())))))), boom); |
| 1162 | |
| 1163 | model = create_empty_list_blaat (); |
| 1164 | combobox = ctk_combo_box_new_with_model (model); |
| 1165 | g_signal_connect (combobox, "notify::popup-shown",g_signal_connect_data ((combobox), ("notify::popup-shown"), ( ((GCallback) (populate_list_blaat))), (combobox), ((void*)0), (GConnectFlags) 0) |
| 1166 | G_CALLBACK (populate_list_blaat), combobox)g_signal_connect_data ((combobox), ("notify::popup-shown"), ( ((GCallback) (populate_list_blaat))), (combobox), ((void*)0), (GConnectFlags) 0); |
| 1167 | |
| 1168 | g_object_unref (model); |
| 1169 | ctk_container_add (CTK_CONTAINER (boom)((((CtkContainer*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((boom)), ((ctk_container_get_type ())))))), combobox); |
| 1170 | |
| 1171 | renderer = ctk_cell_renderer_pixbuf_new (); |
| 1172 | ctk_cell_layout_pack_start (CTK_CELL_LAYOUT (combobox)((((CtkCellLayout*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((combobox)), ((ctk_cell_layout_get_type ())))))), |
| 1173 | renderer, |
| 1174 | FALSE(0)); |
| 1175 | ctk_cell_layout_set_attributes (CTK_CELL_LAYOUT (combobox)((((CtkCellLayout*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((combobox)), ((ctk_cell_layout_get_type ())))))), renderer, |
| 1176 | "icon-name", 0, |
| 1177 | NULL((void*)0)); |
| 1178 | ctk_cell_layout_set_cell_data_func (CTK_CELL_LAYOUT (combobox)((((CtkCellLayout*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((combobox)), ((ctk_cell_layout_get_type ())))))), |
| 1179 | renderer, |
| 1180 | set_sensitive, |
| 1181 | NULL((void*)0), NULL((void*)0)); |
| 1182 | |
| 1183 | renderer = ctk_cell_renderer_text_new (); |
| 1184 | ctk_cell_layout_pack_start (CTK_CELL_LAYOUT (combobox)((((CtkCellLayout*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((combobox)), ((ctk_cell_layout_get_type ())))))), |
| 1185 | renderer, |
| 1186 | TRUE(!(0))); |
| 1187 | ctk_cell_layout_set_attributes (CTK_CELL_LAYOUT (combobox)((((CtkCellLayout*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((combobox)), ((ctk_cell_layout_get_type ())))))), renderer, |
| 1188 | "text", 1, |
| 1189 | NULL((void*)0)); |
| 1190 | ctk_cell_layout_set_cell_data_func (CTK_CELL_LAYOUT (combobox)((((CtkCellLayout*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((combobox)), ((ctk_cell_layout_get_type ())))))), |
| 1191 | renderer, |
| 1192 | set_sensitive, |
| 1193 | NULL((void*)0), NULL((void*)0)); |
| 1194 | ctk_combo_box_set_row_separator_func (CTK_COMBO_BOX (combobox)((((CtkComboBox*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((combobox)), ((ctk_combo_box_get_type ())))))), |
| 1195 | is_separator, NULL((void*)0), NULL((void*)0)); |
| 1196 | |
| 1197 | ctk_combo_box_set_active (CTK_COMBO_BOX (combobox)((((CtkComboBox*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((combobox)), ((ctk_combo_box_get_type ())))))), 0); |
| 1198 | |
| 1199 | /* CtkComboBox custom entry */ |
| 1200 | tmp = ctk_frame_new ("CtkComboBox (custom)"); |
| 1201 | ctk_box_pack_start (CTK_BOX (mainbox)((((CtkBox*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((mainbox)), ((ctk_box_get_type ())))))), tmp, FALSE(0), FALSE(0), 0); |
| 1202 | |
| 1203 | boom = ctk_box_new (CTK_ORIENTATION_VERTICAL, 0); |
| 1204 | ctk_container_set_border_width (CTK_CONTAINER (boom)((((CtkContainer*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((boom)), ((ctk_container_get_type ())))))), 5); |
| 1205 | ctk_container_add (CTK_CONTAINER (tmp)((((CtkContainer*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((tmp)), ((ctk_container_get_type ())))))), boom); |
| 1206 | |
| 1207 | model = create_list_blaat (); |
| 1208 | combobox = ctk_combo_box_new_with_model (model); |
| 1209 | g_object_unref (model); |
| 1210 | ctk_container_add (CTK_CONTAINER (boom)((((CtkContainer*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((boom)), ((ctk_container_get_type ())))))), combobox); |
| 1211 | |
| 1212 | renderer = ctk_cell_renderer_pixbuf_new (); |
| 1213 | ctk_cell_layout_pack_start (CTK_CELL_LAYOUT (combobox)((((CtkCellLayout*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((combobox)), ((ctk_cell_layout_get_type ())))))), |
| 1214 | renderer, |
| 1215 | FALSE(0)); |
| 1216 | ctk_cell_layout_set_attributes (CTK_CELL_LAYOUT (combobox)((((CtkCellLayout*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((combobox)), ((ctk_cell_layout_get_type ())))))), renderer, |
| 1217 | "icon-name", 0, |
| 1218 | NULL((void*)0)); |
| 1219 | ctk_cell_layout_set_cell_data_func (CTK_CELL_LAYOUT (combobox)((((CtkCellLayout*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((combobox)), ((ctk_cell_layout_get_type ())))))), |
| 1220 | renderer, |
| 1221 | set_sensitive, |
| 1222 | NULL((void*)0), NULL((void*)0)); |
| 1223 | |
| 1224 | renderer = ctk_cell_renderer_text_new (); |
| 1225 | ctk_cell_layout_pack_start (CTK_CELL_LAYOUT (combobox)((((CtkCellLayout*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((combobox)), ((ctk_cell_layout_get_type ())))))), |
| 1226 | renderer, |
| 1227 | TRUE(!(0))); |
| 1228 | ctk_cell_layout_set_attributes (CTK_CELL_LAYOUT (combobox)((((CtkCellLayout*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((combobox)), ((ctk_cell_layout_get_type ())))))), renderer, |
| 1229 | "text", 1, |
| 1230 | NULL((void*)0)); |
| 1231 | ctk_cell_layout_set_cell_data_func (CTK_CELL_LAYOUT (combobox)((((CtkCellLayout*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((combobox)), ((ctk_cell_layout_get_type ())))))), |
| 1232 | renderer, |
| 1233 | set_sensitive, |
| 1234 | NULL((void*)0), NULL((void*)0)); |
| 1235 | ctk_combo_box_set_row_separator_func (CTK_COMBO_BOX (combobox)((((CtkComboBox*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((combobox)), ((ctk_combo_box_get_type ())))))), |
| 1236 | is_separator, NULL((void*)0), NULL((void*)0)); |
| 1237 | |
| 1238 | ctk_combo_box_set_active (CTK_COMBO_BOX (combobox)((((CtkComboBox*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((combobox)), ((ctk_combo_box_get_type ())))))), 0); |
| 1239 | |
| 1240 | tmp = ctk_cell_view_new (); |
| 1241 | ctk_widget_show (tmp); |
| 1242 | ctk_cell_view_set_model (CTK_CELL_VIEW (tmp)((((CtkCellView*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((tmp)), ((ctk_cell_view_get_type ())))))), model); |
| 1243 | |
| 1244 | renderer = ctk_cell_renderer_text_new (); |
| 1245 | ctk_cell_layout_pack_start (CTK_CELL_LAYOUT (tmp)((((CtkCellLayout*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((tmp)), ((ctk_cell_layout_get_type ())))))), renderer, TRUE(!(0))); |
| 1246 | ctk_cell_layout_set_attributes (CTK_CELL_LAYOUT (tmp)((((CtkCellLayout*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((tmp)), ((ctk_cell_layout_get_type ())))))), renderer, |
| 1247 | "text", 1, |
| 1248 | NULL((void*)0)); |
| 1249 | color.red = 1.0; |
| 1250 | color.blue = 1.0; |
| 1251 | color.green = 0; |
| 1252 | color.alpha = 1.0; |
| 1253 | ctk_cell_view_set_background_rgba (CTK_CELL_VIEW (tmp)((((CtkCellView*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((tmp)), ((ctk_cell_view_get_type ())))))), &color); |
| 1254 | displayed_row_changed (CTK_COMBO_BOX (combobox)((((CtkComboBox*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((combobox)), ((ctk_combo_box_get_type ())))))), CTK_CELL_VIEW (tmp)((((CtkCellView*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((tmp)), ((ctk_cell_view_get_type ()))))))); |
| 1255 | g_signal_connect (combobox, "changed", G_CALLBACK (displayed_row_changed), tmp)g_signal_connect_data ((combobox), ("changed"), (((GCallback) (displayed_row_changed))), (tmp), ((void*)0), (GConnectFlags ) 0); |
| 1256 | |
| 1257 | ctk_container_add (CTK_CONTAINER (combobox)((((CtkContainer*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((combobox)), ((ctk_container_get_type ())))))), tmp); |
| 1258 | |
| 1259 | /* CtkComboBox tree */ |
| 1260 | tmp = ctk_frame_new ("CtkComboBox (tree)"); |
| 1261 | ctk_box_pack_start (CTK_BOX (mainbox)((((CtkBox*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((mainbox)), ((ctk_box_get_type ())))))), tmp, FALSE(0), FALSE(0), 0); |
| 1262 | |
| 1263 | boom = ctk_box_new (CTK_ORIENTATION_VERTICAL, 0); |
| 1264 | ctk_container_set_border_width (CTK_CONTAINER (boom)((((CtkContainer*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((boom)), ((ctk_container_get_type ())))))), 5); |
| 1265 | ctk_container_add (CTK_CONTAINER (tmp)((((CtkContainer*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((tmp)), ((ctk_container_get_type ())))))), boom); |
| 1266 | |
| 1267 | model = create_tree_blaat (); |
| 1268 | combobox = ctk_combo_box_new_with_model (model); |
| 1269 | g_object_unref (model); |
| 1270 | ctk_container_add (CTK_CONTAINER (boom)((((CtkContainer*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((boom)), ((ctk_container_get_type ())))))), combobox); |
| 1271 | |
| 1272 | renderer = ctk_cell_renderer_pixbuf_new (); |
| 1273 | ctk_cell_layout_pack_start (CTK_CELL_LAYOUT (combobox)((((CtkCellLayout*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((combobox)), ((ctk_cell_layout_get_type ())))))), |
| 1274 | renderer, |
| 1275 | FALSE(0)); |
| 1276 | ctk_cell_layout_set_attributes (CTK_CELL_LAYOUT (combobox)((((CtkCellLayout*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((combobox)), ((ctk_cell_layout_get_type ())))))), renderer, |
| 1277 | "icon-name", 0, |
| 1278 | NULL((void*)0)); |
| 1279 | ctk_cell_layout_set_cell_data_func (CTK_CELL_LAYOUT (combobox)((((CtkCellLayout*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((combobox)), ((ctk_cell_layout_get_type ())))))), |
| 1280 | renderer, |
| 1281 | set_sensitive, |
| 1282 | NULL((void*)0), NULL((void*)0)); |
| 1283 | |
| 1284 | renderer = ctk_cell_renderer_text_new (); |
| 1285 | ctk_cell_layout_pack_start (CTK_CELL_LAYOUT (combobox)((((CtkCellLayout*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((combobox)), ((ctk_cell_layout_get_type ())))))), |
| 1286 | renderer, |
| 1287 | TRUE(!(0))); |
| 1288 | ctk_cell_layout_set_attributes (CTK_CELL_LAYOUT (combobox)((((CtkCellLayout*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((combobox)), ((ctk_cell_layout_get_type ())))))), renderer, |
| 1289 | "text", 1, |
| 1290 | NULL((void*)0)); |
| 1291 | ctk_cell_layout_set_cell_data_func (CTK_CELL_LAYOUT (combobox)((((CtkCellLayout*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((combobox)), ((ctk_cell_layout_get_type ())))))), |
| 1292 | renderer, |
| 1293 | set_sensitive, |
| 1294 | NULL((void*)0), NULL((void*)0)); |
| 1295 | ctk_combo_box_set_row_separator_func (CTK_COMBO_BOX (combobox)((((CtkComboBox*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((combobox)), ((ctk_combo_box_get_type ())))))), |
| 1296 | is_separator, NULL((void*)0), NULL((void*)0)); |
| 1297 | |
| 1298 | ctk_combo_box_set_active (CTK_COMBO_BOX (combobox)((((CtkComboBox*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((combobox)), ((ctk_combo_box_get_type ())))))), 0); |
| 1299 | #if 0 |
| 1300 | g_timeout_add (1000, (GSourceFunc) animation_timer, model); |
| 1301 | #endif |
| 1302 | |
| 1303 | /* CtkComboBox (grid mode) */ |
| 1304 | tmp = ctk_frame_new ("CtkComboBox (grid mode)"); |
| 1305 | ctk_box_pack_start (CTK_BOX (mainbox)((((CtkBox*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((mainbox)), ((ctk_box_get_type ())))))), tmp, FALSE(0), FALSE(0), 0); |
| 1306 | |
| 1307 | boom = ctk_box_new (CTK_ORIENTATION_VERTICAL, 0); |
| 1308 | ctk_container_set_border_width (CTK_CONTAINER (boom)((((CtkContainer*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((boom)), ((ctk_container_get_type ())))))), 5); |
| 1309 | ctk_container_add (CTK_CONTAINER (tmp)((((CtkContainer*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((tmp)), ((ctk_container_get_type ())))))), boom); |
| 1310 | |
| 1311 | comboboxgrid = create_combo_box_grid_demo (); |
| 1312 | ctk_box_pack_start (CTK_BOX (boom)((((CtkBox*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((boom)), ((ctk_box_get_type ())))))), comboboxgrid, FALSE(0), FALSE(0), 0); |
| 1313 | |
| 1314 | |
| 1315 | /* CtkComboBoxEntry */ |
| 1316 | tmp = ctk_frame_new ("CtkComboBox with entry"); |
| 1317 | ctk_box_pack_start (CTK_BOX (mainbox)((((CtkBox*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((mainbox)), ((ctk_box_get_type ())))))), tmp, FALSE(0), FALSE(0), 0); |
| 1318 | |
| 1319 | boom = ctk_box_new (CTK_ORIENTATION_VERTICAL, 0); |
| 1320 | ctk_container_set_border_width (CTK_CONTAINER (boom)((((CtkContainer*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((boom)), ((ctk_container_get_type ())))))), 5); |
| 1321 | ctk_container_add (CTK_CONTAINER (tmp)((((CtkContainer*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((tmp)), ((ctk_container_get_type ())))))), boom); |
| 1322 | |
| 1323 | comboboxtext = ctk_combo_box_text_new_with_entry (); |
| 1324 | setup_combo_entry (CTK_COMBO_BOX_TEXT (comboboxtext)((((CtkComboBoxText*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((comboboxtext)), ((ctk_combo_box_text_get_type ()))))))); |
| 1325 | ctk_container_add (CTK_CONTAINER (boom)((((CtkContainer*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((boom)), ((ctk_container_get_type ())))))), comboboxtext); |
| 1326 | |
| 1327 | |
| 1328 | /* Phylogenetic tree */ |
| 1329 | tmp = ctk_frame_new ("What are you ?"); |
| 1330 | ctk_box_pack_start (CTK_BOX (mainbox)((((CtkBox*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((mainbox)), ((ctk_box_get_type ())))))), tmp, FALSE(0), FALSE(0), 0); |
| 1331 | |
| 1332 | boom = ctk_box_new (CTK_ORIENTATION_VERTICAL, 0); |
| 1333 | ctk_container_set_border_width (CTK_CONTAINER (boom)((((CtkContainer*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((boom)), ((ctk_container_get_type ())))))), 5); |
| 1334 | ctk_container_add (CTK_CONTAINER (tmp)((((CtkContainer*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((tmp)), ((ctk_container_get_type ())))))), boom); |
| 1335 | |
| 1336 | model = create_phylogenetic_tree (); |
| 1337 | combobox = ctk_combo_box_new_with_model (model); |
| 1338 | g_object_unref (model); |
| 1339 | ctk_container_add (CTK_CONTAINER (boom)((((CtkContainer*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((boom)), ((ctk_container_get_type ())))))), combobox); |
| 1340 | |
| 1341 | renderer = ctk_cell_renderer_text_new (); |
| 1342 | ctk_cell_layout_pack_start (CTK_CELL_LAYOUT (combobox)((((CtkCellLayout*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((combobox)), ((ctk_cell_layout_get_type ())))))), |
| 1343 | renderer, |
| 1344 | TRUE(!(0))); |
| 1345 | ctk_cell_layout_set_attributes (CTK_CELL_LAYOUT (combobox)((((CtkCellLayout*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((combobox)), ((ctk_cell_layout_get_type ())))))), renderer, |
| 1346 | "text", 0, |
| 1347 | NULL((void*)0)); |
| 1348 | |
| 1349 | ctk_combo_box_set_active (CTK_COMBO_BOX (combobox)((((CtkComboBox*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((combobox)), ((ctk_combo_box_get_type ())))))), 0); |
| 1350 | |
| 1351 | /* Capitals */ |
| 1352 | tmp = ctk_frame_new ("Where are you ?"); |
| 1353 | ctk_box_pack_start (CTK_BOX (mainbox)((((CtkBox*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((mainbox)), ((ctk_box_get_type ())))))), tmp, FALSE(0), FALSE(0), 0); |
| 1354 | |
| 1355 | boom = ctk_box_new (CTK_ORIENTATION_VERTICAL, 0); |
| 1356 | ctk_container_set_border_width (CTK_CONTAINER (boom)((((CtkContainer*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((boom)), ((ctk_container_get_type ())))))), 5); |
| 1357 | ctk_container_add (CTK_CONTAINER (tmp)((((CtkContainer*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((tmp)), ((ctk_container_get_type ())))))), boom); |
| 1358 | |
| 1359 | model = create_capital_tree (); |
| 1360 | combobox = ctk_combo_box_new_with_model (model); |
| 1361 | g_object_unref (model); |
| 1362 | ctk_container_add (CTK_CONTAINER (boom)((((CtkContainer*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((boom)), ((ctk_container_get_type ())))))), combobox); |
| 1363 | renderer = ctk_cell_renderer_text_new (); |
| 1364 | ctk_cell_layout_pack_start (CTK_CELL_LAYOUT (combobox)((((CtkCellLayout*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((combobox)), ((ctk_cell_layout_get_type ())))))), |
| 1365 | renderer, |
| 1366 | TRUE(!(0))); |
| 1367 | ctk_cell_layout_set_attributes (CTK_CELL_LAYOUT (combobox)((((CtkCellLayout*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((combobox)), ((ctk_cell_layout_get_type ())))))), renderer, |
| 1368 | "text", 0, |
| 1369 | NULL((void*)0)); |
| 1370 | ctk_cell_layout_set_cell_data_func (CTK_CELL_LAYOUT (combobox)((((CtkCellLayout*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((combobox)), ((ctk_cell_layout_get_type ())))))), |
| 1371 | renderer, |
| 1372 | capital_sensitive, |
| 1373 | NULL((void*)0), NULL((void*)0)); |
| 1374 | path = ctk_tree_path_new_from_indices (0, 8, -1); |
| 1375 | ctk_tree_model_get_iter (model, &iter, path); |
| 1376 | ctk_tree_path_free (path); |
| 1377 | ctk_combo_box_set_active_iter (CTK_COMBO_BOX (combobox)((((CtkComboBox*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((combobox)), ((ctk_combo_box_get_type ())))))), &iter); |
| 1378 | |
| 1379 | #if 1 |
| 1380 | cdk_threads_add_timeout (1000, (GSourceFunc) capital_animation, model); |
| 1381 | #endif |
| 1382 | |
| 1383 | /* Aligned Food */ |
| 1384 | tmp = ctk_frame_new ("Hungry ?"); |
| 1385 | ctk_box_pack_start (CTK_BOX (mainbox)((((CtkBox*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((mainbox)), ((ctk_box_get_type ())))))), tmp, FALSE(0), FALSE(0), 0); |
| 1386 | |
| 1387 | boom = ctk_box_new (CTK_ORIENTATION_VERTICAL, 0); |
| 1388 | ctk_container_set_border_width (CTK_CONTAINER (boom)((((CtkContainer*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((boom)), ((ctk_container_get_type ())))))), 5); |
| 1389 | ctk_container_add (CTK_CONTAINER (tmp)((((CtkContainer*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((tmp)), ((ctk_container_get_type ())))))), boom); |
| 1390 | |
| 1391 | model = create_food_list (); |
| 1392 | combobox = ctk_combo_box_new_with_model (model); |
| 1393 | g_object_unref (model); |
| 1394 | ctk_container_add (CTK_CONTAINER (boom)((((CtkContainer*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((boom)), ((ctk_container_get_type ())))))), combobox); |
| 1395 | |
| 1396 | area = ctk_cell_layout_get_area (CTK_CELL_LAYOUT (combobox)((((CtkCellLayout*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((combobox)), ((ctk_cell_layout_get_type ()))))))); |
| 1397 | |
| 1398 | renderer = ctk_cell_renderer_text_new (); |
| 1399 | ctk_cell_area_add_with_properties (area, renderer, |
| 1400 | "align", TRUE(!(0)), |
| 1401 | "expand", TRUE(!(0)), |
| 1402 | NULL((void*)0)); |
| 1403 | ctk_cell_layout_set_attributes (CTK_CELL_LAYOUT (combobox)((((CtkCellLayout*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((combobox)), ((ctk_cell_layout_get_type ())))))), renderer, |
| 1404 | "text", 0, |
| 1405 | NULL((void*)0)); |
| 1406 | |
| 1407 | renderer = ctk_cell_renderer_text_new (); |
| 1408 | ctk_cell_area_add_with_properties (area, renderer, |
| 1409 | "align", TRUE(!(0)), |
| 1410 | "expand", TRUE(!(0)), |
| 1411 | NULL((void*)0)); |
| 1412 | ctk_cell_layout_set_attributes (CTK_CELL_LAYOUT (combobox)((((CtkCellLayout*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((combobox)), ((ctk_cell_layout_get_type ())))))), renderer, |
| 1413 | "text", 1, |
| 1414 | NULL((void*)0)); |
| 1415 | |
| 1416 | ctk_combo_box_set_active (CTK_COMBO_BOX (combobox)((((CtkComboBox*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((combobox)), ((ctk_combo_box_get_type ())))))), 0); |
| 1417 | |
| 1418 | /* Ellipsizing growing combos */ |
| 1419 | tmp = ctk_frame_new ("Unconstrained Menu"); |
| 1420 | ctk_box_pack_start (CTK_BOX (mainbox)((((CtkBox*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((mainbox)), ((ctk_box_get_type ())))))), tmp, FALSE(0), FALSE(0), 0); |
| 1421 | |
| 1422 | boom = ctk_box_new (CTK_ORIENTATION_VERTICAL, 0); |
| 1423 | ctk_container_set_border_width (CTK_CONTAINER (boom)((((CtkContainer*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((boom)), ((ctk_container_get_type ())))))), 5); |
| 1424 | ctk_container_add (CTK_CONTAINER (tmp)((((CtkContainer*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((tmp)), ((ctk_container_get_type ())))))), boom); |
| 1425 | |
| 1426 | model = create_list_long (); |
| 1427 | combobox = ctk_combo_box_new_with_model (model); |
| 1428 | g_object_unref (model); |
| 1429 | ctk_container_add (CTK_CONTAINER (boom)((((CtkContainer*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((boom)), ((ctk_container_get_type ())))))), combobox); |
| 1430 | renderer = ctk_cell_renderer_text_new (); |
| 1431 | g_object_set (G_OBJECT (renderer)((((GObject*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((renderer)), (((GType) ((20) << (2)))))))), "ellipsize", PANGO_ELLIPSIZE_END, NULL((void*)0)); |
| 1432 | |
| 1433 | ctk_cell_layout_pack_start (CTK_CELL_LAYOUT (combobox)((((CtkCellLayout*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((combobox)), ((ctk_cell_layout_get_type ())))))), renderer, TRUE(!(0))); |
| 1434 | ctk_cell_layout_set_attributes (CTK_CELL_LAYOUT (combobox)((((CtkCellLayout*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((combobox)), ((ctk_cell_layout_get_type ())))))), renderer, |
| 1435 | "text", 0, NULL((void*)0)); |
| 1436 | ctk_combo_box_set_active (CTK_COMBO_BOX (combobox)((((CtkComboBox*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((combobox)), ((ctk_combo_box_get_type ())))))), 0); |
| 1437 | ctk_combo_box_set_popup_fixed_width (CTK_COMBO_BOX (combobox)((((CtkComboBox*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((combobox)), ((ctk_combo_box_get_type ())))))), FALSE(0)); |
| 1438 | |
| 1439 | tmp = ctk_frame_new ("Looong"); |
| 1440 | ctk_box_pack_start (CTK_BOX (mainbox)((((CtkBox*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((mainbox)), ((ctk_box_get_type ())))))), tmp, FALSE(0), FALSE(0), 0); |
| 1441 | combobox = ctk_combo_box_text_new (); |
| 1442 | for (i = 0; i < 200; i++) |
| 1443 | { |
| 1444 | text = g_strdup_printf ("Item %d", i); |
| 1445 | ctk_combo_box_text_append_text (CTK_COMBO_BOX_TEXT (combobox)((((CtkComboBoxText*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((combobox)), ((ctk_combo_box_text_get_type ())))))), text); |
| 1446 | g_free (text); |
| 1447 | } |
| 1448 | ctk_combo_box_set_active (CTK_COMBO_BOX (combobox)((((CtkComboBox*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((combobox)), ((ctk_combo_box_get_type ())))))), 53); |
| 1449 | ctk_container_add (CTK_CONTAINER (tmp)((((CtkContainer*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((tmp)), ((ctk_container_get_type ())))))), combobox); |
| 1450 | |
| 1451 | ctk_widget_show_all (window); |
| 1452 | |
| 1453 | ctk_main (); |
| 1454 | |
| 1455 | return 0; |
| 1456 | } |
| 1457 | |
| 1458 | /* vim:expandtab |
| 1459 | */ |