cache shaded meter-background regardless of color
[ardour.git] / libs / gtkmm2ext / gtkmm2ext / slider_controller.h
index 3cb8e9d363075bbf2facf78222d7aaef0fb99c3e..4c6a5cb41d5d33208d2596bad6cc3458a49abc06 100644 (file)
@@ -1,5 +1,5 @@
 /*
-    Copyright (C) 1998-99 Paul Davis 
+    Copyright (C) 1998-2006 Paul Davis 
     This program is free software; you can redistribute it and/or modify
     it under the terms of the GNU General Public License as published by
     the Free Software Foundation; either version 2 of the License, or
     along with this program; if not, write to the Free Software
     Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
 
-    $Id$
 */
 
-#ifndef __gtkmm2ext_motion_controller_h__
-#define __gtkmm2ext_motion_controller_h__
+#ifndef __gtkmm2ext_slider_controller_h__
+#define __gtkmm2ext_slider_controller_h__
 
 #include <gtkmm.h>
 #include <gtkmm2ext/popup.h>
-#include <gtkmm2ext/pixscroller.h>
+#include <gtkmm2ext/pixfader.h>
+#include <gtkmm2ext/binding_proxy.h>
+
+#include <boost/shared_ptr.hpp>
 
 namespace Gtkmm2ext {
        class Pix;
 }
 
-namespace MIDI {
+namespace PBD {
        class Controllable;
 }
 
 namespace Gtkmm2ext {
 
-class SliderController : public Gtkmm2ext::PixScroller
+class SliderController : public Gtkmm2ext::PixFader
 {
   public:
-       SliderController (Gtkmm2ext::Pix* pixset,
-                         Gtk::Adjustment* adj,
-                         MIDI::Controllable*,
-                         bool with_numeric = true);
-
+        SliderController (Gtk::Adjustment* adj, int orientation, int, int);
+       
         virtual ~SliderController () {}
 
-       void set_bind_button_state (guint button, guint statemask);
-       void get_bind_button_state (guint &button, guint &statemask);
-       void midicontrol_set_tip ();
-       void midi_learn ();
-       
        void set_value (float);
-       // void set_sensitive (bool yn) {
-       // spin.set_sensitive (yn);
-       // }
 
-       Gtk::SpinButton & get_spin_button () { return spin; }
+       Gtk::SpinButton& get_spin_button () { return spin; }
        
+       bool on_button_press_event (GdkEventButton *ev);
+
+       void set_controllable (boost::shared_ptr<PBD::Controllable> c) { binding_proxy.set_controllable (c); }
+
   protected:
+       BindingProxy binding_proxy;
        Gtk::SpinButton     spin;
        Gtk::Frame          spin_frame;
        Gtk::HBox           spin_hbox;
-       Gtkmm2ext::PopUp     prompter;
-       MIDI::Controllable* midi_control;
 
-       guint bind_button;
-       guint bind_statemask;
-       bool prompting, unprompting;
-       
-       bool button_press (GdkEventButton *);
-       bool prompter_hiding (GdkEventAny *);
-       void midicontrol_prompt ();
-       void midicontrol_unprompt ();
-       void update_midi_control ();
+       void init ();
 };
 
 class VSliderController : public SliderController
 {
   public:
-       VSliderController (Gtkmm2ext::Pix *pixset,
-                          Gtk::Adjustment *adj,
-                          MIDI::Controllable *,
-                          bool with_numeric = true);
+        VSliderController (Gtk::Adjustment *adj, int, int, bool with_numeric = true);
 };
 
 class HSliderController : public SliderController
 {
   public:
-       HSliderController (Gtkmm2ext::Pix *pixset,
-                          Gtk::Adjustment *adj,
-                          MIDI::Controllable *,
-                          bool with_numeric = true);
+       HSliderController (Gtk::Adjustment *adj, int, int, bool with_numeric = true);
 };
 
 
 }; /* namespace */
 
-#endif // __gtkmm2ext_motion_controller_h__            
+#endif // __gtkmm2ext_slider_controller_h__