| 1 | #cxx . . $ `<file>/demo/demo-clipping.c`/include <config.h>cxx . . $ `<file>/config.h`/ |
| 2 | #include <string.h> |
| 3 | #include <gtk/gtk.h> |
| 4 | #include <goocanvas.h>cxx . . $ `<file>/src/goocanvas.h`/ |
| 5 | |
| 6 | |
| 7 | static gbooleancxx . . $ gboolean# |
| 8 | on_button_presscxx . . $ on_button_press(9d8efad818c83e0f). (GooCanvasItemcxx . . $ GooCanvasItem# *item, |
| 9 | GooCanvasItemcxx . . $ GooCanvasItem# *target, |
| 10 | GdkEventButtoncxx . . $ GdkEventButton# *event, |
| 11 | gcharcxx . . $ gchar# *id) |
| 12 | { |
| 13 | g_printcxx . . $ g_print(326aeb464d16410c). ("%s received 'button-press' signal at %g, %g (root: %g, %g)\n", |
| 14 | id, event->xcxx . . $ _GdkEventButton#x., event->ycxx . . $ _GdkEventButton#y., event->x_rootcxx . . $ _GdkEventButton#x_root., event->y_rootcxx . . $ _GdkEventButton#y_root.); |
| 15 | |
| 16 | return TRUEcxx . . $ `<external>/12741050725406041920/gmacros.h:971:9`!; |
| 17 | } |
| 18 | |
| 19 | |
| 20 | static void |
| 21 | setup_canvascxx . . $ setup_canvas(d7cf858254b37903). (GtkWidgetcxx . . $ GtkWidget# *canvas) |
| 22 | { |
| 23 | GooCanvasItemcxx . . $ GooCanvasItem# *root, *item, *table; |
| 24 | |
| 25 | root = goo_canvas_get_root_itemcxx . . $ goo_canvas_get_root_item(ce13d83f0f3922dc). (GOO_CANVAScxx . . $ `src/goocanvas.h:27:9`! (canvas)); |
| 26 | |
| 27 | /* Plain items without clip path. */ |
| 28 | item = goo_canvas_ellipse_newcxx . . $ goo_canvas_ellipse_new(81fa6bcda469491f). (root, 0, 0, 50, 30, |
| 29 | "fill-color", "blue", |
| 30 | NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!); |
| 31 | goo_canvas_item_translatecxx . . $ goo_canvas_item_translate(e265ce1cccd7ae25). (item, 100, 100); |
| 32 | goo_canvas_item_rotatecxx . . $ goo_canvas_item_rotate(85b690433593cce7). (item, 30, 0, 0); |
| 33 | g_signal_connectcxx . . $ `<external>/15952772511652638895/gsignal.h:548:9`! (item, "button_press_event", |
| 34 | G_CALLBACKcxx . . $ `<external>/16473872192229286895/gclosure.h:73:9`! (on_button_press), "Blue ellipse (unclipped)"); |
| 35 | |
| 36 | item = goo_canvas_rect_newcxx . . $ goo_canvas_rect_new(81fa6bcda469491f). (root, 200, 50, 100, 100, |
| 37 | "fill-color", "red", |
| 38 | "clip-fill-rule", CAIRO_FILL_RULE_EVEN_ODDcxx . . $ CAIRO_FILL_RULE_EVEN_ODD., |
| 39 | NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!); |
| 40 | g_signal_connectcxx . . $ `<external>/15952772511652638895/gsignal.h:548:9`! (item, "button_press_event", |
| 41 | G_CALLBACKcxx . . $ `<external>/16473872192229286895/gclosure.h:73:9`! (on_button_press), "Red rectangle (unclipped)"); |
| 42 | |
| 43 | item = goo_canvas_rect_newcxx . . $ goo_canvas_rect_new(81fa6bcda469491f). (root, 380, 50, 100, 100, |
| 44 | "fill-color", "yellow", |
| 45 | NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!); |
| 46 | g_signal_connectcxx . . $ `<external>/15952772511652638895/gsignal.h:548:9`! (item, "button_press_event", |
| 47 | G_CALLBACKcxx . . $ `<external>/16473872192229286895/gclosure.h:73:9`! (on_button_press), "Yellow rectangle (unclipped)"); |
| 48 | |
| 49 | item = goo_canvas_text_newcxx . . $ goo_canvas_text_new(a79e558f39c1c3be). (root, "Sample Text", 520, 100, -1, GOO_CANVAS_ANCHOR_NWcxx . . $ GOO_CANVAS_ANCHOR_NW., |
| 50 | NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!); |
| 51 | g_signal_connectcxx . . $ `<external>/15952772511652638895/gsignal.h:548:9`! (item, "button_press_event", |
| 52 | G_CALLBACKcxx . . $ `<external>/16473872192229286895/gclosure.h:73:9`! (on_button_press), "Text (unclipped)"); |
| 53 | |
| 54 | |
| 55 | |
| 56 | /* Clipped items. */ |
| 57 | item = goo_canvas_ellipse_newcxx . . $ goo_canvas_ellipse_new(81fa6bcda469491f). (root, 0, 0, 50, 30, |
| 58 | "fill-color", "blue", |
| 59 | "clip-path", "M 0 0 h 100 v 100 h -100 Z", |
| 60 | NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!); |
| 61 | goo_canvas_item_translatecxx . . $ goo_canvas_item_translate(e265ce1cccd7ae25). (item, 100, 300); |
| 62 | goo_canvas_item_rotatecxx . . $ goo_canvas_item_rotate(85b690433593cce7). (item, 30, 0, 0); |
| 63 | g_signal_connectcxx . . $ `<external>/15952772511652638895/gsignal.h:548:9`! (item, "button_press_event", |
| 64 | G_CALLBACKcxx . . $ `<external>/16473872192229286895/gclosure.h:73:9`! (on_button_press), "Blue ellipse"); |
| 65 | |
| 66 | item = goo_canvas_rect_newcxx . . $ goo_canvas_rect_new(81fa6bcda469491f). (root, 200, 250, 100, 100, |
| 67 | "fill-color", "red", |
| 68 | "clip-path", "M 250 300 h 100 v 100 h -100 Z", |
| 69 | "clip-fill-rule", CAIRO_FILL_RULE_EVEN_ODDcxx . . $ CAIRO_FILL_RULE_EVEN_ODD., |
| 70 | NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!); |
| 71 | g_signal_connectcxx . . $ `<external>/15952772511652638895/gsignal.h:548:9`! (item, "button_press_event", |
| 72 | G_CALLBACKcxx . . $ `<external>/16473872192229286895/gclosure.h:73:9`! (on_button_press), "Red rectangle"); |
| 73 | |
| 74 | item = goo_canvas_rect_newcxx . . $ goo_canvas_rect_new(81fa6bcda469491f). (root, 380, 250, 100, 100, |
| 75 | "fill-color", "yellow", |
| 76 | "clip-path", "M480,230 l40,100 l-80 0 z", |
| 77 | NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!); |
| 78 | g_signal_connectcxx . . $ `<external>/15952772511652638895/gsignal.h:548:9`! (item, "button_press_event", |
| 79 | G_CALLBACKcxx . . $ `<external>/16473872192229286895/gclosure.h:73:9`! (on_button_press), "Yellow rectangle"); |
| 80 | |
| 81 | item = goo_canvas_text_newcxx . . $ goo_canvas_text_new(a79e558f39c1c3be). (root, "Sample Text", 520, 300, -1, GOO_CANVAS_ANCHOR_NWcxx . . $ GOO_CANVAS_ANCHOR_NW., |
| 82 | "clip-path", "M535,300 h75 v40 h-75 z", |
| 83 | NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!); |
| 84 | g_signal_connectcxx . . $ `<external>/15952772511652638895/gsignal.h:548:9`! (item, "button_press_event", |
| 85 | G_CALLBACKcxx . . $ `<external>/16473872192229286895/gclosure.h:73:9`! (on_button_press), "Text"); |
| 86 | |
| 87 | |
| 88 | /* Table with clipped items. */ |
| 89 | table = goo_canvas_table_newcxx . . $ goo_canvas_table_new(c01a4b3de4d0ec8d). (root, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!); |
| 90 | goo_canvas_item_translatecxx . . $ goo_canvas_item_translate(e265ce1cccd7ae25). (table, 200, 400); |
| 91 | goo_canvas_item_rotatecxx . . $ goo_canvas_item_rotate(85b690433593cce7). (table, 30, 0, 0); |
| 92 | |
| 93 | item = goo_canvas_ellipse_newcxx . . $ goo_canvas_ellipse_new(81fa6bcda469491f). (table, 0, 0, 50, 30, |
| 94 | "fill-color", "blue", |
| 95 | "clip-path", "M 0 0 h 100 v 100 h -100 Z", |
| 96 | NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!); |
| 97 | goo_canvas_item_translatecxx . . $ goo_canvas_item_translate(e265ce1cccd7ae25). (item, 100, 300); |
| 98 | goo_canvas_item_rotatecxx . . $ goo_canvas_item_rotate(85b690433593cce7). (item, 30, 0, 0); |
| 99 | g_signal_connectcxx . . $ `<external>/15952772511652638895/gsignal.h:548:9`! (item, "button_press_event", |
| 100 | G_CALLBACKcxx . . $ `<external>/16473872192229286895/gclosure.h:73:9`! (on_button_press), "Blue ellipse"); |
| 101 | |
| 102 | item = goo_canvas_rect_newcxx . . $ goo_canvas_rect_new(81fa6bcda469491f). (table, 200, 250, 100, 100, |
| 103 | "fill-color", "red", |
| 104 | "clip-path", "M 250 300 h 100 v 100 h -100 Z", |
| 105 | "clip-fill-rule", CAIRO_FILL_RULE_EVEN_ODDcxx . . $ CAIRO_FILL_RULE_EVEN_ODD., |
| 106 | NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!); |
| 107 | goo_canvas_item_set_child_propertiescxx . . $ goo_canvas_item_set_child_properties(a4370f876ee9a149). (table, item, |
| 108 | "column", 1, |
| 109 | NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!); |
| 110 | g_signal_connectcxx . . $ `<external>/15952772511652638895/gsignal.h:548:9`! (item, "button_press_event", |
| 111 | G_CALLBACKcxx . . $ `<external>/16473872192229286895/gclosure.h:73:9`! (on_button_press), "Red rectangle"); |
| 112 | |
| 113 | item = goo_canvas_rect_newcxx . . $ goo_canvas_rect_new(81fa6bcda469491f). (table, 380, 250, 100, 100, |
| 114 | "fill-color", "yellow", |
| 115 | "clip-path", "M480,230 l40,100 l-80 0 z", |
| 116 | NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!); |
| 117 | goo_canvas_item_set_child_propertiescxx . . $ goo_canvas_item_set_child_properties(a4370f876ee9a149). (table, item, |
| 118 | "column", 2, |
| 119 | NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!); |
| 120 | g_signal_connectcxx . . $ `<external>/15952772511652638895/gsignal.h:548:9`! (item, "button_press_event", |
| 121 | G_CALLBACKcxx . . $ `<external>/16473872192229286895/gclosure.h:73:9`! (on_button_press), "Yellow rectangle"); |
| 122 | |
| 123 | item = goo_canvas_text_newcxx . . $ goo_canvas_text_new(a79e558f39c1c3be). (table, "Sample Text", 520, 300, -1, |
| 124 | GOO_CANVAS_ANCHOR_NWcxx . . $ GOO_CANVAS_ANCHOR_NW., |
| 125 | "clip-path", "M535,300 h75 v40 h-75 z", |
| 126 | NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!); |
| 127 | goo_canvas_item_set_child_propertiescxx . . $ goo_canvas_item_set_child_properties(a4370f876ee9a149). (table, item, |
| 128 | "column", 3, |
| 129 | NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!); |
| 130 | g_signal_connectcxx . . $ `<external>/15952772511652638895/gsignal.h:548:9`! (item, "button_press_event", |
| 131 | G_CALLBACKcxx . . $ `<external>/16473872192229286895/gclosure.h:73:9`! (on_button_press), "Text"); |
| 132 | } |
| 133 | |
| 134 | |
| 135 | GtkWidgetcxx . . $ GtkWidget# * |
| 136 | create_clipping_pagecxx . . $ create_clipping_page(2369ce5e9f2c7dfd). (void) |
| 137 | { |
| 138 | GtkWidgetcxx . . $ GtkWidget# *vbox, *scrolled_win, *canvas; |
| 139 | |
| 140 | vbox = gtk_box_newcxx . . $ gtk_box_new(b19e0ce02196028e). (GTK_ORIENTATION_VERTICALcxx . . $ GTK_ORIENTATION_VERTICAL., 4); |
| 141 | gtk_container_set_border_widthcxx . . $ gtk_container_set_border_width(4f2d4e7d5639aede). (GTK_CONTAINERcxx . . $ `<external>/462093496598485868/gtkcontainer.h:38:9`! (vbox), 4); |
| 142 | gtk_widget_showcxx . . $ gtk_widget_show(d7cf858254b37903). (vbox); |
| 143 | |
| 144 | scrolled_win = gtk_scrolled_window_newcxx . . $ gtk_scrolled_window_new(e400dcb18f76639). (NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!); |
| 145 | gtk_scrolled_window_set_shadow_typecxx . . $ gtk_scrolled_window_set_shadow_type(a179c75bb506ed7a). (GTK_SCROLLED_WINDOWcxx . . $ `<external>/15242555379300173687/gtkscrolledwindow.h:38:9`! (scrolled_win), |
| 146 | GTK_SHADOW_INcxx . . $ GTK_SHADOW_IN.); |
| 147 | gtk_widget_showcxx . . $ gtk_widget_show(d7cf858254b37903). (scrolled_win); |
| 148 | gtk_box_pack_startcxx . . $ gtk_box_pack_start(e6ae6b264cb15f6b). (GTK_BOXcxx . . $ `<external>/14176280485027674556/gtkbox.h:40:9`! (vbox), scrolled_win, TRUEcxx . . $ `<external>/12741050725406041920/gmacros.h:971:9`!, TRUEcxx . . $ `<external>/12741050725406041920/gmacros.h:971:9`!, 0); |
| 149 | |
| 150 | canvas = goo_canvas_newcxx . . $ goo_canvas_new(2369ce5e9f2c7dfd). (); |
| 151 | gtk_widget_set_size_requestcxx . . $ gtk_widget_set_size_request(f5b8e75990cfac4b). (canvas, 600, 450); |
| 152 | goo_canvas_set_boundscxx . . $ goo_canvas_set_bounds(c765acac0aeef5c4). (GOO_CANVAScxx . . $ `src/goocanvas.h:27:9`! (canvas), 0, 0, 1000, 1000); |
| 153 | gtk_widget_showcxx . . $ gtk_widget_show(d7cf858254b37903). (canvas); |
| 154 | gtk_container_addcxx . . $ gtk_container_add(a71b61ec882009c2). (GTK_CONTAINERcxx . . $ `<external>/462093496598485868/gtkcontainer.h:38:9`! (scrolled_win), canvas); |
| 155 | |
| 156 | setup_canvascxx . . $ setup_canvas(d7cf858254b37903). (canvas); |
| 157 | |
| 158 | return vbox; |
| 159 | } |