Standardize drawing of PixFader and BarController; implement flat_buttons and prelight.
[ardour.git] / libs / gtkmm2ext / gtkmm2ext / barcontroller.h
index 2c0ca948d995b50a949ae251c3dce5013074032f..5fc3c17aeaa2ef292306ff604b76f49edf72107e 100644 (file)
 
 #include <gtkmm/frame.h>
 #include <gtkmm/drawingarea.h>
-#include <gtkmm2ext/binding_proxy.h>
+#include <cairo.h>
 
-namespace ARDOUR {
-       class Controllable;
-}
+#include "gtkmm2ext/visibility.h"
+#include "gtkmm2ext/binding_proxy.h"
 
 namespace Gtkmm2ext {
 
-class BarController : public Gtk::Frame
+class LIBGTKMM2EXT_API BarController : public Gtk::Frame
 {
   public:
-       typedef sigc::slot<void,char*,unsigned int> LabelCallback;
+       BarController (Gtk::Adjustment& adj, boost::shared_ptr<PBD::Controllable>);
 
-       BarController (Gtk::Adjustment& adj, boost::shared_ptr<PBD::Controllable>, LabelCallback lc = LabelCallback());
+       virtual ~BarController ();
 
-       virtual ~BarController () {}
-       
-       enum Style {
+       enum barStyle {
                LeftToRight,
                RightToLeft,
                Line,
+                Blob,
                CenterOut,
                
                TopToBottom,
                BottomToTop
        };
 
-       Style style() const { return _style; }
-       void set_style (Style);
-       void set_with_text (bool yn);
+       barStyle style() const { return _style; }
+       void set_style (barStyle);
        void set_use_parent (bool yn);
 
        void set_sensitive (bool yn);
-
-       Gtk::SpinButton& get_spin_button() { return spinner; }
+       
+       void set_logarithmic (bool yn) { logarithmic = yn; }
 
        sigc::signal<void> StartGesture;
        sigc::signal<void> StopGesture;
@@ -67,37 +64,57 @@ 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;
-       LabelCallback       label_callback;
        Glib::RefPtr<Pango::Layout> layout;
-       Style              _style;
+       barStyle              _style;
        bool                grabbed;
        bool                switching;
        bool                switch_on_release;
-       bool                with_text;
        double              initial_value;
        double              grab_x;
        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 (double& /*x*/) {
+               return "";
+       }
+       
        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*);
+       bool on_enter_notify_event (GdkEventCrossing* ev);
+       bool on_leave_notify_event (GdkEventCrossing* ev);
 
        gint mouse_control (double x, GdkWindow* w, double scaling);
 
+       Gdk::Color get_parent_bg ();
+
        gint switch_to_bar ();
        gint switch_to_spinner ();
 
        void entry_activated ();
        void drop_grab ();
+       
+       int entry_input (double* new_value);
+       bool entry_output ();
+
+       bool _hovering;
+
 };