cvs: php-gtk-doc /en/reference/gtk gtkenum.xml gtkspinbutton.xml
| From: | Steph Fox | Date: | Tue, 22 Jan 2002 15:25:30 +0000 |
| Subject: | cvs: php-gtk-doc /en/reference/gtk gtkenum.xml gtkspinbutton.xml | ||
| Groups: | php.gtk.doc | ||
| Request: | Send a blank email to php-gtk-doc+get-311@lists.php.net to get a copy of this message | ||
sfox Tue Jan 22 10:25:30 2002 EDT
Modified files:
/php-gtk-doc/en/reference/gtk gtkenum.xml gtkspinbutton.xml
Log:
spinbutton's done.
Index: php-gtk-doc/en/reference/gtk/gtkenum.xml diff -u php-gtk-doc/en/reference/gtk/gtkenum.xml:1.24 php-gtk-doc/en/reference/gtk/gtkenum.xml:1.25 --- php-gtk-doc/en/reference/gtk/gtkenum.xml:1.24 Sun Jan 20 14:47:43 2002 +++ php-gtk-doc/en/reference/gtk/gtkenum.xml Tue Jan 22 10:25:29 2002 @@ -740,6 +740,96 @@ </enum> +<enum id="gtk.enum.gtkspinbuttonupdatepolicy"> + <enumname>GtkSpinButtonUpdatePolicy</enumname> + + <enumoption> + <optionname>GTK_UPDATE_ALWAYS</optionname> + <shortdesc> + Always updates the spinbutton value. If an entry is invalid, + the value is updated to the lower or upper bound as appropriate. + </shortdesc> + </enumoption> + + <enumoption> + <optionname>GTK_UPDATE_IF_VALID</optionname> + <shortdesc> + Prevents the spinbutton's current value from being altered where + an entry is invalid. + </shortdesc> + </enumoption> + +</enum> + +<enum id="gtk.enum.gtkspintype"> + <enumname>GtkSpinType</enumname> + + <enumoption> + <optionname>GTK_SPIN_STEP_FORWARD</optionname> + <shortdesc> + Spins forward by the value set in the underlying + <literal>step_increment</literal>. This value can be overridden + by setting the <parameter>increment</parameter> parameter to a value + above <literal>0.0</literal>. + </shortdesc> + </enumoption> + + <enumoption> + <optionname>GTK_SPIN_STEP_BACKWARD</optionname> + <shortdesc> + Spins backward by the value set in the underlying + <literal>step_increment</literal>. This value can be overridden + by setting the <parameter>increment</parameter> parameter to a value + above <literal>0.0</literal>. + </shortdesc> + </enumoption> + + <enumoption> + <optionname>GTK_SPIN_PAGE_FORWARD</optionname> + <shortdesc> + Spins forward by the value set as <literal>page_increment</literal> + in the underlying <classname>GtkAdjustment</classname>. The value + set in the <parameter>increment</parameter> parameter is ignored. + </shortdesc> + </enumoption> + + <enumoption> + <optionname>GTK_SPIN_PAGE_BACKWARD</optionname> + <shortdesc> + Spins backward by the value set as <literal>page_increment</literal> + in the underlying <classname>GtkAdjustment</classname>. The value + set in the <parameter>increment</parameter> parameter is ignored. + </shortdesc> + </enumoption> + + <enumoption> + <optionname>GTK_SPIN_HOME</optionname> + <shortdesc> + Spins to value set as <literal>lower</literal> bound. The value + set in the <parameter>increment</parameter> parameter is ignored. + </shortdesc> + </enumoption> + + <enumoption> + <optionname>GTK_SPIN_END</optionname> + <shortdesc> + Spins to value set as <literal>upper</literal> bound. The value + set in the <parameter>increment</parameter> parameter is ignored. + </shortdesc> + </enumoption> + + <enumoption> + <optionname>GTK_SPIN_USER_DEFINED</optionname> + <shortdesc> + Used where the amount of spin is not defined anywhere in the + underlying <classname>GtkAdjustment</classname>. Negative or + positive values set in the <parameter>increment</parameter> parameter + are used to indicate the direction of the spin. + </shortdesc> + </enumoption> + +</enum> + <enum id="gtk.enum.gtkstatetype"> <enumname>GtkStateType</enumname> Index: php-gtk-doc/en/reference/gtk/gtkspinbutton.xml diff -u php-gtk-doc/en/reference/gtk/gtkspinbutton.xml:1.4 php-gtk-doc/en/reference/gtk/gtkspinbutton.xml:1.5 --- php-gtk-doc/en/reference/gtk/gtkspinbutton.xml:1.4 Sun Jan 20 14:47:43 2002 +++ php-gtk-doc/en/reference/gtk/gtkspinbutton.xml Tue Jan 22 10:25:29 2002 @@ -4,10 +4,26 @@ <classtitle>GtkSpinButton</classtitle> <classparent>GtkEntry</classparent> <shortdesc> - Widget for setting an integer or a floating-point number. + Widget offering masked numerical entry and/or selection. </shortdesc> <desc> - + <simpara> + A <classname>GtkSpinButton</classname> is a widget offering a displayed + numerical value which can be incremented or decremented within a pre-set + range by the user's clicking on one of two arrow buttons, or by using the + <literal>Up</literal> and <literal>Down</literal> arrow keys. + </simpara> + <simpara> + The display area is a <classname>GtkEntry</classname>; the spinbutton + object currently provides the only built-in means of masking input in + GTK+. If you want to restrict the user to the values displayed rather + than allowing keyboard input, call + <function class="GtkEntry">set_editable()</function> from the spinbutton. + </simpara> + <simpara> + See also: <classname>GtkAdjustment</classname>, + <classname>GtkCombo</classname>. + </simpara> </desc> </classmeta> @@ -15,16 +31,110 @@ <funcsynopsis> <funcprototype> <funcdef> <function>GtkSpinButton</function></funcdef> - <paramdef><classname>GtkAdjustment</classname> <parameter><optional>adjustment = NULL</optional></parameter></paramdef> - <paramdef>double <parameter><optional>climb_rate = 0.0</optional></parameter></paramdef> - <paramdef>int <parameter><optional>digits = 0</optional></parameter></paramdef> + <paramdef> + <classname>GtkAdjustment</classname> + <parameter><optional>adjustment = NULL</optional></parameter> + </paramdef> + <paramdef>double + <parameter><optional>climb_rate = 0.0</optional></parameter> + </paramdef> + <paramdef>int + <parameter><optional>digits = 0</optional></parameter> + </paramdef> </funcprototype> </funcsynopsis> <shortdesc> - + Creates an editable rotating display of selectable numbers. </shortdesc> <desc> - + <simpara> + Although the first parameter <parameter>adjustment</parameter> is + optional, you will find it impossible to create a working + <classname>GtkSpinButton</classname> without harnessing it to an + appropriately defined <classname>GtkAdjustment</classname>, as the + first five parameters of the adjustment need to be set for the spinbutton + widget to operate. You may either associate the adjustment at this point, + or use the <function class="GtkSpinButton">set_adjustment()</function> + or <function class="GtkSpinButton">configure()</function> method at a + later point in your script. + </simpara> + <simpara> + <parameter>climb_rate</parameter> refers to the speed of the spin, + rather than its incremental value. Its default setting is + <literal>0.0</literal>, which runs the internal timer at 20ms per + increment (following a 200ms start from the button press). If you + intend using this parameter, the value given needs to be fairly high + in order for it to make an appreciable difference. + </simpara> + <simpara> + The <parameter>digits</parameter> parameter controls the number of + decimal places displayed. + </simpara> + <para> + <example> + <title>Creating a <classname>GtkSpinButton</classname> calendar.</title> + <programlisting role="php"> +dl('php_gtk.' . (strstr(PHP_OS, 'WIN') ? 'dll' : 'so')); + +function collect($d, $m, $y) { + echo $d->get_value_as_int(). "-" .$m->get_value_as_int(). +"-" .$y->get_value_as_int()."\n"; + flush(); +} + +$window = &new GtkWindow(); +$window->set_position(GTK_WIN_POS_CENTER); +$window->connect_object('destroy', array('gtk', 'main_quit')); + +$vbox = &new GtkVBox(false, 5); +$window->add($vbox); + +$hbox = &new GtkHBox(false, 5); +$hbox->set_border_width(5); +$vbox->add($hbox); + +$daylabel = &new GtkLabel("Day:"); +$hbox->pack_start($daylabel, false); + +$day = date("d"); +$dayadj = &new GtkAdjustment($day, 1.0, 31.0, 1.0, 7.0, 0.0); +$dayspin = &new GtkSpinButton($dayadj); +$dayspin->set_wrap(true); +$hbox->pack_start($dayspin, false); + +$monthlabel = &new GtkLabel("Month:"); +$hbox->pack_start($monthlabel, false); + +$month = date("m"); +$monthadj = &new GtkAdjustment($month, 1.0, 12.0, 1.0, 3.0, 0.0); +$monthspin = &new GtkSpinButton($monthadj); +$monthspin->set_wrap(true); +$hbox->pack_start($monthspin, false); + +$yearlabel = &new GtkLabel("Year:"); +$hbox->pack_start($yearlabel, false); + +$year = date("Y"); +$yearadj = &new GtkAdjustment($year, $year-90, $year+10, 1.0, 5.0, 0.0); +$yearspin = &new GtkSpinButton($yearadj); +$yearspin->set_usize(55, 0); +$hbox->pack_start($yearspin, false); + +$button = &new GtkButton("Collect data"); +$button->connect_object('clicked', 'collect', $dayspin, $monthspin, +$yearspin); +$vbox->add($button); + +$vbox->show_all(); +$hbox->show_all(); +$window->show_all(); + +gtk::main(); + </programlisting> + </example> + See also: <classname>GtkAdjustment</classname>'s + <signalname class="GtkAdjustment">value-changed</signalname> signal. + </para> </desc> </constructor> @@ -34,16 +144,27 @@ <funcsynopsis> <funcprototype> <funcdef>void <function>configure</function></funcdef> - <paramdef><classname>GtkAdjustment</classname> <parameter>adjustment</parameter></paramdef> + <paramdef> + <classname>GtkAdjustment</classname> + <parameter>adjustment</parameter> + </paramdef> <paramdef>double <parameter>climb_rate</parameter></paramdef> <paramdef>int <parameter>digits</parameter></paramdef> </funcprototype> </funcsynopsis> <shortdesc> - + Configures all elements of a spinbutton. </shortdesc> <desc> - + <simpara> + This method sets the <classname>GtkAdjustment</classname> and + configures the rate of the spin and number of decimal points displayed + in an existing spinbutton. + </simpara> + <simpara> + Configuration settings made in this way will overwrite any existing + settings on the calling <classname>GtkSpinButton</classname>. + </simpara> </desc> </method> @@ -51,29 +172,47 @@ <funcsynopsis> <funcprototype> <funcdef>void <function>set_adjustment</function></funcdef> - <paramdef><classname>GtkAdjustment</classname> <parameter>adjustment</parameter></paramdef> + <paramdef> + <classname>GtkAdjustment</classname> + <parameter>adjustment</parameter> + </paramdef> </funcprototype> </funcsynopsis> <shortdesc> - + Sets adjustment object. </shortdesc> <desc> - + <simpara> + Call <function class="GtkSpinButton">set_adjustment()</function> when + you only need to attach an adjustment object to a spinbutton. Otherwise, + use <function class="GtkSpinButton">configure()</function>. + </simpara> + <simpara> + An adjustment associated with a spinbutton in this way will overwrite + any exisiting adjustment object. + </simpara> </desc> </method> <method id="gtk.gtkspinbutton.method.get_adjustment"> <funcsynopsis> <funcprototype> - <funcdef><classname>GtkAdjustment</classname> <function>get_adjustment</function></funcdef> + <funcdef> + <classname>GtkAdjustment</classname> + <function>get_adjustment</function> + </funcdef> <paramdef>void</paramdef> </funcprototype> </funcsynopsis> <shortdesc> - + Retrieves adjustment object. </shortdesc> <desc> - + <simpara> + <function class="GtkSpinButton">get_adjustment()</function> returns the + <classname>GtkAdjustment</classname> object currently associated with + the calling spinbutton. + </simpara> </desc> </method> @@ -85,10 +224,15 @@ </funcprototype> </funcsynopsis> <shortdesc> - + Sets number of decimal places displayed. </shortdesc> <desc> - + <simpara> + <function class="GtkSpinButton">set_digits()</function> sets the + number of digits displayed after the decimal point in the spinbutton's + entry field. User input is limited to the constraints of the displayed + decimal places. + </simpara> </desc> </method> @@ -100,10 +244,25 @@ </funcprototype> </funcsynopsis> <shortdesc> - + Retrieves value as float. </shortdesc> <desc> - + <simpara> + Retrieves the current value displayed in the spinbutton entry as + a float value. Use this in combination with the PHP function + <literal>round()</literal> where you need to collect the value to a + specific number of decimal places. + </simpara> + <para> + <informalexample> + <programlisting role="php"> +$adj = &new GtkAdjustment(0.0, 0.0, 1.0, 0.01, 0.1, 0.0); +$spin = &new GtkSpinButton($adj, 0.0, 2); + +round($spin->get_value_as_float(), 2); + </programlisting> + </informalexample> + </para> </desc> </method> @@ -115,10 +274,14 @@ </funcprototype> </funcsynopsis> <shortdesc> - + Retrieves value as integer. </shortdesc> <desc> - + <simpara> + Retrieves the current value displayed in the spinbutton entry as + an integer. If the value is a fraction, this method rounds it + to the nearest whole number. + </simpara> </desc> </method> @@ -130,10 +293,20 @@ </funcprototype> </funcsynopsis> <shortdesc> - + Sets value displayed in spinbutton entry field. </shortdesc> <desc> - + <simpara> + <function class="GtkSpinButton">set_value()</function> sets the + value displayed in the spinbutton's entry field, which is + equivalent to the <literal>value</literal> field in the + spinbutton's associated <classname>GtkAdjustment</classname>. + </simpara> + <simpara> + If the <literal>lower</literal> or <literal>upper</literal> bounds + set in the adjustment are exceeded, the value of the appropriate + bound will replace the value passed as the parameter in this method. + </simpara> </desc> </method> @@ -141,14 +314,32 @@ <funcsynopsis> <funcprototype> <funcdef>void <function>set_update_policy</function></funcdef> - <paramdef><enumname>GtkSpinButtonUpdatePolicy</enumname> <parameter>policy</parameter></paramdef> + <paramdef> + <enumname>GtkSpinButtonUpdatePolicy</enumname> + <parameter>policy</parameter> + </paramdef> </funcprototype> </funcsynopsis> <shortdesc> - - </shortdesc> - <desc> - + Controls update policy. + </shortdesc> + <desc> + <simpara> + There are only two possible settings for the spinbutton update policy. + Setting it as <literal>GTK_UPDATE_IF_VALID</literal> prevents the + current value from being changed where the newly entered value is + outside the range determined by the underlying + <classname>GtkAdjustment</classname>. + </simpara> + <simpara> + The default setting is <literal>GTK_UPDATE_ALWAYS</literal>, which + allows the update to continue by replacing an invalid value with + the value of the nearest range boundary. + </simpara> + <simpara> + Note that <function classname="GtkSpinButton">set_value()</function>. + overrides the update policy setting. + </simpara> </desc> </method> @@ -160,10 +351,21 @@ </funcprototype> </funcsynopsis> <shortdesc> - + Toggles the way non-numeric input is treated in display. </shortdesc> <desc> - + <simpara> + <function class="GtkSpinButton">set_numeric()</function>, when set + to <literal>true</literal>, prevents non-numeric characters other + than the decimal point and positive/negative signs from being + displayed in the spinbutton's <classname>GtkEntry</classname> at + the point of being keyed in. + </simpara> + <simpara> + Note that inappropriate characters will not be accepted by the + underlying <classname>GtkAdjustment</classname> in any case; this + is purely a masking function at display level. + </simpara> </desc> </method> @@ -171,15 +373,26 @@ <funcsynopsis> <funcprototype> <funcdef>void <function>spin</function></funcdef> - <paramdef><enumname>GtkSpinType</enumname> <parameter>direction</parameter></paramdef> + <paramdef> + <enumname>GtkSpinType</enumname> + <parameter>direction</parameter> + </paramdef> <paramdef>double <parameter>increment</parameter></paramdef> </funcprototype> </funcsynopsis> <shortdesc> - + Forces a spin. </shortdesc> <desc> - + <simpara> + This method resets the displayed value to a new value that is + determined by the <enumname>GtkSpinType</enumname> chosen. It is + used internally to set up the functions associated with mouse button + presses over the spinbutton's arrows. These are, a left click spins + one step increment, a middle button click spins one page increment, and + a right click spins to the lower or upper bound depending on which + arrow is pressed. + </simpara> </desc> </method> @@ -191,10 +404,20 @@ </funcprototype> </funcsynopsis> <shortdesc> - + Toggles whether the display wraps. </shortdesc> <desc> - + <simpara> + Where <function class="GtkSpinButton">set_wrap()</function> is set to + <literal>true</literal>, the spinbutton having displayed the upper + bound of its value range will return to the lower bound on the next + step increment. In other words, if the range is 1 to 10, 1 will follow + 10 in the display area when the <literal>up</literal> arrow is pressed. + </simpara> + <simpara> + The default setting is <literal>false</literal>, which greys out the + appropriate arrow when the lower or upper bound of the range is reached. + </simpara> </desc> </method> @@ -202,14 +425,23 @@ <funcsynopsis> <funcprototype> <funcdef>void <function>set_shadow_type</function></funcdef> - <paramdef><enumname>GtkShadowType</enumname> <parameter>shadow_type</parameter></paramdef> + <paramdef> + <enumname>GtkShadowType</enumname> + <parameter>shadow_type</parameter> + </paramdef> </funcprototype> </funcsynopsis> <shortdesc> - + Controls appearance of spinbutton. </shortdesc> <desc> - + <simpara> + Sets the shadow style of the frame around the arrow buttons on a + spinbutton using the <enumname>GtkShadowType</enumname> options. + </simpara> + <simpara> + The default setting is <literal>GTK_SHADOW_NONE</literal>. + </simpara> </desc> </method> @@ -221,27 +453,31 @@ </funcprototype> </funcsynopsis> <shortdesc> - + Toggles whether input is aligned with increment. </shortdesc> <desc> - + <simpara> + <function class="GtkSpinButton">set_snap_to_ticks()</function>, if set + to <literal>true</literal>, will restrict input values to the order of + the step increment, taking the nearest value to the increment as the + input value. For example, if you have set the step increment to + <literal>0.5</literal> in a range of <literal>0.0</literal> to + <literal>2.5</literal> and the user inputs <literal>1.4</literal>, the + input will be reset to <literal>1.5</literal> - the nearest incremental + value. + </simpara> + <simpara> + The default setting is <literal>false</literal>, which allows the user + to key in anything within range to the given number of decimal points. + </simpara> + <simpara> + See also: <function class="GtkSpinButton">set_digits()</function>. + </simpara> </desc> </method> - <method id="gtk.gtkspinbutton.method.update"> - <funcsynopsis> - <funcprototype> - <funcdef>void <function>update</function></funcdef> - <paramdef>void</paramdef> - </funcprototype> - </funcsynopsis> - <shortdesc> - - </shortdesc> - <desc> - - </desc> - </method> + <!-- DELETED update() function as it seems it is for internal use only - + sf jan 02 --> </methods>
Index: php-gtk-doc/en/reference/gtk/gtkenum.xml diff -u php-gtk-doc/en/reference/gtk/gtkenum.xml:1.24 php-gtk-doc/en/reference/gtk/gtkenum.xml:1.25 --- php-gtk-doc/en/reference/gtk/gtkenum.xml:1.24 Sun Jan 20 14:47:43 2002 +++ php-gtk-doc/en/reference/gtk/gtkenum.xml Tue Jan 22 10:25:29 2002 @@ -740,6 +740,96 @@ </enum> +<enum id="gtk.enum.gtkspinbuttonupdatepolicy"> + <enumname>GtkSpinButtonUpdatePolicy</enumname> + + <enumoption> + <optionname>GTK_UPDATE_ALWAYS</optionname> + <shortdesc> + Always updates the spinbutton value. If an entry is invalid, + the value is updated to the lower or upper bound as appropriate. + </shortdesc> + </enumoption> + + <enumoption> + <optionname>GTK_UPDATE_IF_VALID</optionname> + <shortdesc> + Prevents the spinbutton's current value from being altered where + an entry is invalid. + </shortdesc> + </enumoption> + +</enum> + +<enum id="gtk.enum.gtkspintype"> + <enumname>GtkSpinType</enumname> + + <enumoption> + <optionname>GTK_SPIN_STEP_FORWARD</optionname> + <shortdesc> + Spins forward by the value set in the underlying + <literal>step_increment</literal>. This value can be overridden + by setting the <parameter>increment</parameter> parameter to a value + above <literal>0.0</literal>. + </shortdesc> + </enumoption> + + <enumoption> + <optionname>GTK_SPIN_STEP_BACKWARD</optionname> + <shortdesc> + Spins backward by the value set in the underlying + <literal>step_increment</literal>. This value can be overridden + by setting the <parameter>increment</parameter> parameter to a value + above <literal>0.0</literal>. + </shortdesc> + </enumoption> + + <enumoption> + <optionname>GTK_SPIN_PAGE_FORWARD</optionname> + <shortdesc> + Spins forward by the value set as <literal>page_increment</literal> + in the underlying <classname>GtkAdjustment</classname>. The value + set in the <parameter>increment</parameter> parameter is ignored. + </shortdesc> + </enumoption> + + <enumoption> + <optionname>GTK_SPIN_PAGE_BACKWARD</optionname> + <shortdesc> + Spins backward by the value set as <literal>page_increment</literal> + in the underlying <classname>GtkAdjustment</classname>. The value + set in the <parameter>increment</parameter> parameter is ignored. + </shortdesc> + </enumoption> + + <enumoption> + <optionname>GTK_SPIN_HOME</optionname> + <shortdesc> + Spins to value set as <literal>lower</literal> bound. The value + set in the <parameter>increment</parameter> parameter is ignored. + </shortdesc> + </enumoption> + + <enumoption> + <optionname>GTK_SPIN_END</optionname> + <shortdesc> + Spins to value set as <literal>upper</literal> bound. The value + set in the <parameter>increment</parameter> parameter is ignored. + </shortdesc> + </enumoption> + + <enumoption> + <optionname>GTK_SPIN_USER_DEFINED</optionname> + <shortdesc> + Used where the amount of spin is not defined anywhere in the + underlying <classname>GtkAdjustment</classname>. Negative or + positive values set in the <parameter>increment</parameter> parameter + are used to indicate the direction of the spin. + </shortdesc> + </enumoption> + +</enum> + <enum id="gtk.enum.gtkstatetype"> <enumname>GtkStateType</enumname> Index: php-gtk-doc/en/reference/gtk/gtkspinbutton.xml diff -u php-gtk-doc/en/reference/gtk/gtkspinbutton.xml:1.4 php-gtk-doc/en/reference/gtk/gtkspinbutton.xml:1.5 --- php-gtk-doc/en/reference/gtk/gtkspinbutton.xml:1.4 Sun Jan 20 14:47:43 2002 +++ php-gtk-doc/en/reference/gtk/gtkspinbutton.xml Tue Jan 22 10:25:29 2002 @@ -4,10 +4,26 @@ <classtitle>GtkSpinButton</classtitle> <classparent>GtkEntry</classparent> <shortdesc> - Widget for setting an integer or a floating-point number. + Widget offering masked numerical entry and/or selection. </shortdesc> <desc> - + <simpara> + A <classname>GtkSpinButton</classname> is a widget offering a displayed + numerical value which can be incremented or decremented within a pre-set + range by the user's clicking on one of two arrow buttons, or by using the + <literal>Up</literal> and <literal>Down</literal> arrow keys. + </simpara> + <simpara> + The display area is a <classname>GtkEntry</classname>; the spinbutton + object currently provides the only built-in means of masking input in + GTK+. If you want to restrict the user to the values displayed rather + than allowing keyboard input, call + <function class="GtkEntry">set_editable()</function> from the spinbutton. + </simpara> + <simpara> + See also: <classname>GtkAdjustment</classname>, + <classname>GtkCombo</classname>. + </simpara> </desc> </classmeta> @@ -15,16 +31,110 @@ <funcsynopsis> <funcprototype> <funcdef> <function>GtkSpinButton</function></funcdef> - <paramdef><classname>GtkAdjustment</classname> <parameter><optional>adjustment = NULL</optional></parameter></paramdef> - <paramdef>double <parameter><optional>climb_rate = 0.0</optional></parameter></paramdef> - <paramdef>int <parameter><optional>digits = 0</optional></parameter></paramdef> + <paramdef> + <classname>GtkAdjustment</classname> + <parameter><optional>adjustment = NULL</optional></parameter> + </paramdef> + <paramdef>double + <parameter><optional>climb_rate = 0.0</optional></parameter> + </paramdef> + <paramdef>int + <parameter><optional>digits = 0</optional></parameter> + </paramdef> </funcprototype> </funcsynopsis> <shortdesc> - + Creates an editable rotating display of selectable numbers. </shortdesc> <desc> - + <simpara> + Although the first parameter <parameter>adjustment</parameter> is + optional, you will find it impossible to create a working + <classname>GtkSpinButton</classname> without harnessing it to an + appropriately defined <classname>GtkAdjustment</classname>, as the + first five parameters of the adjustment need to be set for the spinbutton + widget to operate. You may either associate the adjustment at this point, + or use the <function class="GtkSpinButton">set_adjustment()</function> + or <function class="GtkSpinButton">configure()</function> method at a + later point in your script. + </simpara> + <simpara> + <parameter>climb_rate</parameter> refers to the speed of the spin, + rather than its incremental value. Its default setting is + <literal>0.0</literal>, which runs the internal timer at 20ms per + increment (following a 200ms start from the button press). If you + intend using this parameter, the value given needs to be fairly high + in order for it to make an appreciable difference. + </simpara> + <simpara> + The <parameter>digits</parameter> parameter controls the number of + decimal places displayed. + </simpara> + <para> + <example> + <title>Creating a <classname>GtkSpinButton</classname> calendar.</title> + <programlisting role="php"> +dl('php_gtk.' . (strstr(PHP_OS, 'WIN') ? 'dll' : 'so')); + +function collect($d, $m, $y) { + echo $d->get_value_as_int(). "-" .$m->get_value_as_int(). +"-" .$y->get_value_as_int()."\n"; + flush(); +} + +$window = &new GtkWindow(); +$window->set_position(GTK_WIN_POS_CENTER); +$window->connect_object('destroy', array('gtk', 'main_quit')); + +$vbox = &new GtkVBox(false, 5); +$window->add($vbox); + +$hbox = &new GtkHBox(false, 5); +$hbox->set_border_width(5); +$vbox->add($hbox); + +$daylabel = &new GtkLabel("Day:"); +$hbox->pack_start($daylabel, false); + +$day = date("d"); +$dayadj = &new GtkAdjustment($day, 1.0, 31.0, 1.0, 7.0, 0.0); +$dayspin = &new GtkSpinButton($dayadj); +$dayspin->set_wrap(true); +$hbox->pack_start($dayspin, false); + +$monthlabel = &new GtkLabel("Month:"); +$hbox->pack_start($monthlabel, false); + +$month = date("m"); +$monthadj = &new GtkAdjustment($month, 1.0, 12.0, 1.0, 3.0, 0.0); +$monthspin = &new GtkSpinButton($monthadj); +$monthspin->set_wrap(true); +$hbox->pack_start($monthspin, false); + +$yearlabel = &new GtkLabel("Year:"); +$hbox->pack_start($yearlabel, false); + +$year = date("Y"); +$yearadj = &new GtkAdjustment($year, $year-90, $year+10, 1.0, 5.0, 0.0); +$yearspin = &new GtkSpinButton($yearadj); +$yearspin->set_usize(55, 0); +$hbox->pack_start($yearspin, false); + +$button = &new GtkButton("Collect data"); +$button->connect_object('clicked', 'collect', $dayspin, $monthspin, +$yearspin); +$vbox->add($button); + +$vbox->show_all(); +$hbox->show_all(); +$window->show_all(); + +gtk::main(); + </programlisting> + </example> + See also: <classname>GtkAdjustment</classname>'s + <signalname class="GtkAdjustment">value-changed</signalname> signal. + </para> </desc> </constructor> @@ -34,16 +144,27 @@ <funcsynopsis> <funcprototype> <funcdef>void <function>configure</function></funcdef> - <paramdef><classname>GtkAdjustment</classname> <parameter>adjustment</parameter></paramdef> + <paramdef> + <classname>GtkAdjustment</classname> + <parameter>adjustment</parameter> + </paramdef> <paramdef>double <parameter>climb_rate</parameter></paramdef> <paramdef>int <parameter>digits</parameter></paramdef> </funcprototype> </funcsynopsis> <shortdesc> - + Configures all elements of a spinbutton. </shortdesc> <desc> - + <simpara> + This method sets the <classname>GtkAdjustment</classname> and + configures the rate of the spin and number of decimal points displayed + in an existing spinbutton. + </simpara> + <simpara> + Configuration settings made in this way will overwrite any existing + settings on the calling <classname>GtkSpinButton</classname>. + </simpara> </desc> </method> @@ -51,29 +172,47 @@ <funcsynopsis> <funcprototype> <funcdef>void <function>set_adjustment</function></funcdef> - <paramdef><classname>GtkAdjustment</classname> <parameter>adjustment</parameter></paramdef> + <paramdef> + <classname>GtkAdjustment</classname> + <parameter>adjustment</parameter> + </paramdef> </funcprototype> </funcsynopsis> <shortdesc> - + Sets adjustment object. </shortdesc> <desc> - + <simpara> + Call <function class="GtkSpinButton">set_adjustment()</function> when + you only need to attach an adjustment object to a spinbutton. Otherwise, + use <function class="GtkSpinButton">configure()</function>. + </simpara> + <simpara> + An adjustment associated with a spinbutton in this way will overwrite + any exisiting adjustment object. + </simpara> </desc> </method> <method id="gtk.gtkspinbutton.method.get_adjustment"> <funcsynopsis> <funcprototype> - <funcdef><classname>GtkAdjustment</classname> <function>get_adjustment</function></funcdef> + <funcdef> + <classname>GtkAdjustment</classname> + <function>get_adjustment</function> + </funcdef> <paramdef>void</paramdef> </funcprototype> </funcsynopsis> <shortdesc> - + Retrieves adjustment object. </shortdesc> <desc> - + <simpara> + <function class="GtkSpinButton">get_adjustment()</function> returns the + <classname>GtkAdjustment</classname> object currently associated with + the calling spinbutton. + </simpara> </desc> </method> @@ -85,10 +224,15 @@ </funcprototype> </funcsynopsis> <shortdesc> - + Sets number of decimal places displayed. </shortdesc> <desc> - + <simpara> + <function class="GtkSpinButton">set_digits()</function> sets the + number of digits displayed after the decimal point in the spinbutton's + entry field. User input is limited to the constraints of the displayed + decimal places. + </simpara> </desc> </method> @@ -100,10 +244,25 @@ </funcprototype> </funcsynopsis> <shortdesc> - + Retrieves value as float. </shortdesc> <desc> - + <simpara> + Retrieves the current value displayed in the spinbutton entry as + a float value. Use this in combination with the PHP function + <literal>round()</literal> where you need to collect the value to a + specific number of decimal places. + </simpara> + <para> + <informalexample> + <programlisting role="php"> +$adj = &new GtkAdjustment(0.0, 0.0, 1.0, 0.01, 0.1, 0.0); +$spin = &new GtkSpinButton($adj, 0.0, 2); + +round($spin->get_value_as_float(), 2); + </programlisting> + </informalexample> + </para> </desc> </method> @@ -115,10 +274,14 @@ </funcprototype> </funcsynopsis> <shortdesc> - + Retrieves value as integer. </shortdesc> <desc> - + <simpara> + Retrieves the current value displayed in the spinbutton entry as + an integer. If the value is a fraction, this method rounds it + to the nearest whole number. + </simpara> </desc> </method> @@ -130,10 +293,20 @@ </funcprototype> </funcsynopsis> <shortdesc> - + Sets value displayed in spinbutton entry field. </shortdesc> <desc> - + <simpara> + <function class="GtkSpinButton">set_value()</function> sets the + value displayed in the spinbutton's entry field, which is + equivalent to the <literal>value</literal> field in the + spinbutton's associated <classname>GtkAdjustment</classname>. + </simpara> + <simpara> + If the <literal>lower</literal> or <literal>upper</literal> bounds + set in the adjustment are exceeded, the value of the appropriate + bound will replace the value passed as the parameter in this method. + </simpara> </desc> </method> @@ -141,14 +314,32 @@ <funcsynopsis> <funcprototype> <funcdef>void <function>set_update_policy</function></funcdef> - <paramdef><enumname>GtkSpinButtonUpdatePolicy</enumname> <parameter>policy</parameter></paramdef> + <paramdef> + <enumname>GtkSpinButtonUpdatePolicy</enumname> + <parameter>policy</parameter> + </paramdef> </funcprototype> </funcsynopsis> <shortdesc> - - </shortdesc> - <desc> - + Controls update policy. + </shortdesc> + <desc> + <simpara> + There are only two possible settings for the spinbutton update policy. + Setting it as <literal>GTK_UPDATE_IF_VALID</literal> prevents the + current value from being changed where the newly entered value is + outside the range determined by the underlying + <classname>GtkAdjustment</classname>. + </simpara> + <simpara> + The default setting is <literal>GTK_UPDATE_ALWAYS</literal>, which + allows the update to continue by replacing an invalid value with + the value of the nearest range boundary. + </simpara> + <simpara> + Note that <function classname="GtkSpinButton">set_value()</function>. + overrides the update policy setting. + </simpara> </desc> </method> @@ -160,10 +351,21 @@ </funcprototype> </funcsynopsis> <shortdesc> - + Toggles the way non-numeric input is treated in display. </shortdesc> <desc> - + <simpara> + <function class="GtkSpinButton">set_numeric()</function>, when set + to <literal>true</literal>, prevents non-numeric characters other + than the decimal point and positive/negative signs from being + displayed in the spinbutton's <classname>GtkEntry</classname> at + the point of being keyed in. + </simpara> + <simpara> + Note that inappropriate characters will not be accepted by the + underlying <classname>GtkAdjustment</classname> in any case; this + is purely a masking function at display level. + </simpara> </desc> </method> @@ -171,15 +373,26 @@ <funcsynopsis> <funcprototype> <funcdef>void <function>spin</function></funcdef> - <paramdef><enumname>GtkSpinType</enumname> <parameter>direction</parameter></paramdef> + <paramdef> + <enumname>GtkSpinType</enumname> + <parameter>direction</parameter> + </paramdef> <paramdef>double <parameter>increment</parameter></paramdef> </funcprototype> </funcsynopsis> <shortdesc> - + Forces a spin. </shortdesc> <desc> - + <simpara> + This method resets the displayed value to a new value that is + determined by the <enumname>GtkSpinType</enumname> chosen. It is + used internally to set up the functions associated with mouse button + presses over the spinbutton's arrows. These are, a left click spins + one step increment, a middle button click spins one page increment, and + a right click spins to the lower or upper bound depending on which + arrow is pressed. + </simpara> </desc> </method> @@ -191,10 +404,20 @@ </funcprototype> </funcsynopsis> <shortdesc> - + Toggles whether the display wraps. </shortdesc> <desc> - + <simpara> + Where <function class="GtkSpinButton">set_wrap()</function> is set to + <literal>true</literal>, the spinbutton having displayed the upper + bound of its value range will return to the lower bound on the next + step increment. In other words, if the range is 1 to 10, 1 will follow + 10 in the display area when the <literal>up</literal> arrow is pressed. + </simpara> + <simpara> + The default setting is <literal>false</literal>, which greys out the + appropriate arrow when the lower or upper bound of the range is reached. + </simpara> </desc> </method> @@ -202,14 +425,23 @@ <funcsynopsis> <funcprototype> <funcdef>void <function>set_shadow_type</function></funcdef> - <paramdef><enumname>GtkShadowType</enumname> <parameter>shadow_type</parameter></paramdef> + <paramdef> + <enumname>GtkShadowType</enumname> + <parameter>shadow_type</parameter> + </paramdef> </funcprototype> </funcsynopsis> <shortdesc> - + Controls appearance of spinbutton. </shortdesc> <desc> - + <simpara> + Sets the shadow style of the frame around the arrow buttons on a + spinbutton using the <enumname>GtkShadowType</enumname> options. + </simpara> + <simpara> + The default setting is <literal>GTK_SHADOW_NONE</literal>. + </simpara> </desc> </method> @@ -221,27 +453,31 @@ </funcprototype> </funcsynopsis> <shortdesc> - + Toggles whether input is aligned with increment. </shortdesc> <desc> - + <simpara> + <function class="GtkSpinButton">set_snap_to_ticks()</function>, if set + to <literal>true</literal>, will restrict input values to the order of + the step increment, taking the nearest value to the increment as the + input value. For example, if you have set the step increment to + <literal>0.5</literal> in a range of <literal>0.0</literal> to + <literal>2.5</literal> and the user inputs <literal>1.4</literal>, the + input will be reset to <literal>1.5</literal> - the nearest incremental + value. + </simpara> + <simpara> + The default setting is <literal>false</literal>, which allows the user + to key in anything within range to the given number of decimal points. + </simpara> + <simpara> + See also: <function class="GtkSpinButton">set_digits()</function>. + </simpara> </desc> </method> - <method id="gtk.gtkspinbutton.method.update"> - <funcsynopsis> - <funcprototype> - <funcdef>void <function>update</function></funcdef> - <paramdef>void</paramdef> - </funcprototype> - </funcsynopsis> - <shortdesc> - - </shortdesc> - <desc> - - </desc> - </method> + <!-- DELETED update() function as it seems it is for internal use only - + sf jan 02 --> </methods>