BEAST - Free Software Audio Synthesizer and Tracker  0.9.2
bstknob.hh
Go to the documentation of this file.
1  // Licensed GNU LGPL v2.1 or later: http://www.gnu.org/licenses/lgpl.html
2 #ifndef __BST_KNOB_H__
3 #define __BST_KNOB_H__
4 
5 #include <gtk/gtkadjustment.h>
6 #include <gtk/gtkimage.h>
7 
8 G_BEGIN_DECLS
9 
10 /* --- type macros --- */
11 #define BST_TYPE_KNOB (bst_knob_get_type ())
12 #define BST_KNOB(object) (G_TYPE_CHECK_INSTANCE_CAST ((object), BST_TYPE_KNOB, BstKnob))
13 #define BST_KNOB_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), BST_TYPE_KNOB, BstKnobClass))
14 #define BST_IS_KNOB(object) (G_TYPE_CHECK_INSTANCE_TYPE ((object), BST_TYPE_KNOB))
15 #define BST_IS_KNOB_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), BST_TYPE_KNOB))
16 #define BST_KNOB_GET_CLASS(object) (G_TYPE_INSTANCE_GET_CLASS ((obj), BST_TYPE_KNOB, BstKnobClass))
17 
18 /* --- structures & typedefs --- */
19 typedef struct _BstKnob BstKnob;
20 typedef struct _BstKnobClass BstKnobClass;
21 struct _BstKnob
22 {
23  GtkImage parent_object;
24 
25  /* The update policy: GTK_UPDATE_CONTINUOUS,
26  * GTK_UPDATE_DISCONTINUOUS or GTK_UPDATE_DELAYED
27  */
28  GtkUpdateType update_policy;
29 
30  /* The button currently pressed or 0 if none */
31  guint8 button;
32 
33  /* Dimensions of knob components */
34  gfloat furrow_radius, dot_radius, xofs, yofs;
35  gfloat arc_start, arc_dist;
36 
37  /* ID of update timer for delayed updates, or 0 if none */
38  guint timer;
39 
40  /* Current angle of the pointer */
41  gdouble angle_range;
42 
43  /* user input */
44  gfloat pangle;
45  gfloat px, py;
46 
47  /* Old values from GtkAdjustment, stored so we know when something changed */
48  gdouble old_value;
49  gdouble old_lower;
50  gdouble old_upper;
51  gdouble old_page_size;
52 
53  /* The adjustment object that stores the data for this knob */
54  GtkObject *adjustment;
55  GdkWindow *iwindow;
56  GdkPixbuf *pixbuf;
57 };
59 {
60  GtkImageClass parent_class;
61 };
62 
63 /* --- public methods --- */
64 GType bst_knob_get_type (void);
65 GtkWidget* bst_knob_new (GtkAdjustment *adjustment);
66 void bst_knob_set_adjustment (BstKnob *knob,
67  GtkAdjustment *adjustment);
68 GtkAdjustment* bst_knob_get_adjustment (BstKnob *knob);
69 void bst_knob_set_update_policy (BstKnob *knob,
70  GtkUpdateType policy);
71 G_END_DECLS
72 
73 #endif /* __BST_KNOB_H__ */
Definition: bstknob.hh:58
Definition: bstknob.hh:21