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
  
177
  
178
  
179
  
180
  
181
  
182
  
183
  
184
  
185
  
186
  
187
  
188
  
189
  
190
  
191
  
192
  
193
  
194
  
195
  
196
  
197
  
198
  
199
  
200
  
201
  
202
  
203
  
204
  
205
  
206
  
207
  
208
  
209
  
210
  
211
  
212
  
213
  
214
  
215
  
216
  
217
  
218
  
219
  
220
  
221
  
222
  
223
  
224
  
/* -*- C -*- */ 
class GTK2.SpinButton; 
inherit GTK2.Entry; 
inherit GTK2.CellEditable; 
inherit GTK2.Editable; 
 
//! The Spin Button widget is generally used to allow the user to 
//! select a value from a range of numeric values. It consists of a 
//! text entry box with up and down arrow buttons attached to the 
//! side. Selecting one of the buttons causes the value to "spin" up 
//! and down the range of possible values. The entry box may also be 
//! edited directly to enter a specific value. 
//! <p> 
//! The Spin Button allows the value to have zero or a number of 
//! decimal places and to be incremented/decremented in configurable 
//! steps. The action of holding down one of the buttons optionally 
//! results in an acceleration of change in the value according to how 
//! long it is depressed. 
//! </p><p> 
//! The Spin Button uses an W(Adjustment) object to hold information about 
//! the range of values that the spin button can take. 
//! </p><p> 
//! The attributes of an W(Adjustment) are used by the Spin Button in the 
//! following way: 
//! <ul><li>value: initial value for the Spin Button</li> 
//!     <li>lower: lower range value</li> 
//!     <li>upper: upper range value</li> 
//!     <li>step_increment: value to increment/decrement when pressing mouse button 1 on a button</li> 
//!     <li>page_increment: value to increment/decrement when pressing mouse button 2 on a button</li> 
//!     <li>page_size: unused</li> 
//! </ul> 
//! </p><p> 
//! The argument order for the W(Adjustment) constructor is:<br /> 
//! value, lower, upper, step_increment, page_increment, page_size<br /> 
//! 
//! IMG: GTK2.SpinButton(GTK2.Adjustment(),0.1, 1 )->set_size_request(60,20) 
//! </p> 
 
//! Properties: 
//! GTK2.Adjustment adjustment 
//! float climb-rate 
//! int digits 
//! int numeric 
//! int snap-to-ticks 
//! int update-policy 
//! float value 
//! int wrap 
//! <p> 
//! Style properties: 
//! int shadow-type 
 
signal change_value; 
signal input; 
signal output; 
signal value_changed; 
 
 
void create(GTK2.Adjustment|float|mapping(string:mixed) range_or_min_or_props,  
            float climb_rate_or_max,  
            int|float precision_or_step) 
//!  The climb_rate argument take a value between 0.0 and 1.0 and 
//!  indicates the amount of acceleration that the Spin Button has. The 
//!  digits argument specifies the number of decimal places to which 
//!  the value will be displayed. 
{ 
  pgtk2_verify_not_inited(); 
  pgtk2_verify_setup(); 
  if (TYPEOF(Pike_sp[-args]) == PIKE_T_FLOAT) { 
    FLOAT_TYPE min,max,step; 
    GtkWidget *gs; 
    get_all_args(NULL,args,"%f%f%f",&min,&max,&step); 
    gs=gtk_spin_button_new_with_range(min,max,step); 
    THIS->obj=G_OBJECT(gs); 
  } else if (TYPEOF(Pike_sp[-args]) == PIKE_T_OBJECT) { 
    struct object *o1; 
    FLOAT_TYPE climb; 
    INT_TYPE prec; 
    GtkWidget *gs; 
    get_all_args(NULL,args,"%o%f%i",&o1,&climb,&prec); 
    gs=gtk_spin_button_new(GTK_ADJUSTMENT(get_gobject(o1)),climb,prec); 
    THIS->obj=G_OBJECT(gs); 
  } else { 
    INIT_WITH_PROPS(GTK_TYPE_SPIN_BUTTON); 
  } 
  pgtk2_pop_n_elems(args); 
  pgtk2__init_this_object(); 
} 
 
void configure(GTK2.Adjustment range, float climb_rate, int precision); 
//! Adjustment (with the lower/upper/increse values), climb_rate and digits 
 
void set_adjustment(GTK2.Adjustment range); 
//! Set a new adjustment. 
 
+GTK2.Adjustment get_adjustment(); 
//! Get the adjustment associated with this spinbutton. 
 
