* 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);
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)
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;
* 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*
/* 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)
{
gint x, y;
GtkStateType state_type;
- layout = gtk_scale_get_layout (widget);
- gtk_scale_get_layout_offsets (widget, &x, &y);
+ layout = gtk_scale_get_layout (scale);
+ gtk_scale_get_layout_offsets (scale, &x, &y);
state_type = GTK_STATE_NORMAL;
if (!GTK_WIDGET_IS_SENSITIVE (scale))
{
GtkWidget *widget;
GtkRange *range;
- GtkScale *scale;
PangoLayout *layout;
PangoRectangle logical_rect;
gint value_spacing;
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);
break;
default:
- g_return_val_if_reached (FALSE);
+ g_return_if_reached ();
*x = 0;
*y = 0;
break;
*y += widget->allocation.y;
}
+#define __GTK_VSCALE_C__
+#include "gtkaliasdef.c"