#include <stdlib.h>
#include "gtkhscale.h"
#include "gtkintl.h"
+#include "gtkalias.h"
-static gpointer parent_class;
-
-static void gtk_hscale_class_init (GtkHScaleClass *klass);
-static void gtk_hscale_init (GtkHScale *hscale);
static gboolean gtk_hscale_expose (GtkWidget *widget,
GdkEventExpose *event);
gint *x,
gint *y);
-GType
-gtk_hscale_get_type (void)
-{
- static GType hscale_type = 0;
-
- if (!hscale_type)
- {
- static const GTypeInfo hscale_info =
- {
- sizeof (GtkHScaleClass),
- NULL, /* base_init */
- NULL, /* base_finalize */
- (GClassInitFunc) gtk_hscale_class_init,
- NULL, /* class_finalize */
- NULL, /* class_data */
- sizeof (GtkHScale),
- 0, /* n_preallocs */
- (GInstanceInitFunc) gtk_hscale_init,
- };
-
- hscale_type = g_type_register_static (GTK_TYPE_SCALE, "GtkHScale",
- &hscale_info, 0);
- }
-
- return hscale_type;
-}
+G_DEFINE_TYPE (GtkHScale, gtk_hscale, GTK_TYPE_SCALE)
static void
gtk_hscale_class_init (GtkHScaleClass *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 = "hscale";
scale_class->get_layout_offsets = gtk_hscale_get_layout_offsets;
* 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 #GtkHScale
**/
GtkWidget*
/* 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_hscale_parent_class)->expose_event)
+ GTK_WIDGET_CLASS (gtk_hscale_parent_class)->expose_event (widget, event);
if (scale->draw_value)
{
return;
}
- gtk_widget_style_get (widget, "value_spacing", &value_spacing, NULL);
+ gtk_widget_style_get (widget, "value-spacing", &value_spacing, NULL);
range = GTK_RANGE (widget);
scale = GTK_SCALE (widget);
*x += widget->allocation.x;
*y += widget->allocation.y;
}
+
+#define __GTK_HSCALE_C__
+#include "gtkaliasdef.c"