summaryrefslogtreecommitdiff
path: root/gtk/gtkhscale.c
diff options
context:
space:
mode:
authorOwen Taylor <otaylor@redhat.com>2001-04-02 15:51:28 +0000
committerOwen Taylor <otaylor@src.gnome.org>2001-04-02 15:51:28 +0000
commitc944151a3cecd2ab199d1645e22d74fe9a66df0a (patch)
treee5719998626f9ff28d2fce5c88ff2de3c5d7bb43 /gtk/gtkhscale.c
parent5d1ee0929e0c4fb6cdbfa7a4bf28e2071da9a220 (diff)
downloadgdk-pixbuf-c944151a3cecd2ab199d1645e22d74fe9a66df0a.tar.gz
Fix G_VALUE_NO_COPY_CONTENTS instead of G_SIGNAL_TYPE_STATIC_SCOPE
Mon Apr 2 10:47:57 2001 Owen Taylor <otaylor@redhat.com> * gtk/gtkwidget.c (gtk_widget_class_init): Fix G_VALUE_NO_COPY_CONTENTS instead of G_SIGNAL_TYPE_STATIC_SCOPE stupidity. Mon Apr 2 00:51:11 2001 Owen Taylor <otaylor@redhat.com> [ First pass at adding style properties. Still needs some definite fine-tuning. ] * gtk/gtkbutton.c: Add ::default_spacing style property. * gtk/gtkcheckbutton.[ch] gtkradiobutton.c: Add ::indicator_size, ::indicator_spacing style properties. * gtk/gtkoptionmenu.c: Add ::indicator_size, ::indicator_spacing style properties. * gtk/gtk{,h,v}paned.[ch]: Make handle_size a style property rather than a normal property. * gtk/gtkwidget.c: Add an ::interior_focus style property to draw focus inside buttons, in the Windows/Java Metal/etc. style. * gtk/gtkbutton.c gtk/gtkcheckbutton.c gtk/gtktogglenbutton.c: Honor ::interior_focus. * gtk/gtkentry.c: Don't draw focus at all when ::interior_focus is TRUE. * gtk/gtkrange.[ch] gtk/gtk{h,v}scrollbar.c gtk/gtk{h,v}scale.c: Add ::slider_width, ::trough_border, ::stepper_size, ::stepper_spacing style properties. * gtk/gtkscale.[ch] Add ::slider-length style property.
Diffstat (limited to 'gtk/gtkhscale.c')
-rw-r--r--gtk/gtkhscale.c40
1 files changed, 21 insertions, 19 deletions
diff --git a/gtk/gtkhscale.c b/gtk/gtkhscale.c
index c3f72a067..1f654518e 100644
--- a/gtk/gtkhscale.c
+++ b/gtk/gtkhscale.c
@@ -209,12 +209,16 @@ gtk_hscale_realize (GtkWidget *widget)
GdkWindowAttr attributes;
gint attributes_mask;
gint x, y, w, h;
+ gint slider_width, slider_length;
g_return_if_fail (widget != NULL);
g_return_if_fail (GTK_IS_HSCALE (widget));
GTK_WIDGET_SET_FLAGS (widget, GTK_REALIZED);
range = GTK_RANGE (widget);
+
+ _gtk_range_get_props (range, &slider_width, NULL, NULL, NULL);
+ gtk_widget_style_get (widget, "slider_length", &slider_length, NULL);
widget->window = gtk_widget_get_parent_window (widget);
gdk_window_ref (widget->window);
@@ -241,8 +245,8 @@ gtk_hscale_realize (GtkWidget *widget)
range->trough = gdk_window_new (widget->window, &attributes, attributes_mask);
- attributes.width = SCALE_CLASS (range)->slider_length;
- attributes.height = RANGE_CLASS (range)->slider_width;
+ attributes.width = slider_length;
+ attributes.height = slider_width;
attributes.event_mask |= (GDK_BUTTON_MOTION_MASK |
GDK_POINTER_MOTION_HINT_MASK);
@@ -281,18 +285,19 @@ static void
gtk_hscale_size_request (GtkWidget *widget,
GtkRequisition *requisition)
{
- GtkScale *scale;
+ GtkScale *scale = GTK_SCALE (widget);
+ gint slider_width, slider_length, trough_border;
g_return_if_fail (widget != NULL);
g_return_if_fail (GTK_IS_HSCALE (widget));
g_return_if_fail (requisition != NULL);
- scale = GTK_SCALE (widget);
-
- requisition->width = (SCALE_CLASS (scale)->slider_length +
- widget->style->xthickness) * 2;
- requisition->height = (RANGE_CLASS (scale)->slider_width +
- widget->style->ythickness * 2);
+ _gtk_range_get_props (GTK_RANGE (scale),
+ &slider_width, &trough_border, NULL, NULL);
+ gtk_widget_style_get (widget, "slider_length", &slider_length, NULL);
+
+ requisition->width = (slider_length + trough_border) * 2;
+ requisition->height = (slider_width + trough_border * 2);
if (scale->draw_value)
{
@@ -350,19 +355,16 @@ gtk_hscale_pos_trough (GtkHScale *hscale,
gint *w,
gint *h)
{
- GtkWidget *widget;
- GtkScale *scale;
+ GtkWidget *widget = GTK_WIDGET (hscale);
+ GtkScale *scale = GTK_SCALE (hscale);
+ gint slider_width;
+ gint trough_border;
- g_return_if_fail (hscale != NULL);
- g_return_if_fail (GTK_IS_HSCALE (hscale));
- g_return_if_fail ((x != NULL) && (y != NULL) && (w != NULL) && (h != NULL));
-
- widget = GTK_WIDGET (hscale);
- scale = GTK_SCALE (hscale);
+ _gtk_range_get_props (GTK_RANGE (scale),
+ &slider_width, &trough_border, NULL, NULL);
*w = widget->allocation.width;
- *h = (RANGE_CLASS (scale)->slider_width +
- widget->style->ythickness * 2);
+ *h = (slider_width + trough_border * 2);
if (scale->draw_value)
{