void set_digits(int precision); 
//! Set the number of digits to show to the user. 
 
void set_increments(float step, float page); 
//! Sets the step and page increments.  This affects how quickly the value 
//! changes when the arrows are activated. 
 
void set_range(float min, float max); 
//! Sets the minimum and maximum allowable values. 
 
int get_value_as_int(); 
//! The current value of a Spin Button can be retrieved as a int. 
 
void set_value(float to); 
//! Set the value. 
 
void set_update_policy(int policy); 
//! The possible values of policy are either GTK2.UpdateAlways or 
//! GTK2.UpdateIfValid. 
//! <p> 
//! These policies affect the behavior of a Spin Button when parsing 
//! inserted text and syncing its value with the values of the 
//! Adjustment. 
//! </p><p> 
//! In the case of GTK2.UpdateIfValid the Spin Button value only gets 
//! changed if the text input is a numeric value that is within the 
//! range specified by the Adjustment. Otherwise the text is reset 
//! to the current value. 
//! </p><p> 
//! In case of GTK2.UpdateAlways errors are ignored while converting text 
//! into a numeric value.</p> 
 
void set_numeric(int numericp); 
//! If true, it is a numeric value.  This prevents a user from typing 
//! anything other than numeric values into the text box of a Spin 
//! Button 
 
void spin(int direction, float increment); 
//! If you want to alter the value of a Spin Value relative to its 
//! current value, then this function can be used. 
//! <p> 
//! The direction paramenter is one of CONST(GTK_SPIN) 
//! </p><p> 
//!  GTK2.SpinStepForward and GTK2.SpinStepBackward change the value 
//!  of the Spin Button by the amount specified by increment, unless 
//!  increment is equal to 0, in which case the value is changed by the 
//!  value of step_increment in theAdjustment. 
//! </p><p> 
//! GTK2.SpinPageForward and GTK2.SpinPageBackward simply alter the 
//! value of the Spin Button by increment. 
//! </p><p> 
//! GTK2.SpinHome sets the value of the Spin Button to the bottom of the 
//! Adjustments range. 
//! </p><p> 
//! GTK2.SpinEnd sets the value of the Spin Button to the top of the 
//! Adjustments range. 
//! </p><p> 
//! GTK2.SpinUserDefined simply alters the value of the Spin Button by 
//! the specified amount.</p> 
 
void set_wrap(int wrapp); 
//! If true, the spin button will wrap from the lowest to the highest 
//! value, and the highest to the lowest. 
 
void set_snap_to_ticks(int snapp); 
//! Set the Spin Button to round the value to the nearest 
//! step_increment, which is set within the Adjustment object used with 
//! the Spin Button 
 
void update(); 
//! Explicitly request that the Spin Button updates itself 
 
int get_digits(); 
//! Fetches the precision. 
 
mapping(string:float) get_increments() 
//! Gets the current step and page increments. 
{ 
  pgtk2_verify_inited(); 
  pgtk2_pop_n_elems(args); 
  { 
    gdouble step,page; 
    gtk_spin_button_get_increments(GTK_SPIN_BUTTON(THIS->obj),&step,&page); 
    ref_push_string(_STR("step")); push_float(step); 
    ref_push_string(_STR("page")); push_float(page); 
    f_aggregate_mapping(4); 
  } 
} 
  
int get_numeric(); 
//! Returns whether non-numeric text can be typed in. 
 
mapping(string:float) get_range() 
//! Gets the range allowed. 
{ 
  pgtk2_verify_inited(); 
  pgtk2_pop_n_elems(args); 
  { 
    gdouble min,max; 
    gtk_spin_button_get_range(GTK_SPIN_BUTTON(THIS->obj),&min,&max); 
    ref_push_string(_STR("min")); push_float(min); 
    ref_push_string(_STR("max")); push_float(max); 
    f_aggregate_mapping(4); 
  } 
} 
 
int get_snap_to_ticks(); 
//! Returns whether the value are corrected to the nearest step. 
 
int get_update_policy(); 
//! Gets the update behavior. 
 
float get_value(); 
//! Get the value. 
 
int get_wrap(); 
//! Returns whether the value wraps around to the opposite limit when the 
//! upper or lower limit of the range is exceeded. 
 
int get_entry() 
//! Returns W(Entry) of this widget. 
{ 
  pgtk2_verify_inited(); 
  pgtk2_pop_n_elems(args); 
  push_gobjectclass(GTK_ENTRY(THIS->obj),pgtk2_entry_program); 
}