]> git.draconx.ca Git - gob-dx.git/blob - examples/gtk-button-count.gob
Release 0.92.4
[gob-dx.git] / examples / gtk-button-count.gob
1 /*
2  * This is an example button widget which counts the number of clicks
3  *
4  * It is also showing how you can use inline gtk-doc like documentation
5  * which will be correctly translated and put into the resulting source
6  * file
7  */
8 class Gtk:Button:Count from Gtk:Button {
9         public int count;
10
11         argument INT count
12         get {
13                 ARG = self->count;
14         }
15         set {
16                 self->count = ARG;
17         };
18
19         init(self)
20         {
21                 self->count = 0;
22         }
23
24         /**
25          * new:
26          *
27          * Makes a new #GtkButtonCount widget
28          *
29          * Returns: a new widget
30          **/
31         public
32         GtkWidget *
33         new(void)
34         {
35                 return GTK_WIDGET(GET_NEW);
36         }
37
38         /**
39          * new_with_label:
40          * @label: the label text
41          *
42          * Makes a new #GtkButtonCount widget with a label
43          *
44          * Returns: a new widget
45          **/
46         public
47         GtkWidget *
48         new_with_label(char *label (check null)) onerror NULL
49         {
50                 return GTK_WIDGET(GET_NEW);
51         }
52
53         override (Gtk:Button)
54         void
55         clicked(Gtk:Button *self (check null type))
56         {
57                 GtkButtonCount *bc = GTK_BUTTON_COUNT(self);
58                 bc->count++;
59                 PARENT_HANDLER(self);
60         }
61 }