BEAST/BSE - Better Audio System and Sound Engine  0.8.2
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines
bstknob.hh
Go to the documentation of this file.
00001  // Licensed GNU LGPL v2.1 or later: http://www.gnu.org/licenses/lgpl.html
00002 #ifndef __BST_KNOB_H__
00003 #define __BST_KNOB_H__
00004 
00005 #include <gtk/gtkadjustment.h>
00006 #include <gtk/gtkimage.h>
00007 
00008 G_BEGIN_DECLS
00009 
00010 /* --- type macros --- */
00011 #define BST_TYPE_KNOB                   (bst_knob_get_type ())
00012 #define BST_KNOB(object)                (G_TYPE_CHECK_INSTANCE_CAST ((object), BST_TYPE_KNOB, BstKnob))
00013 #define BST_KNOB_CLASS(klass)           (G_TYPE_CHECK_CLASS_CAST ((klass), BST_TYPE_KNOB, BstKnobClass))
00014 #define BST_IS_KNOB(object)             (G_TYPE_CHECK_INSTANCE_TYPE ((object), BST_TYPE_KNOB))
00015 #define BST_IS_KNOB_CLASS(klass)        (G_TYPE_CHECK_CLASS_TYPE ((klass), BST_TYPE_KNOB))
00016 #define BST_KNOB_GET_CLASS(object)      (G_TYPE_INSTANCE_GET_CLASS ((obj), BST_TYPE_KNOB, BstKnobClass))
00017 
00018 /* --- structures & typedefs --- */
00019 typedef struct _BstKnob      BstKnob;
00020 typedef struct _BstKnobClass BstKnobClass;
00021 struct _BstKnob
00022 {
00023   GtkImage parent_object;
00024 
00025   /* The update policy: GTK_UPDATE_CONTINUOUS,
00026    * GTK_UPDATE_DISCONTINUOUS or GTK_UPDATE_DELAYED
00027    */
00028   GtkUpdateType update_policy;
00029 
00030   /* The button currently pressed or 0 if none */
00031   guint8 button;
00032 
00033   /* Dimensions of knob components */
00034   gfloat furrow_radius, dot_radius, xofs, yofs;
00035   gfloat arc_start, arc_dist;
00036 
00037   /* ID of update timer for delayed updates, or 0 if none */
00038   guint timer;
00039 
00040   /* Current angle of the pointer */
00041   gdouble angle_range;
00042 
00043   /* user input */
00044   gfloat pangle;
00045   gfloat px, py;
00046 
00047   /* Old values from GtkAdjustment, stored so we know when something changed */
00048   gdouble old_value;
00049   gdouble old_lower;
00050   gdouble old_upper;
00051   gdouble old_page_size;
00052 
00053   /* The adjustment object that stores the data for this knob */
00054   GtkObject *adjustment;
00055   GdkWindow *iwindow;
00056   GdkPixbuf *pixbuf;
00057 };
00058 struct _BstKnobClass
00059 {
00060   GtkImageClass parent_class;
00061 };
00062 
00063 /* --- public methods --- */
00064 GType          bst_knob_get_type               (void);
00065 GtkWidget*     bst_knob_new                    (GtkAdjustment *adjustment);
00066 void           bst_knob_set_adjustment         (BstKnob       *knob,
00067                                                 GtkAdjustment *adjustment);
00068 GtkAdjustment* bst_knob_get_adjustment         (BstKnob       *knob);
00069 void           bst_knob_set_update_policy      (BstKnob       *knob,
00070                                                 GtkUpdateType  policy);
00071 G_END_DECLS
00072 
00073 #endif /* __BST_KNOB_H__ */
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines