]> Pileus Git - ~andy/gtk/blobdiff - gtk/gtkvscale.c
/tmp/cvsX7MHVx
[~andy/gtk] / gtk / gtkvscale.c
index c7b8b9e5c1754bc0e95c03819e8ed1e7fd5c7d34..a9c02142e51fe16105cfd3a13fbd110288cbbc14 100644 (file)
  * GTK+ at ftp://ftp.gtk.org/pub/gtk/. 
  */
 
+#include <config.h>
 #include <math.h>
 #include <stdio.h>
 #include <stdlib.h>
 #include "gtkvscale.h"
 #include "gtkintl.h"
+#include "gtkalias.h"
 
 #define VALUE_SPACING 2
 
-static gpointer parent_class;
-
-static void     gtk_vscale_class_init       (GtkVScaleClass *klass);
-static void     gtk_vscale_init             (GtkVScale      *vscale);
 static gboolean gtk_vscale_expose           (GtkWidget      *widget,
                                              GdkEventExpose *event);
 
@@ -43,32 +41,7 @@ static void  gtk_vscale_get_layout_offsets (GtkScale         *scale,
                                                gint            *x,
                                                gint            *y);
 
-GType
-gtk_vscale_get_type (void)
-{
-  static GType vscale_type = 0;
-  
-  if (!vscale_type)
-    {
-      static const GTypeInfo vscale_info =
-      {
-       sizeof (GtkVScaleClass),
-       NULL,           /* base_init */
-       NULL,           /* base_finalize */
-       (GClassInitFunc) gtk_vscale_class_init,
-       NULL,           /* class_finalize */
-       NULL,           /* class_data */
-       sizeof (GtkVScale),
-       0,              /* n_preallocs */
-       (GInstanceInitFunc) gtk_vscale_init,
-      };
-      
-      vscale_type = g_type_register_static (GTK_TYPE_SCALE, "GtkVScale",
-                                           &vscale_info, 0);
-    }
-  
-  return vscale_type;
-}
+G_DEFINE_TYPE (GtkVScale, gtk_vscale, GTK_TYPE_SCALE)
 
 static void
 gtk_vscale_class_init (GtkVScaleClass *class)
@@ -81,8 +54,6 @@ gtk_vscale_class_init (GtkVScaleClass *class)
   range_class = GTK_RANGE_CLASS (class); 
   scale_class = GTK_SCALE_CLASS (class); 
 
-  parent_class = g_type_class_peek_parent (class);
-
   range_class->slider_detail = "vscale";
   
   scale_class->get_layout_offsets = gtk_vscale_get_layout_offsets;
@@ -118,6 +89,10 @@ gtk_vscale_new (GtkAdjustment *adjustment)
  * increment @step.  @step must be nonzero; it's the distance the
  * slider moves when using the arrow keys to adjust the scale value.
  * 
+ * Note that the way in which the precision is derived works best if @step 
+ * is a power of ten. If the resulting precision is not suitable for your 
+ * needs, use gtk_scale_set_digits() to correct it. 
+ * 
  * Return value: a new #GtkVScale
  **/
 GtkWidget*
@@ -162,8 +137,8 @@ gtk_vscale_expose (GtkWidget      *widget,
   /* We need to chain up _first_ so the various geometry members of
    * GtkRange struct are updated.
    */
-  if (GTK_WIDGET_CLASS (parent_class)->expose_event)
-    GTK_WIDGET_CLASS (parent_class)->expose_event (widget, event);
+  if (GTK_WIDGET_CLASS (gtk_vscale_parent_class)->expose_event)
+    GTK_WIDGET_CLASS (gtk_vscale_parent_class)->expose_event (widget, event);
 
   if (scale->draw_value)
     {
@@ -218,7 +193,7 @@ gtk_vscale_get_layout_offsets (GtkScale *scale,
   range = GTK_RANGE (widget);
   scale = GTK_SCALE (widget);
 
-  gtk_widget_style_get (widget, "value_spacing", &value_spacing, NULL);
+  gtk_widget_style_get (widget, "value-spacing", &value_spacing, NULL);
       
   pango_layout_get_pixel_extents (layout, NULL, &logical_rect);
     
@@ -257,3 +232,5 @@ gtk_vscale_get_layout_offsets (GtkScale *scale,
   *y += widget->allocation.y;
 }
 
+#define __GTK_VSCALE_C__
+#include "gtkaliasdef.c"