diff options
author | Havoc Pennington <hp@pobox.com> | 2001-06-04 02:31:12 +0000 |
---|---|---|
committer | Havoc Pennington <hp@src.gnome.org> | 2001-06-04 02:31:12 +0000 |
commit | 42f429be76e96f1861a17da2cd5ef56741172e25 (patch) | |
tree | 3ca33e80692cfb0f73e4621113bce3dbcb0546a9 /gtk/gtkrange.h | |
parent | 741c71eb931cb85651e9f5aba99db4017dda180a (diff) | |
download | gtk+-42f429be76e96f1861a17da2cd5ef56741172e25.tar.gz |
make this special-case hscale/vscale details, so we can use it for
2001-06-03 Havoc Pennington <hp@pobox.com>
* gtk/gtkstyle.c (gtk_default_draw_slider): make this special-case
hscale/vscale details, so we can use it for scrollbar as well.
* tests/testgtk.c (reformat_value): honor digits from GtkScale
* gtk/gtkenums.h (GtkTroughType): Remove this enum
(GtkScrollType): add START and END from GtkTroughType
* gtk/gtkstyle.c (gtk_default_draw_slider): was not properly using
its x/y arguments
* gtk/gtkrange.h, gtk/gtkrange.c, gtk/gtkscrollbar.h,
gtk/gtkscrollbar.c, gtk/gtkscale.h, gtk/gtkscale.c,
gtk/gtkhscrollbar.h, gtk/gtkhscrollbar.c, gtk/gtkvscrollbar.h,
gtk/gtkvscrollbar.c, gtk/gtkhscale.h, gtk/gtkhscale.c,
gtk/gtkvscale.h, gtk/gtkvscale.c: Rewrite GtkRange and subclasses.
Notable changes in the process:
- stepper_size style property is the height for vertical
ranges, width for horizontal; the other dimension matches
the trough size
- add ability to do NeXT-style steppers (and several other styles
that don't make any sense)
- added min_slider_length, fixed_slider_length properties to
GtkScrollbar
- cleaned some private (or at least useless) functions out of
gtkscale.h
- moved bindings to GtkScale from subclasses, even arrow keys,
since blind users don't know scale orientation.
- change move_slider action signal to use new GtkScrollType,
remove GtkTroughType argument
- digits rounds the values a range will input to the given
number of decimals, but will not try to force adjustment
values set by other controllers. That is, we no longer
modify adjustment->value inside a value_changed handler.
- added getters for GtkScale setters
- middle-click begins a slider drag
Diffstat (limited to 'gtk/gtkrange.h')
-rw-r--r-- | gtk/gtkrange.h | 135 |
1 files changed, 51 insertions, 84 deletions
diff --git a/gtk/gtkrange.h b/gtk/gtkrange.h index 58fb89a386..6228b74e3b 100644 --- a/gtk/gtkrange.h +++ b/gtk/gtkrange.h @@ -45,6 +45,9 @@ extern "C" { #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)) +/* These two are private/opaque types, ignore */ +typedef struct _GtkRangeLayout GtkRangeLayout; +typedef struct _GtkRangeStepTimer GtkRangeStepTimer; typedef struct _GtkRange GtkRange; typedef struct _GtkRangeClass GtkRangeClass; @@ -53,116 +56,80 @@ 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 : 5; - guint in_child : 3; - guint click_child : 3; - guint need_timer : 1; - guint flippable : 1; + GtkAdjustment *adjustment; + GtkUpdateType update_policy; guint inverted : 1; + + /*< protected >*/ + + guint flippable : 1; - guint32 timer; + /* 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; - gdouble old_value; - gdouble old_lower; - gdouble old_upper; - gdouble old_page_size; + GtkOrientation orientation; - GtkAdjustment *adjustment; + /* 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; }; struct _GtkRangeClass { GtkWidgetClass parent_class; - gint min_slider_size; - - guint8 trough; - guint8 slider; - guint8 step_forw; - guint8 step_back; + /* what detail to pass to GTK drawing functions */ + gchar *slider_detail; + gchar *stepper_detail; /* action signals for keybindings */ void (* move_slider) (GtkRange *range, - GtkScrollType scroll, - GtkTroughType trough); - - /* Completely broken virtual functions, please ignore */ - - 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); - gboolean (* trough_click) (GtkRange *range, - gint x, - gint y, - gdouble *jump_perc); - void (* motion) (GtkRange *range, - gint xdelta, - gint ydelta); - gboolean (* timer) (GtkRange *range); + GtkScrollType scroll); + + /* Virtual functions */ + void (* get_range_border) (GtkRange *range, + GtkBorder *border); }; GtkType gtk_range_get_type (void) G_GNUC_CONST; -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); +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_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); -gboolean _gtk_range_trough_click (GtkRange *range, - gint x, - gint y, - gdouble *jump_perc); - -void _gtk_range_default_hslider_update (GtkRange *range); -void _gtk_range_default_vslider_update (GtkRange *range); -gboolean _gtk_range_default_htrough_click (GtkRange *range, - gint x, - gint y, - gdouble *jump_perc); -gboolean _gtk_range_default_vtrough_click (GtkRange *range, - gint x, - gint y, - gdouble *jump_perc); -void _gtk_range_default_hmotion (GtkRange *range, - gint xdelta, - gint ydelta); -void _gtk_range_default_vmotion (GtkRange *range, - gint xdelta, - gint ydelta); - -void _gtk_range_get_props (GtkRange *range, - gint *slider_width, - gint *trough_border, - gint *stepper_size, - gint *stepper_spacing); - #ifdef __cplusplus } #endif /* __cplusplus */ |