diff options
author | Owen Taylor <otaylor@src.gnome.org> | 1998-11-06 22:05:02 +0000 |
---|---|---|
committer | Owen Taylor <otaylor@src.gnome.org> | 1998-11-06 22:05:02 +0000 |
commit | e2a521922085c8010028e227f61bba59ea6b8242 (patch) | |
tree | 2500d6aa6f63aab4b58c17546532ecce8fdcca37 /gtk/gtkscale.c | |
parent | 3c0df19a588bd96f328bda975db8eb9fa7f79e81 (diff) | |
download | gdk-pixbuf-e2a521922085c8010028e227f61bba59ea6b8242.tar.gz |
Merge from themes-2. See the ChangeLog for a somewhat detailed
history of the evolution of the changes involved. Most of this
is actually minor painting tweaks.
Diffstat (limited to 'gtk/gtkscale.c')
-rw-r--r-- | gtk/gtkscale.c | 43 |
1 files changed, 43 insertions, 0 deletions
diff --git a/gtk/gtkscale.c b/gtk/gtkscale.c index 7592f1aec..9992160a4 100644 --- a/gtk/gtkscale.c +++ b/gtk/gtkscale.c @@ -26,6 +26,9 @@ static void gtk_scale_class_init (GtkScaleClass *klass); static void gtk_scale_init (GtkScale *scale); +static void gtk_scale_map (GtkWidget *widget); +static void gtk_scale_unmap (GtkWidget *widget); + static void gtk_scale_draw_background (GtkRange *range); @@ -61,13 +64,18 @@ static void gtk_scale_class_init (GtkScaleClass *class) { GtkObjectClass *object_class; + GtkWidgetClass *widget_class; GtkRangeClass *range_class; object_class = (GtkObjectClass*) class; range_class = (GtkRangeClass*) class; + widget_class = (GtkWidgetClass*) class; parent_class = gtk_type_class (gtk_range_get_type ()); + widget_class->map = gtk_scale_map; + widget_class->unmap = gtk_scale_unmap; + range_class->draw_background = gtk_scale_draw_background; class->slider_length = 31; @@ -79,11 +87,46 @@ static void gtk_scale_init (GtkScale *scale) { GTK_WIDGET_SET_FLAGS (scale, GTK_CAN_FOCUS); + GTK_WIDGET_SET_FLAGS (scale, GTK_NO_WINDOW); GTK_RANGE (scale)->digits = 1; scale->draw_value = TRUE; scale->value_pos = GTK_POS_TOP; } +static void +gtk_scale_map (GtkWidget *widget) +{ + GtkRange *range; + + g_return_if_fail (widget != NULL); + g_return_if_fail (GTK_IS_SCALE (widget)); + + GTK_WIDGET_SET_FLAGS (widget, GTK_MAPPED); + range = GTK_RANGE (widget); + + if (GTK_WIDGET_NO_WINDOW (widget)) + gtk_widget_queue_draw (widget); + + gdk_window_show (range->trough); +} + +static void +gtk_scale_unmap (GtkWidget *widget) +{ + GtkRange *range; + + g_return_if_fail (widget != NULL); + g_return_if_fail (GTK_IS_SCALE (widget)); + + GTK_WIDGET_UNSET_FLAGS (widget, GTK_MAPPED); + range = GTK_RANGE (widget); + + if (GTK_WIDGET_NO_WINDOW (widget)) + gtk_widget_queue_clear (widget); + + gdk_window_hide (range->trough); +} + void gtk_scale_set_digits (GtkScale *scale, gint digits) |