Beast - Music Synthesizer and Composer  0.11.1+10.g2da35
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 /* --- type macros --- */
9 #define BST_TYPE_KNOB (bst_knob_get_type ())
10 #define BST_KNOB(object) (G_TYPE_CHECK_INSTANCE_CAST ((object), BST_TYPE_KNOB, BstKnob))
11 #define BST_KNOB_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), BST_TYPE_KNOB, BstKnobClass))
12 #define BST_IS_KNOB(object) (G_TYPE_CHECK_INSTANCE_TYPE ((object), BST_TYPE_KNOB))
13 #define BST_IS_KNOB_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), BST_TYPE_KNOB))
14 #define BST_KNOB_GET_CLASS(object) (G_TYPE_INSTANCE_GET_CLASS ((obj), BST_TYPE_KNOB, BstKnobClass))
15 
16 /* --- structures & typedefs --- */
17 typedef struct _BstKnob BstKnob;
18 typedef struct _BstKnobClass BstKnobClass;
19 struct _BstKnob
20 {
21  GtkImage parent_object;
22 
23  /* The update policy: GTK_UPDATE_CONTINUOUS,
24  * GTK_UPDATE_DISCONTINUOUS or GTK_UPDATE_DELAYED
25  */
26  GtkUpdateType update_policy;
27 
28  /* The button currently pressed or 0 if none */
29  guint8 button;
30 
31  /* Dimensions of knob components */
32  gfloat furrow_radius, dot_radius, xofs, yofs;
33  gfloat arc_start, arc_dist;
34 
35  /* ID of update timer for delayed updates, or 0 if none */
36  guint timer;
37 
38  /* Current angle of the pointer */
39  gdouble angle_range;
40 
41  /* user input */
42  gfloat pangle;
43  gfloat px, py;
44 
45  /* Old values from GtkAdjustment, stored so we know when something changed */
46  gdouble old_value;
47  gdouble old_lower;
48  gdouble old_upper;
49  gdouble old_page_size;
50 
51  /* The adjustment object that stores the data for this knob */
52  GtkObject *adjustment;
53  GdkWindow *iwindow;
54  GdkPixbuf *pixbuf;
55 };
57 {
58  GtkImageClass parent_class;
59 };
60 
61 /* --- public methods --- */
62 GType bst_knob_get_type (void);
63 GtkWidget* bst_knob_new (GtkAdjustment *adjustment);
64 void bst_knob_set_adjustment (BstKnob *knob,
65  GtkAdjustment *adjustment);
66 GtkAdjustment* bst_knob_get_adjustment (BstKnob *knob);
67 void bst_knob_set_update_policy (BstKnob *knob,
68  GtkUpdateType policy);
69 #endif /* __BST_KNOB_H__ */
Definition: bstknob.hh:56
Definition: bstknob.hh:19