]> Pileus Git - ~andy/gtk/blobdiff - gtk/gtkrange.h
Display an error when we come to the root.
[~andy/gtk] / gtk / gtkrange.h
index c82c9b5d7a05279c0cd747d22be31c624d13b21b..d4ef1b3e81b639d165968fa649651d3125dca5ba 100644 (file)
@@ -2,23 +2,23 @@
  * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
  *
  * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
+ * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2 of the License, or (at your option) any later version.
  *
  * This library is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Library General Public License for more details.
+ * Lesser General Public License for more details.
  *
- * You should have received a copy of the GNU Library General Public
+ * You should have received a copy of the GNU Lesser General Public
  * License along with this library; if not, write to the
  * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
  * Boston, MA 02111-1307, USA.
  */
 
 /*
- * Modified by the GTK+ Team and others 1997-1999.  See the AUTHORS
+ * Modified by the GTK+ Team and others 1997-2000.  See the AUTHORS
  * file for a list of people on the GTK+ Team.  See the ChangeLog
  * files for a list of changes.  These files are distributed with
  * GTK+ at ftp://ftp.gtk.org/pub/gtk/. 
 #include <gtk/gtkwidget.h>
 
 
-#ifdef __cplusplus
-extern "C" {
-#endif /* __cplusplus */
+G_BEGIN_DECLS
 
 
 #define GTK_TYPE_RANGE            (gtk_range_get_type ())
-#define GTK_RANGE(obj)            (GTK_CHECK_CAST ((obj), GTK_TYPE_RANGE, GtkRange))
-#define GTK_RANGE_CLASS(klass)    (GTK_CHECK_CLASS_CAST ((klass), GTK_TYPE_RANGE, GtkRangeClass))
-#define GTK_IS_RANGE(obj)         (GTK_CHECK_TYPE ((obj), GTK_TYPE_RANGE))
-#define GTK_IS_RANGE_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((klass), GTK_TYPE_RANGE))
-#define GTK_RANGE_GET_CLASS(obj)  (GTK_CHECK_GET_CLASS ((obj), GTK_TYPE_RANGE, GtkRangeClass))
+#define GTK_RANGE(obj)            (G_TYPE_CHECK_INSTANCE_CAST ((obj), GTK_TYPE_RANGE, GtkRange))
+#define GTK_RANGE_CLASS(klass)    (G_TYPE_CHECK_CLASS_CAST ((klass), GTK_TYPE_RANGE, GtkRangeClass))
+#define GTK_IS_RANGE(obj)         (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GTK_TYPE_RANGE))
+#define GTK_IS_RANGE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GTK_TYPE_RANGE))
+#define GTK_RANGE_GET_CLASS(obj)  (G_TYPE_INSTANCE_GET_CLASS ((obj), GTK_TYPE_RANGE, GtkRangeClass))
 
+/* These two are private/opaque types, ignore */
+typedef struct _GtkRangeLayout    GtkRangeLayout;
+typedef struct _GtkRangeStepTimer GtkRangeStepTimer;
 
 typedef struct _GtkRange        GtkRange;
 typedef struct _GtkRangeClass   GtkRangeClass;
@@ -53,108 +54,117 @@ struct _GtkRange
 {
   GtkWidget widget;
 
-  GdkWindow *trough;
-  GdkWindow *slider;
-  GdkWindow *step_forw;
-  GdkWindow *step_back;
-
-  gint16 x_click_point;
-  gint16 y_click_point;
-
-  guint8 button;
-  gint8 digits;
-  guint policy : 2;
-  guint scroll_type : 3;
-  guint in_child : 3;
-  guint click_child : 3;
-  guint need_timer : 1;
-
-  guint32 timer;
-
-  gfloat old_value;
-  gfloat old_lower;
-  gfloat old_upper;
-  gfloat old_page_size;
-
   GtkAdjustment *adjustment;
+  GtkUpdateType update_policy;
+  guint inverted : 1;
+
+  /*< protected >*/
+  
+  guint flippable : 1;
+  
+  /* Steppers are: < > ---- < >
+   *               a b      c d
+   */
+   
+  guint has_stepper_a : 1;
+  guint has_stepper_b : 1;
+  guint has_stepper_c : 1;
+  guint has_stepper_d : 1;
+
+  guint need_recalc : 1;
+
+  guint slider_size_fixed : 1;
+  
+  gint min_slider_size;
+
+  GtkOrientation orientation;
+
+  /* Area of entire stepper + trough assembly in widget->window coords */
+  GdkRectangle range_rect;
+  /* Slider range along the long dimension, in widget->window coords */
+  gint slider_start, slider_end;
+
+  /* Round off value to this many digits, -1 for no rounding */
+  gint round_digits;
+  
+  /*< private >*/
+  guint trough_click_forward : 1;  /* trough click was on the forward side of slider */
+  guint update_pending : 1;        /* need to emit value_changed */
+  GtkRangeLayout *layout;
+  GtkRangeStepTimer *timer;
+  gint slide_initial_slider_position;
+  gint slide_initial_coordinate;
+  guint update_timeout_id;
+  GdkWindow *event_window;
 };
 
 struct _GtkRangeClass
 {
   GtkWidgetClass parent_class;
 
-  gint slider_width;
-  gint stepper_size;
-  gint stepper_slider_spacing;
-  gint min_slider_size;
-
-  guint8 trough;
-  guint8 slider;
-  guint8 step_forw;
-  guint8 step_back;
-
-  void (* draw_background)  (GtkRange *range);
-  void (* clear_background) (GtkRange *range);
-  void (* draw_trough)     (GtkRange *range);
-  void (* draw_slider)     (GtkRange *range);
-  void (* draw_step_forw)  (GtkRange *range);
-  void (* draw_step_back)  (GtkRange *range);
-  void (* slider_update)   (GtkRange *range);
-  gint (* trough_click)    (GtkRange *range,
-                           gint      x,
-                           gint      y,
-                           gfloat   *jump_perc);
-  gint (* trough_keys)     (GtkRange *range,
-                           GdkEventKey *key,
-                           GtkScrollType *scroll,
-                           GtkTroughType *trough);
-  void (* motion)          (GtkRange *range,
-                           gint      xdelta,
-                           gint      ydelta);
-  gint (* timer)           (GtkRange *range);
+  /* what detail to pass to GTK drawing functions */
+  gchar *slider_detail;
+  gchar *stepper_detail;
+
+  void (* value_changed)    (GtkRange     *range);
+  void (* adjust_bounds)    (GtkRange     *range,
+                             gdouble      new_value);
+  
+  /* action signals for keybindings */
+  void (* move_slider)      (GtkRange     *range,
+                             GtkScrollType scroll);
+
+  /* Virtual functions */
+  void (* get_range_border) (GtkRange     *range,
+                             GtkBorder    *border_);
+
+  gboolean (* change_value) (GtkRange     *range,
+                             GtkScrollType scroll,
+                             gdouble       new_value);
+
+  /* Padding for future expansion */
+  void (*_gtk_reserved1) (void);
+  void (*_gtk_reserved2) (void);
+  void (*_gtk_reserved3) (void);
 };
 
 
