1
  
2
  
3
  
4
  
5
  
6
  
7
  
8
  
9
  
10
  
11
  
12
  
13
  
14
  
15
  
16
  
17
  
18
  
19
  
20
  
21
  
22
  
23
  
24
  
25
  
26
  
27
  
28
  
29
  
30
  
31
  
32
  
33
  
34
  
35
  
36
  
37
  
38
  
39
  
40
  
41
  
42
  
43
  
44
  
45
  
46
  
47
  
48
  
49
  
50
  
51
  
52
  
53
  
54
  
55
  
56
  
57
  
58
  
59
  
60
  
61
  
62
  
63
  
64
  
65
  
66
  
67
  
68
  
69
  
70
  
71
  
72
  
73
  
74
  
75
  
76
  
77
  
78
  
79
  
80
  
81
  
82
  
83
  
84
  
85
  
86
  
87
  
88
  
89
  
90
  
91
  
92
  
93
  
94
  
95
  
96
  
97
  
98
  
99
  
100
  
101
  
102
  
103
  
104
  
105
  
106
  
107
  
108
  
109
  
110
  
111
  
112
  
113
  
114
  
115
  
116
  
117
  
118
  
119
  
120
  
121
  
122
  
123
  
124
  
125
  
126
  
127
  
128
  
129
  
130
  
131
  
132
  
133
  
134
  
135
  
136
  
137
  
138
  
139
  
140
  
141
  
142
  
143
  
144
  
145
  
146
  
147
  
148
  
149
  
150
  
151
  
152
  
153
  
154
  
155
  
156
  
157
  
158
  
159
  
160
  
161
  
162
  
163
  
164
  
165
  
166
  
167
  
168
  
169
  
170
  
171
  
172
  
173
  
174
  
175
  
176
  
/* -*- C -*- */ 
class GTK2.Button; 
inherit GTK2.Bin; 
inherit GTK2.Activatable; 
 
//! A container that can only contain one child, and accepts events. 
//! draws a bevelbox around itself. 
//! IMG: GTK2.Button("A button") 
//! IMG: GTK2.Button("A button\nwith multiple lines\nof text") 
//! IMG: GTK2.Button()->add(GTK2.Image(GTK2.GdkImage(0)->set(Image.Image(100,40)->test()))) 
 
//! Properties: 
//! int focus-on-click 
//! GTK2.Widget image 
require gtk210; 
//! int image-position 
endrequire; 
//! string label 
//! int relief 
//! int use-stock 
//! int use-underline 
require gtk24; 
//! float xalign 
//! float yalign 
endrequire; 
//! <p> 
//! Style properties: 
//! int child-displacement-x 
//! int child-displacement-y 
//! GTK2.Border default-border 
//! GTK2.Border default-outside-border 
require gtk26; 
//! int displace-focus 
endrequire; 
//! int image-spacing 
require gtk210; 
//! int inner-border 
endrequire; 
 
signal activate; 
signal pressed; 
//! Called when the button is pressed 
signal released; 
//! Called when the button is released 
signal clicked; 
//! Called when the button is pressed, and then released 
signal enter; 
//! Called when the mouse enters the button 
signal leave; 
//! Called when the mouse leaves the button 
 
void create(string|mapping(string:mixed)|void label_or_props) 
//! If a string is supplied, a W(Label) is created and added to the button. 
{ 
  pgtk2_verify_not_inited(); 
  pgtk2_verify_setup(); 
  if (args) { 
    if (TYPEOF(Pike_sp[-args]) == PIKE_T_STRING) { 
      struct pike_string *t; 
      GtkWidget *gb; 
      GtkStockItem item; 
      int i=0; 
 
      get_all_args(NULL,args,"%T",&t); 
      if (t) { 
        if (t->size_shift==0) 
          i=gtk_stock_lookup(CGSTR0(t),&item); 
        if (i) 
          gb=gtk_button_new_from_stock(CGSTR0(t)); 
        else { 
          ref_push_string(t); 
          f_string_to_utf8(1); 
         
          gb=gtk_button_new_with_label(CGSTR0(Pike_sp[-1].u.string));  
          pop_stack(); 
        } 
      } else 
        gb=gtk_button_new(); 
      THIS->obj=G_OBJECT(gb);  
    } else { 
      INIT_WITH_PROPS(GTK_TYPE_BUTTON); 
    } 
    pgtk2_pop_n_elems(args); 
  } else { 
    GtkWidget *gb; 
    gb=gtk_button_new(); 
    THIS->obj=G_OBJECT(gb); 
  } 
  pgtk2__init_this_object(); 
} 
 
void pressed(); 
//! Emulate a 'press' event. 
 
void released(); 
//! Emulate a 'release' event. 
 
void clicked(); 
//! Emulate a 'clicked' event (press followed by release). 
 
void enter(); 
//! Emulate a 'enter' event. 
 
void leave(); 
//! Emulate a 'leave' event. 
 
void set_relief( int newstyle ); 
//! One of CONST(GTK_RELIEF) 
 
int get_relief(); 
//! One of CONST(GTK_RELIEF), set with set_relief() 
 
string get_label(); 
//! Get the text from the label of the button. 
 
void set_label(string label); 
//! Set the text of the label. 
 
int get_use_stock(); 
//! Returns whether the button label is a stock item. 
 
void set_use_stock(int use_stock); 
//! If true, the label set on the button is used as a stock id 
//! to select the stock item for the button. 
 
int get_use_underline(); 
//! Returns whether an embedded underline in the button indicates 
//! a mnemonic. 
 
void set_use_underline(int use_underline); 
//! If true, an underline in the text of the button label indicates the 
//! next character should be used for the mnemonic accelerator key. 
 
require gtk24; 
void set_focus_on_click(int focus_on_click); 
//! Sets whether the button will grab focus when it is clicked. 
 
int get_focus_on_click(); 
//! Returns whether the button grabs focus when it is clicked. 
 
void set_alignment(float xalign, float yalign); 
//! Sets the alignment of the child. 
 
mapping get_alignment() 
//! Gets the alignment of the child. 
{ 
  pgtk2_verify_inited(); 
  pgtk2_pop_n_elems(args); 
  { 
    gfloat xalign,yalign; 
 
    gtk_button_get_alignment(GTK_BUTTON(THIS->obj),&xalign,&yalign); 
    ref_push_string(_STR("xalign")); push_float(xalign); 
    ref_push_string(_STR("yalign")); push_float(yalign); 
    f_aggregate_mapping(4); 
  } 
} 
endrequire; 
 
require gtk26; 
void set_image(GTK2.Widget widget); 
//! Set the image of the button to the given widget.  Note that it depends on 
//! the gtk-button-images setting whether the image will be displayed or not. 
 
+GTK2.Widget get_image(); 
//! Gets the widget that is currently set as the image of the button. 
endrequire; 
 
require gtk210; 
void set_image_position(int position); 
//! Sets the position of the image relative to the text inside the button. 
 
int get_image_position(); 
//! Gets the position of the image relative to the text inside the button. 
endrequire;