]> Pileus Git - ~andy/gtk/blob - examples/gtkdial/gtkdial.h
threads example from Erik Mouw. New question on GtkLabel background
[~andy/gtk] / examples / gtkdial / gtkdial.h
1 /* example-start gtkdial gtkdial.h */
2
3 /* GTK - The GIMP Toolkit
4  * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
5  *
6  * This library is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU Library General Public
8  * License as published by the Free Software Foundation; either
9  * version 2 of the License, or (at your option) any later version.
10  *
11  * This library is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
14  * Library General Public License for more details.
15  *
16  * You should have received a copy of the GNU Library General Public
17  * License along with this library; if not, write to the
18  * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
19  * Boston, MA 02111-1307, USA.
20  */
21 #ifndef __GTK_DIAL_H__
22 #define __GTK_DIAL_H__
23
24
25 #include <gdk/gdk.h>
26 #include <gtk/gtkadjustment.h>
27 #include <gtk/gtkwidget.h>
28
29
30 #ifdef __cplusplus
31 extern "C" {
32 #endif /* __cplusplus */
33
34
35 #define GTK_DIAL(obj)          GTK_CHECK_CAST (obj, gtk_dial_get_type (), GtkDial)
36 #define GTK_DIAL_CLASS(klass)  GTK_CHECK_CLASS_CAST (klass, gtk_dial_get_type (), GtkDialClass)
37 #define GTK_IS_DIAL(obj)       GTK_CHECK_TYPE (obj, gtk_dial_get_type ())
38
39
40 typedef struct _GtkDial        GtkDial;
41 typedef struct _GtkDialClass   GtkDialClass;
42
43 struct _GtkDial
44 {
45   GtkWidget widget;
46
47   /* update policy (GTK_UPDATE_[CONTINUOUS/DELAYED/DISCONTINUOUS]) */
48   guint policy : 2;
49
50   /* Button currently pressed or 0 if none */
51   guint8 button;
52
53   /* Dimensions of dial components */
54   gint radius;
55   gint pointer_width;
56
57   /* ID of update timer, or 0 if none */
58   guint32 timer;
59
60   /* Current angle */
61   gfloat angle;
62   gfloat last_angle;
63
64   /* Old values from adjustment stored so we know when something changes */
65   gfloat old_value;
66   gfloat old_lower;
67   gfloat old_upper;
68
69   /* The adjustment object that stores the data for this dial */
70   GtkAdjustment *adjustment;
71 };
72
73 struct _GtkDialClass
74 {
75   GtkWidgetClass parent_class;
76 };
77
78
79 GtkWidget*     gtk_dial_new                    (GtkAdjustment *adjustment);
80 guint          gtk_dial_get_type               (void);
81 GtkAdjustment* gtk_dial_get_adjustment         (GtkDial      *dial);
82 void           gtk_dial_set_update_policy      (GtkDial      *dial,
83                                                 GtkUpdateType  policy);
84
85 void           gtk_dial_set_adjustment         (GtkDial      *dial,
86                                                 GtkAdjustment *adjustment);
87 #ifdef __cplusplus
88 }
89 #endif /* __cplusplus */
90
91
92 #endif /* __GTK_DIAL_H__ */
93 /* example-end */