]> git.draconx.ca Git - gob-dx.git/blob - examples/gtk-button-count.gob
Release 0.91.0
[gob-dx.git] / examples / gtk-button-count.gob
1 class Gtk:Button:Count from Gtk:Button {
2         public int count;
3
4         argument INT count
5         get {
6                 ARG = self->count;
7         }
8         set {
9                 self->count = ARG;
10         };
11
12         init(button)
13         {
14                 button->count = 0;
15         }
16
17         public
18         GtkWidget *
19         new(void)
20         {
21                 return GTK_WIDGET(GET_NEW);
22         }
23
24         /* new button but with a label inside it already, the 'label'
25            argument must not be NULL or we will return NULL */
26         public
27         GtkWidget *
28         new_with_label(char *label (check null)) onerror NULL
29         {
30                 return GTK_WIDGET(GET_NEW);
31         }
32
33         override (Gtk:Button)
34         void
35         clicked(Gtk:Button *self (check null type))
36         {
37                 GtkButtonCount *bc = GTK_BUTTON_COUNT(self);
38                 bc->count++;
39                 PARENT_HANDLER(self);
40         }
41 }