2008-06-02 17:41:35 -04:00
|
|
|
/*
|
2019-08-02 22:40:09 -04:00
|
|
|
* Copyright (C) 2004 Paul Davis <paul@linuxaudiosystems.com>
|
|
|
|
* Copyright (C) 2017 Robin Gareus <robin@gareus.org>
|
|
|
|
*
|
|
|
|
* 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
|
|
|
|
* (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License along
|
|
|
|
* with this program; if not, write to the Free Software Foundation, Inc.,
|
|
|
|
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
|
|
|
*/
|
2008-06-02 17:41:35 -04:00
|
|
|
|
2017-07-16 16:13:46 -04:00
|
|
|
#ifndef _WIDGETS_BAR_CONTROLLER_H_
|
|
|
|
#define _WIDGETS_BAR_CONTROLLER_H_
|
2008-06-02 17:41:35 -04:00
|
|
|
|
2014-08-31 13:36:41 -04:00
|
|
|
#include <gtkmm/alignment.h>
|
2012-12-06 15:48:44 -05:00
|
|
|
#include <cairo.h>
|
2008-06-02 17:41:35 -04:00
|
|
|
|
2017-07-16 22:55:52 -04:00
|
|
|
#include "widgets/binding_proxy.h"
|
2017-07-16 16:13:46 -04:00
|
|
|
#include "widgets/slider_controller.h"
|
|
|
|
#include "widgets/visibility.h"
|
2008-06-02 17:41:35 -04:00
|
|
|
|
2017-07-16 16:13:46 -04:00
|
|
|
namespace ArdourWidgets {
|
2008-06-02 17:41:35 -04:00
|
|
|
|
2017-07-16 16:13:46 -04:00
|
|
|
class LIBWIDGETS_API BarController : public Gtk::Alignment
|
2008-06-02 17:41:35 -04:00
|
|
|
{
|
2017-07-16 16:13:46 -04:00
|
|
|
public:
|
2023-02-16 18:33:28 -05:00
|
|
|
BarController (Gtk::Adjustment& adj, std::shared_ptr<PBD::Controllable>);
|
2008-06-02 17:41:35 -04:00
|
|
|
|
2012-12-06 15:48:44 -05:00
|
|
|
virtual ~BarController ();
|
2009-05-20 09:28:30 -04:00
|
|
|
|
2008-06-02 17:41:35 -04:00
|
|
|
void set_sensitive (bool yn);
|
2017-09-23 13:39:36 -04:00
|
|
|
void set_digits (guint d) { _slider.get_spin_button().set_digits (d); }
|
2008-06-02 17:41:35 -04:00
|
|
|
|
2017-07-16 16:13:46 -04:00
|
|
|
ArdourFader::Tweaks tweaks() const { return _slider.tweaks (); }
|
|
|
|
void set_tweaks (ArdourFader::Tweaks t) { _slider.set_tweaks (t);}
|
2014-09-06 06:46:03 -04:00
|
|
|
|
2023-07-26 15:11:52 -04:00
|
|
|
sigc::signal<void,int> StartGesture;
|
|
|
|
sigc::signal<void,int> StopGesture;
|
2008-06-02 17:41:35 -04:00
|
|
|
|
|
|
|
/* export this to allow direct connection to button events */
|
2014-09-01 23:09:51 -04:00
|
|
|
Gtk::Widget& event_widget() { return _slider; }
|
2008-06-02 17:41:35 -04:00
|
|
|
|
2010-11-25 19:29:12 -05:00
|
|
|
/** Emitted when the adjustment spinner is activated or deactivated;
|
|
|
|
* the parameter is true on activation, false on deactivation.
|
|
|
|
*/
|
|
|
|
sigc::signal<void, bool> SpinnerActive;
|
|
|
|
|
2017-07-16 16:13:46 -04:00
|
|
|
protected:
|
2014-09-01 23:09:51 -04:00
|
|
|
bool on_button_press_event (GdkEventButton*);
|
|
|
|
bool on_button_release_event (GdkEventButton*);
|
2014-09-02 20:38:18 -04:00
|
|
|
void on_style_changed (const Glib::RefPtr<Gtk::Style>&);
|
2008-06-02 17:41:35 -04:00
|
|
|
|
2011-01-27 20:04:33 -05:00
|
|
|
virtual std::string get_label (double& /*x*/) {
|
2009-05-20 09:28:30 -04:00
|
|
|
return "";
|
|
|
|
}
|
2008-06-02 17:41:35 -04:00
|
|
|
|
2017-07-16 16:13:46 -04:00
|
|
|
private:
|
2014-09-01 23:09:51 -04:00
|
|
|
HSliderController _slider;
|
|
|
|
bool entry_focus_out (GdkEventFocus*);
|
|
|
|
void entry_activated ();
|
|
|
|
void before_expose ();
|
2014-08-27 12:58:09 -04:00
|
|
|
|
2008-06-02 17:41:35 -04:00
|
|
|
gint switch_to_bar ();
|
|
|
|
gint switch_to_spinner ();
|
|
|
|
|
2014-09-01 23:09:51 -04:00
|
|
|
bool _switching;
|
|
|
|
bool _switch_on_release;
|
2014-08-27 12:58:09 -04:00
|
|
|
|
2023-07-26 15:11:52 -04:00
|
|
|
void passtrhu_gesture_start (int state) { StartGesture (state); }
|
|
|
|
void passtrhu_gesture_stop (int state) { StopGesture (state); }
|
2008-06-02 17:41:35 -04:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
}; /* namespace */
|
|
|
|
|
2015-10-05 10:17:49 -04:00
|
|
|
#endif // __gtkmm2ext_bar_controller_h__
|