]> git.draconx.ca Git - gob-dx.git/blobdiff - examples/gtk-button-count.gob
Release 0.91.0
[gob-dx.git] / examples / gtk-button-count.gob
diff --git a/examples/gtk-button-count.gob b/examples/gtk-button-count.gob
new file mode 100644 (file)
index 0000000..0d039dc
--- /dev/null
@@ -0,0 +1,41 @@
+class Gtk:Button:Count from Gtk:Button {
+       public int count;
+
+       argument INT count
+       get {
+               ARG = self->count;
+       }
+       set {
+               self->count = ARG;
+       };
+
+       init(button)
+       {
+               button->count = 0;
+       }
+
+       public
+       GtkWidget *
+       new(void)
+       {
+               return GTK_WIDGET(GET_NEW);
+       }
+
+       /* new button but with a label inside it already, the 'label'
+          argument must not be NULL or we will return NULL */
+       public
+       GtkWidget *
+       new_with_label(char *label (check null)) onerror NULL
+       {
+               return GTK_WIDGET(GET_NEW);
+       }
+
+       override (Gtk:Button)
+       void
+       clicked(Gtk:Button *self (check null type))
+       {
+               GtkButtonCount *bc = GTK_BUTTON_COUNT(self);
+               bc->count++;
+               PARENT_HANDLER(self);
+       }
+}