]> Pileus Git - ~andy/gtk/blob - gtk/gtkruler.h
A few more GPOINTER_TO_UINT fixes.
[~andy/gtk] / gtk / gtkruler.h
1 /* GTK - The GIMP Toolkit
2  * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
3  *
4  * This library is free software; you can redistribute it and/or
5  * modify it under the terms of the GNU Library General Public
6  * License as published by the Free Software Foundation; either
7  * version 2 of the License, or (at your option) any later version.
8  *
9  * This library is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
12  * Library General Public License for more details.
13  *
14  * You should have received a copy of the GNU Library General Public
15  * License along with this library; if not, write to the
16  * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
17  * Boston, MA 02111-1307, USA.
18  */
19 #ifndef __GTK_RULER_H__
20 #define __GTK_RULER_H__
21
22
23 #include <gdk/gdk.h>
24 #include <gtk/gtkwidget.h>
25
26
27 #ifdef __cplusplus
28 extern "C" {
29 #endif /* __cplusplus */
30
31
32 #define GTK_RULER(obj)          GTK_CHECK_CAST (obj, gtk_ruler_get_type (), GtkRuler)
33 #define GTK_RULER_CLASS(klass)  GTK_CHECK_CLASS_CAST (klass, gtk_ruler_get_type (), GtkRulerClass)
34 #define GTK_IS_RULER(obj)       GTK_CHECK_TYPE (obj, gtk_ruler_get_type ())
35
36
37 typedef struct _GtkRuler        GtkRuler;
38 typedef struct _GtkRulerClass   GtkRulerClass;
39 typedef struct _GtkRulerMetric  GtkRulerMetric;
40
41 /* All distances below are in 1/72nd's of an inch. (According to
42  * Adobe that's a point, but points are really 1/72.27 in.)
43  */
44 struct _GtkRuler
45 {
46   GtkWidget widget;
47
48   GdkPixmap *backing_store;
49   GdkGC *non_gr_exp_gc;
50   GtkRulerMetric *metric;
51   gint xsrc, ysrc;
52   gint slider_size;
53
54   /* The upper limit of the ruler (in points) */
55   gfloat lower;
56   /* The lower limit of the ruler */
57   gfloat upper;
58   /* The position of the mark on the ruler */
59   gfloat position;
60   /* The maximum size of the ruler */
61   gfloat max_size;
62 };
63
64 struct _GtkRulerClass
65 {
66   GtkWidgetClass parent_class;
67
68   void (* draw_ticks) (GtkRuler *ruler);
69   void (* draw_pos)   (GtkRuler *ruler);
70 };
71
72 struct _GtkRulerMetric
73 {
74   gchar *metric_name;
75   gchar *abbrev;
76   /* This should be points_per_unit. This is the size of the unit
77    * in 1/72nd's of an inch and has nothing to do with screen pixels */
78   gfloat pixels_per_unit;
79   gfloat ruler_scale[10];
80   gint subdivide[5];        /* five possible modes of subdivision */
81 };
82
83
84 guint gtk_ruler_get_type   (void);
85 void  gtk_ruler_set_metric (GtkRuler       *ruler,
86                             GtkMetricType   metric);
87 void  gtk_ruler_set_range  (GtkRuler       *ruler,
88                             gfloat          lower,
89                             gfloat          upper,
90                             gfloat          position,
91                             gfloat          max_size);
92 void  gtk_ruler_draw_ticks (GtkRuler       *ruler);
93 void  gtk_ruler_draw_pos   (GtkRuler       *ruler);
94
95
96 #ifdef __cplusplus
97 }
98 #endif /* __cplusplus */
99
100
101 #endif /* __GTK_RULER_H__ */