-GtkType        gtk_range_get_type               (void);
-GtkAdjustment* gtk_range_get_adjustment         (GtkRange      *range);
-void           gtk_range_set_update_policy      (GtkRange      *range,
-                                                GtkUpdateType  policy);
-void           gtk_range_set_adjustment         (GtkRange      *range,
-                                                GtkAdjustment *adjustment);
-
-void           gtk_range_draw_background        (GtkRange      *range);
-void           gtk_range_clear_background        (GtkRange      *range);
-void           gtk_range_draw_trough            (GtkRange      *range);
-void           gtk_range_draw_slider            (GtkRange      *range);
-void           gtk_range_draw_step_forw         (GtkRange      *range);
-void           gtk_range_draw_step_back         (GtkRange      *range);
-void           gtk_range_slider_update          (GtkRange      *range);
-gint           gtk_range_trough_click           (GtkRange      *range,
-                                                gint           x,
-                                                gint           y,
-                                                gfloat        *jump_perc);
-
-void           gtk_range_default_hslider_update (GtkRange      *range);
-void           gtk_range_default_vslider_update (GtkRange      *range);
-gint           gtk_range_default_htrough_click  (GtkRange      *range,
-                                                gint           x,
-                                                gint           y,
-                                                gfloat        *jump_perc);
-gint           gtk_range_default_vtrough_click  (GtkRange      *range,
-                                                gint           x,
-                                                gint           y,
-                                                gfloat        *jump_perc);
-void           gtk_range_default_hmotion        (GtkRange      *range,
-                                                gint           xdelta,
-                                                gint           ydelta);
-void           gtk_range_default_vmotion        (GtkRange      *range,
-                                                gint           xdelta,
-                                                gint           ydelta);
-
-
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
+GType              gtk_range_get_type                      (void) G_GNUC_CONST;
+
+void               gtk_range_set_update_policy             (GtkRange      *range,
+                                                            GtkUpdateType  policy);
+GtkUpdateType      gtk_range_get_update_policy             (GtkRange      *range);
+
+void               gtk_range_set_adjustment                (GtkRange      *range,
+                                                            GtkAdjustment *adjustment);
+GtkAdjustment*     gtk_range_get_adjustment                (GtkRange      *range);
+
+void               gtk_range_set_inverted                  (GtkRange      *range,
+                                                            gboolean       setting);
+gboolean           gtk_range_get_inverted                  (GtkRange      *range);
+
+void               gtk_range_set_lower_stepper_sensitivity (GtkRange      *range,
+                                                            GtkSensitivityType sensitivity);
+GtkSensitivityType gtk_range_get_lower_stepper_sensitivity (GtkRange      *range);
+void               gtk_range_set_upper_stepper_sensitivity (GtkRange      *range,
+                                                            GtkSensitivityType sensitivity);
+GtkSensitivityType gtk_range_get_upper_stepper_sensitivity (GtkRange      *range);
+
+void               gtk_range_set_increments                (GtkRange      *range,
+                                                            gdouble        step,
+                                                            gdouble        page);
+void               gtk_range_set_range                     (GtkRange      *range,
+                                                            gdouble        min,
+                                                            gdouble        max);
+void               gtk_range_set_value                     (GtkRange      *range,
+                                                            gdouble        value);
+gdouble            gtk_range_get_value                     (GtkRange      *range);
+
+gdouble                  _gtk_range_get_wheel_delta               (GtkRange      *range,
+                                                            GdkScrollDirection direction);
+
+
+G_END_DECLS
 
 
 #endif /* __GTK_RANGE_H__ */