/*
- Copyright (C) 2004 Paul Davis
+ Copyright (C) 2004 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
#ifndef __gtkmm2ext_bar_controller_h__
#define __gtkmm2ext_bar_controller_h__
-#include <gtkmm/frame.h>
-#include <gtkmm/drawingarea.h>
-#include <gtkmm2ext/binding_proxy.h>
+#include <gtkmm/alignment.h>
+#include <cairo.h>
-namespace ARDOUR {
- class Controllable;
-}
+#include "gtkmm2ext/visibility.h"
+#include "gtkmm2ext/binding_proxy.h"
+#include "gtkmm2ext/slider_controller.h"
namespace Gtkmm2ext {
-class BarController : public Gtk::Frame
+class LIBGTKMM2EXT_API BarController : public Gtk::Alignment
{
public:
- typedef sigc::slot<void,char*,unsigned int> LabelCallback;
-
- BarController (Gtk::Adjustment& adj, PBD::Controllable&, LabelCallback lc = LabelCallback());
-
- virtual ~BarController () {}
-
- enum Style {
- LeftToRight,
- RightToLeft,
- Line,
- CenterOut,
-
- TopToBottom,
- BottomToTop
- };
-
- Style style() const { return _style; }
- void set_style (Style);
- void set_with_text (bool yn);
- void set_use_parent (bool yn);
+ BarController (Gtk::Adjustment& adj, boost::shared_ptr<PBD::Controllable>);
+
+ virtual ~BarController ();
void set_sensitive (bool yn);
- Gtk::SpinButton& get_spin_button() { return spinner; }
+ PixFader::Tweaks tweaks() const { return _slider.tweaks (); }
+ void set_tweaks (PixFader::Tweaks t) { _slider.set_tweaks (t);}
sigc::signal<void> StartGesture;
sigc::signal<void> StopGesture;
/* export this to allow direct connection to button events */
+ Gtk::Widget& event_widget() { return _slider; }
- Gtk::Widget& event_widget() { return darea; }
- PBD::Controllable* get_controllable() { return binding_proxy.get_controllable(); }
+ /** 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;
- 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;
-
- 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*);
-
- gint mouse_control (double x, GdkWindow* w, double scaling);
+ bool on_button_press_event (GdkEventButton*);
+ bool on_button_release_event (GdkEventButton*);
+ void on_style_changed (const Glib::RefPtr<Gtk::Style>&);
+
+ virtual std::string get_label (double& /*x*/) {
+ return "";
+ }
+
+ private:
+ HSliderController _slider;
+ bool entry_focus_out (GdkEventFocus*);
+ void entry_activated ();
+ void before_expose ();
gint switch_to_bar ();
gint switch_to_spinner ();
- void entry_activated ();
- void drop_grab ();
+ bool _switching;
+ bool _switch_on_release;
+
+
+ void passtrhu_gesture_start() { StartGesture (); }
+ void passtrhu_gesture_stop() { StopGesture (); }
};
}; /* namespace */
-#endif // __gtkmm2ext_bar_controller_h__
+#endif // __gtkmm2ext_bar_controller_h__