Merge branch 'master' into cairocanvas
[ardour.git] / libs / gtkmm2ext / gtkmm2ext / barcontroller.h
index 9c9c4c18b99fb03fe1f9829b3c9db0966fb31276..76dc8f2d49fd0208dd1cd4d21982fc1bc71bbb25 100644 (file)
@@ -22,6 +22,7 @@
 #include <gtkmm/frame.h>
 #include <gtkmm/drawingarea.h>
 #include <gtkmm2ext/binding_proxy.h>
+#include <cairo.h>
 
 
 namespace Gtkmm2ext {
@@ -31,23 +32,26 @@ class BarController : public Gtk::Frame
   public:
        BarController (Gtk::Adjustment& adj, boost::shared_ptr<PBD::Controllable>);
 
-       virtual ~BarController () {}
+       virtual ~BarController ();
 
-       enum Style {
+       enum barStyle {
                LeftToRight,
                RightToLeft,
                Line,
+                Blob,
                CenterOut,
                
                TopToBottom,
                BottomToTop
        };
 
-       Style style() const { return _style; }
-       void set_style (Style);
+       barStyle style() const { return _style; }
+       void set_style (barStyle);
        void set_use_parent (bool yn);
 
        void set_sensitive (bool yn);
+       
+       void set_logarithmic (bool yn) { logarithmic = yn; }
 
        sigc::signal<void> StartGesture;
        sigc::signal<void> StopGesture;
@@ -59,12 +63,17 @@ class BarController : public Gtk::Frame
        boost::shared_ptr<PBD::Controllable> get_controllable() { return binding_proxy.get_controllable(); }
        void set_controllable(boost::shared_ptr<PBD::Controllable> c) { binding_proxy.set_controllable(c); }
 
+       /** Emitted when the adjustment spinner is activated or deactivated;
+        *  the parameter is true on activation, false on deactivation.
+        */
+       sigc::signal<void, bool> SpinnerActive;
+
   protected:
        Gtk::Adjustment&    adjustment;
        BindingProxy        binding_proxy;
        Gtk::DrawingArea    darea;
        Glib::RefPtr<Pango::Layout> layout;
-       Style              _style;
+       barStyle              _style;
        bool                grabbed;
        bool                switching;
        bool                switch_on_release;
@@ -73,19 +82,24 @@ class BarController : public Gtk::Frame
        GdkWindow*          grab_window;
        Gtk::SpinButton     spinner;
        bool                use_parent;
+       bool                logarithmic;
+        sigc::slot<std::string> _label_slot;
+        bool                    _use_slot;
 
-       virtual std::string get_label (int& /*x*/) {
+       virtual std::string get_label (double& /*x*/) {
                return "";
        }
        
+       void create_patterns();
+       Cairo::RefPtr<Cairo::Pattern> pattern;
+       Cairo::RefPtr<Cairo::Pattern> shine_pattern;
+
        virtual bool button_press (GdkEventButton *);
        virtual bool button_release (GdkEventButton *);
        virtual bool motion (GdkEventMotion *);
        virtual bool expose (GdkEventExpose *);
        virtual bool scroll (GdkEventScroll *);
        virtual bool entry_focus_out (GdkEventFocus*);
-       virtual bool entry_input (double *);
-       virtual bool entry_output ();
 
        gint mouse_control (double x, GdkWindow* w, double scaling);
 
@@ -94,6 +108,9 @@ class BarController : public Gtk::Frame
 
        void entry_activated ();
        void drop_grab ();
+       
+       int entry_input (double* new_value);
+       bool entry_output ();
 };