X-Git-Url: https://git.draconx.ca/gitweb/gob-dx.git/blobdiff_plain/a611f21fab136f64bbf979bd62b2fc6ecb62933c..40647d7b7b7fbeae828e0a032a3c3a5f204cdfa8:/examples/gtk-button-count.gob diff --git a/examples/gtk-button-count.gob b/examples/gtk-button-count.gob new file mode 100644 index 0000000..0d039dc --- /dev/null +++ b/examples/gtk-button-count.gob @@ -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); + } +}