1 /*
2  * Copyright (c) 2003, 2009 by the gtk2-perl team (see the file AUTHORS)
3  *
4  * This library is free software; you can redistribute it and/or
5  * modify it under the terms of the GNU Library General Public
6  * License as published by the Free Software Foundation; either
7  * version 2.1 of the License, or (at your option) any later version.
8  *
9  * This library is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
12  * Library General Public License for more details.
13  *
14  * You should have received a copy of the GNU Library General Public
15  * License along with this library; if not, write to the
16  * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
17  * Boston, MA  02110-1301  USA.
18  *
19  * $Id$
20  */
21 
22 #include "gtk2perl.h"
23 
24 MODULE = Gtk2::Adjustment	PACKAGE = Gtk2::Adjustment	PREFIX = gtk_adjustment_
25 
26 =for apidoc Gtk2::Adjustment::value
27 =for signature double = $adjustment->value
28 =for signature double = $adjustment->value ($newval)
29 =for signature double = $adjustment->lower
30 =for signature double = $adjustment->lower ($newval)
31 =for signature double = $adjustment->upper
32 =for signature double = $adjustment->upper ($newval)
33 =for signature double = $adjustment->step_increment
34 =for signature double = $adjustment->step_increment ($newval)
35 =for signature double = $adjustment->page_increment
36 =for signature double = $adjustment->page_increment ($newval)
37 =for signature double = $adjustment->page_size
38 =for signature double = $adjustment->page_size ($newval)
39 
40 Get or set the six fields of a Gtk2::Adjustment.
41 
42 The setter functions store $newval and return the old value.  Note
43 that they don't emit any signals; it's up to you to emit "notify"
44 (because the fields are also properties) and "changed" or
45 "value-changed", when you're ready.
46 
47 =cut
48 
49 =for apidoc value __hide__
50 =cut
51 
52 =for apidoc lower __hide__
53 =cut
54 
55 =for apidoc upper __hide__
56 =cut
57 
58 =for apidoc step_increment __hide__
59 =cut
60 
61 =for apidoc page_increment __hide__
62 =cut
63 
64 =for apidoc page_size __hide__
65 =cut
66 
67 gdouble
68 value (GtkAdjustment *adjustment, gdouble newval = 0)
69     ALIAS:
70 	lower          = 1
71 	upper          = 2
72 	step_increment = 3
73 	page_increment = 4
74 	page_size      = 5
75     CODE:
76 	switch (ix) {
77 	    case 0:
78 		RETVAL = adjustment->value;
79 		if (items > 1) adjustment->value = newval;
80 		break;
81 	    case 1:
82 		RETVAL = adjustment->lower;
83 		if (items > 1) adjustment->lower = newval;
84 		break;
85 	    case 2:
86 		RETVAL = adjustment->upper;
87 		if (items > 1) adjustment->upper = newval;
88 		break;
89 	    case 3:
90 		RETVAL = adjustment->step_increment;
91 		if (items > 1) adjustment->step_increment = newval;
92 		break;
93 	    case 4:
94 		RETVAL = adjustment->page_increment;
95 		if (items > 1) adjustment->page_increment = newval;
96 		break;
97 	    case 5:
98 		RETVAL = adjustment->page_size;
99 		if (items > 1) adjustment->page_size = newval;
100 		break;
101 	    default:
102 		RETVAL = 0.0;
103 		g_assert_not_reached ();
104 	}
105     OUTPUT:
106 	RETVAL
107 
108 
109 GtkObject*
110 gtk_adjustment_new (class, value, lower, upper, step_increment, page_increment, page_size)
111 	gdouble   value
112 	gdouble   lower
113 	gdouble   upper
114 	gdouble   step_increment
115 	gdouble   page_increment
116 	gdouble   page_size
117     C_ARGS:
118 	value, lower, upper, step_increment, page_increment, page_size
119 
120 void
121 gtk_adjustment_changed (adjustment)
122 	GtkAdjustment *adjustment
123 
124 void
125 gtk_adjustment_value_changed (adjustment)
126 	GtkAdjustment *adjustment
127 
128 void
129 gtk_adjustment_clamp_page (adjustment, lower, upper)
130 	GtkAdjustment *adjustment
131 	gdouble lower
132 	gdouble upper
133 
134 gdouble
135 gtk_adjustment_get_value (adjustment)
136 	GtkAdjustment *adjustment
137 
138 void
139 gtk_adjustment_set_value (adjustment, value)
140 	GtkAdjustment *adjustment
141 	gdouble value
142 
143 #if GTK_CHECK_VERSION (2, 14, 0)
144 
145 void
146 gtk_adjustment_configure (adjustment, value, lower, upper, step_increment, page_increment, page_size)
147 	GtkAdjustment *adjustment
148 	gdouble   value
149 	gdouble   lower
150 	gdouble   upper
151 	gdouble   step_increment
152 	gdouble   page_increment
153 	gdouble   page_size
154 
155 =for apidoc Gtk2::Adjustment::set_lower
156 =for signature $adjustment->set_lower ($newval)
157 =for signature $adjustment->set_page_increment ($newval)
158 =for signature $adjustment->set_page_size ($newval)
159 =for signature $adjustment->set_step_increment ($newval)
160 =for signature $adjustment->set_upper ($newval)
161 
162 These functions differ from the plain C<< ->lower >> etc setters in that
163 they emit C<notify> and C<changed> signals if C<$newval> is different from
164 the current value.
165 
166 The corresponding C<get_lower> etc are not wrapped because they're the
167 same as the C<lower> etc field accessors above.
168 
169 =cut
170 
171 =for apidoc set_lower __hide__
172 =cut
173 
174 =for apidoc set_page_increment __hide__
175 =cut
176 
177 =for apidoc set_page_size __hide__
178 =cut
179 
180 =for apidoc set_step_increment __hide__
181 =cut
182 
183 =for apidoc set_upper __hide__
184 =cut
185 
186 void
187 set_lower (GtkAdjustment *adjustment, gdouble newval)
188     ALIAS:
189 	set_page_increment = 1
190 	set_page_size      = 2
191 	set_step_increment = 3
192 	set_upper          = 4
193     CODE:
194 	switch (ix) {
195 	    case 0: gtk_adjustment_set_lower (adjustment, newval);
196 	            break;
197 	    case 1: gtk_adjustment_set_page_increment (adjustment, newval);
198 	            break;
199 	    case 2: gtk_adjustment_set_page_size (adjustment, newval);
200 	            break;
201 	    case 3: gtk_adjustment_set_step_increment (adjustment, newval);
202 	            break;
203 	    case 4: gtk_adjustment_set_upper (adjustment, newval);
204 	            break;
205 	}
206 
207 #endif /* 2.14 */
208 
209