gtkspinbuttonsci.h

Go to the documentation of this file.
00001 /* GTK - The GIMP Toolkit
00002  * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
00003  *
00004  * GtkSpinButton widget for GTK+
00005  * Copyright (C) 1998 Lars Hamann and Stefan Jeske
00006  *
00007  * This library is free software; you can redistribute it and/or
00008  * modify it under the terms of the GNU Lesser General Public
00009  * License as published by the Free Software Foundation; either
00010  * version 2 of the License, or (at your option) any later version.
00011  *
00012  * This library is distributed in the hope that it will be useful,
00013  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00014  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00015  * Lesser General Public License for more details.
00016  *
00017  * You should have received a copy of the GNU Lesser General Public
00018  * License along with this library; if not, write to the
00019  * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
00020  * Boston, MA 02111-1307, USA.
00021  */
00022 
00023 /*
00024  * Modified by the GTK+ Team and others 1997-2000.  See the AUTHORS
00025  * file for a list of people on the GTK+ Team.  See the ChangeLog
00026  * files for a list of changes.  These files are distributed with
00027  * GTK+ at ftp://ftp.gtk.org/pub/gtk/. 
00028  */
00029 
00030 #ifndef __GTK_SPIN_BUTTON_SCI_H__
00031 #define __GTK_SPIN_BUTTON_SCI_H__
00032 
00033 
00034 #include <gdk/gdk.h>
00035 #include <gtk/gtkentry.h>
00036 #include <gtk/gtkadjustment.h>
00037 
00038 
00039 #ifdef __cplusplus
00040 extern "C" {
00041 #endif /* __cplusplus */
00042 
00043 #define GTK_TYPE_SPIN_BUTTON_SCI                  (gtk_spin_button_sci_get_type ())
00044 #define GTK_SPIN_BUTTON_SCI(obj)                  (G_TYPE_CHECK_INSTANCE_CAST ((obj), GTK_TYPE_SPIN_BUTTON_SCI, GtkSpinbuttonsci))
00045 #define GTK_SPIN_BUTTON_SCI_CLASS(klass)          (G_TYPE_CHECK_CLASS_CAST ((klass), GTK_TYPE_SPIN_BUTTON_SCI, GtkSpinbuttonsciClass))
00046 #define GTK_IS_SPIN_BUTTON_SCI(obj)               (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GTK_TYPE_SPIN_BUTTON_SCI))
00047 #define GTK_IS_SPIN_BUTTON_SCI_CLASS(klass)       (G_TYPE_CHECK_CLASS_TYPE ((klass), GTK_TYPE_SPIN_BUTTON_SCI))
00048 #define GTK_SPIN_BUTTON_SCI_GET_CLASS(obj)        (G_TYPE_INSTANCE_GET_CLASS ((obj), GTK_TYPE_SPIN_BUTTON_SCI, GtkSpinbuttonsciClass))
00049 
00050 #define GTK_INPUT_ERROR -1
00051 
00052 typedef enum
00053 {
00054   GTK_SPIN_SCI_UPDATE_ALWAYS,
00055   GTK_SPIN_SCI_UPDATE_IF_VALID
00056 } GtkSpinbuttonsciUpdatePolicy;
00057 
00058 typedef enum
00059 {
00060   GTK_SPIN_SCI_STEP_FORWARD,
00061   GTK_SPIN_SCI_STEP_BACKWARD,
00062   GTK_SPIN_SCI_PAGE_FORWARD,
00063   GTK_SPIN_SCI_PAGE_BACKWARD,
00064   GTK_SPIN_SCI_HOME,
00065   GTK_SPIN_SCI_END,
00066   GTK_SPIN_SCI_USER_DEFINED
00067 } GtkSpinsciType;
00068 
00069 
00070 typedef struct _GtkSpinbuttonsci            GtkSpinbuttonsci;
00071 typedef struct _GtkSpinbuttonsciClass  GtkSpinbuttonsciClass;
00072 
00073 
00074 struct _GtkSpinbuttonsci
00075 {
00076   GtkEntry entry;
00077   
00078   GtkAdjustment *adjustment;
00079   GtkAdjustment *adjustment_safety;
00080   
00081   GdkWindow *panel;
00082   
00083   guint32 timer;
00084   
00085   gdouble climb_rate;
00086   gdouble timer_step;
00087   
00088   GtkSpinbuttonsciUpdatePolicy update_policy;
00089   
00090   guint in_child : 2;
00091   guint click_child : 2; /* valid: GTK_ARROW_UP=0, GTK_ARROW_DOWN=1 or 2=NONE/BOTH */
00092   guint button : 2;
00093   guint need_timer : 1;
00094   guint timer_calls : 3;
00095   guint digits : 10;
00096   guint numeric : 1;
00097   guint wrap : 1;
00098   guint snap_to_ticks : 1;
00099   guint jump_to_limits : 1;
00100   guint sci_fixed_point_mantisse : 1;
00101   guint sci_max_left_digits : 10;
00102   guint sci_extension_magnitude_arrows : 1;
00103 
00104   gchar *sci_suffix;
00105 };
00106 
00107 struct _GtkSpinbuttonsciClass
00108 {
00109   GtkEntryClass parent_class;
00110 
00111   gint (*input)  (GtkSpinbuttonsci *spin_button_sci,
00112                   gdouble       *new_value);
00113   gint (*output) (GtkSpinbuttonsci *spin_button_sci);
00114   void (*value_changed) (GtkSpinbuttonsci *spin_button_sci);
00115 
00116   /* Action signals for keybindings, do not connect to these */
00117   void (*change_value) (GtkSpinbuttonsci *spin_button_sci,
00118                         GtkScrollType  scroll);
00119 
00120   /* Padding for future expansion */
00121   void (*_gtk_reserved1) (void);
00122   void (*_gtk_reserved2) (void);
00123   void (*_gtk_reserved3) (void);
00124   void (*_gtk_reserved4) (void);
00125 };
00126 
00127 
00128 GType           gtk_spin_button_sci_get_type       (void) G_GNUC_CONST;
00129 
00130 void            gtk_spin_button_sci_configure      (GtkSpinbuttonsci  *spin_button_sci,
00131                                                     GtkAdjustment  *adjustment,
00132                                                     gdouble         climb_rate,
00133                                                     guint           digits);
00134 
00135 GtkWidget*      gtk_spin_button_sci_new            (GtkAdjustment  *adjustment,
00136                                                     gdouble         climb_rate,
00137                                                     guint           digits);
00138 
00139 GtkWidget*      gtk_spin_button_sci_new_with_range         (gdouble  min,
00140                                                     gdouble  max,
00141                                                     gdouble  step);
00142 
00143 void            gtk_spin_button_sci_set_adjustment         (GtkSpinbuttonsci  *spin_button_sci,
00144                                                     GtkAdjustment  *adjustment);
00145 
00146 GtkAdjustment*  gtk_spin_button_sci_get_adjustment         (GtkSpinbuttonsci  *spin_button_sci);
00147 
00148 void            gtk_spin_button_sci_set_digits     (GtkSpinbuttonsci  *spin_button_sci,
00149                                                     guint           digits);
00150 guint           gtk_spin_button_sci_get_digits         (GtkSpinbuttonsci  *spin_button_sci);
00151 
00152 void            gtk_spin_button_sci_set_increments         (GtkSpinbuttonsci  *spin_button_sci,
00153                                                     gdouble         step,
00154                                                     gdouble         page);
00155 void            gtk_spin_button_sci_get_increments     (GtkSpinbuttonsci  *spin_button_sci,
00156                                                     gdouble        *step,
00157                                                     gdouble        *page);
00158 
00159 void            gtk_spin_button_sci_set_range      (GtkSpinbuttonsci  *spin_button_sci,
00160                                                     gdouble         min,
00161                                                     gdouble         max);
00162 void            gtk_spin_button_sci_get_range          (GtkSpinbuttonsci  *spin_button_sci,
00163                                                     gdouble        *min,
00164                                                     gdouble        *max);
00165 
00166 void            gtk_spin_button_sci_set_suffix     (GtkSpinbuttonsci  *spin_button_sci,
00167                                                     gchar       *suffix);
00168 
00169 gdouble         gtk_spin_button_sci_get_value          (GtkSpinbuttonsci  *spin_button_sci);
00170 
00171 gint            gtk_spin_button_sci_get_value_as_int   (GtkSpinbuttonsci  *spin_button_sci);
00172 
00173 void            gtk_spin_button_sci_set_value      (GtkSpinbuttonsci  *spin_button_sci, 
00174                                                     gdouble         value);
00175 
00176 void            gtk_spin_button_sci_set_update_policy  (GtkSpinbuttonsci  *spin_button_sci,
00177                                                     GtkSpinbuttonsciUpdatePolicy  policy);
00178 GtkSpinbuttonsciUpdatePolicy gtk_spin_button_sci_get_update_policy (GtkSpinbuttonsci *spin_button_sci);
00179 
00180 void            gtk_spin_button_sci_set_numeric    (GtkSpinbuttonsci  *spin_button_sci,
00181                                                     gboolean        numeric);
00182 gboolean        gtk_spin_button_sci_get_numeric        (GtkSpinbuttonsci  *spin_button_sci);
00183 
00184 void            gtk_spin_button_sci_spin                   (GtkSpinbuttonsci  *spin_button_sci,
00185                                                     GtkSpinsciType     direction,
00186                                                     gdouble         increment);
00187 
00188 void            gtk_spin_button_sci_set_wrap       (GtkSpinbuttonsci  *spin_button_sci,
00189                                                     gboolean        wrap);
00190 gboolean        gtk_spin_button_sci_get_wrap           (GtkSpinbuttonsci  *spin_button_sci);
00191 
00192 void            gtk_spin_button_sci_set_snap_to_ticks  (GtkSpinbuttonsci  *spin_button_sci,
00193                                                     gboolean        snap_to_ticks);
00194 gboolean        gtk_spin_button_sci_get_snap_to_ticks  (GtkSpinbuttonsci  *spin_button_sci);
00195 void            gtk_spin_button_sci_update             (GtkSpinbuttonsci  *spin_button_sci);
00196 
00197 
00198 #ifndef GTK_DISABLE_DEPRECATED
00199 #define gtk_spin_button_sci_get_value_as_float gtk_spin_button_sci_get_value
00200 #endif
00201 
00202 #ifdef __cplusplus
00203 }
00204 #endif /* __cplusplus */
00205 
00206 
00207 #endif /* __GTK_SPIN_BUTTON_SCI_H__ */

Generated on Sat Apr 1 09:03:57 2006 for GXSM by  doxygen 1.4.6