1 /* WhySynth DSSI software synthesizer GUI
2  *
3  * Copyright (C) 2008 Sean Bolton
4  *
5  * Parts of this code come from GTK+, both the library source and
6  * the example programs.  Other bits come from gAlan 0.2.0,
7  * copyright (C) 1999 Tony Garnock-Jones.
8  *
9  * This program is free software; you can redistribute it and/or
10  * modify it under the terms of the GNU General Public License as
11  * published by the Free Software Foundation; either version 2 of
12  * the License, or (at your option) any later version.
13  *
14  * This program is distributed in the hope that it will be
15  * useful, but WITHOUT ANY WARRANTY; without even the implied
16  * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
17  * PURPOSE.  See the GNU General Public License for more details.
18  *
19  * You should have received a copy of the GNU General Public
20  * License along with this program; if not, write to the Free
21  * Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
22  * Boston, MA 02110-1301 USA.
23  */
24 
25 #ifndef __GTK_KNOB_H__
26 #define __GTK_KNOB_H__
27 
28 #include <gdk/gdk.h>
29 #include <gtk/gtk.h>
30 
31 G_BEGIN_DECLS
32 
33 #define GTK_TYPE_KNOB            (gtk_knob_get_type ())
34 #define GTK_KNOB(obj)            (G_TYPE_CHECK_INSTANCE_CAST ((obj), GTK_TYPE_KNOB, GtkKnob))
35 #define GTK_KNOB_CLASS(klass)    (G_TYPE_CHECK_CLASS_CAST ((klass), GTK_TYPE_KNOB, GtkKnobClass))
36 #define GTK_IS_KNOB(obj)         (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GTK_TYPE_KNOB))
37 #define GTK_IS_KNOB_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GTK_TYPE_KNOB))
38 #define GTK_KNOB_GET_CLASS(obj)  (G_TYPE_INSTANCE_GET_CLASS ((obj), GTK_TYPE_KNOB, GtkKnobClass))
39 
40 typedef struct _GtkKnob       GtkKnob;
41 typedef struct _GtkKnobClass  GtkKnobClass;
42 
43 struct _GtkKnob
44 {
45     GtkWidget widget;
46 
47     GtkAdjustment *adjustment;
48 
49     guint  policy;   /* update policy (GTK_UPDATE_[CONTINUOUS/DELAYED/DISCONTINUOUS]) */
50     guint  state;
51     gint   center_x;
52     gint   center_y;
53     gint   saved_x;
54     gint   saved_y;
55     gfloat old_value;
56 
57     guint32 timer;   /* ID of update timer, or 0 if none */
58 };
59 
60 struct _GtkKnobClass
61 {
62     GtkWidgetClass parent_class;
63 };
64 
65 
66 GType          gtk_knob_get_type (void) G_GNUC_CONST;
67 GtkWidget     *gtk_knob_new (GtkAdjustment *adjustment);
68 
69 void           gtk_knob_set_fast_rendering(gboolean setting);
70 
71 GtkAdjustment *gtk_knob_get_adjustment(GtkKnob *knob);
72 void           gtk_knob_set_adjustment(GtkKnob *knob, GtkAdjustment *adjustment);
73 
74 void           gtk_knob_set_update_policy(GtkKnob *knob, GtkUpdateType  policy);
75 GtkUpdateType  gtk_knob_get_update_policy(GtkKnob *knob);
76 
77 G_END_DECLS
78 
79 #endif /* __GTK_KNOB_H__ */
80 
81