Ardour  9.0-pre0-582-g084a23a80d
fader_widget.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2024 Robin Gareus <robin@gareus.org>
3  *
4  * This program is free software; you can redistribute it and/or modify
5  * it under the terms of the GNU General Public License as published by
6  * the Free Software Foundation; either version 2 of the License, or
7  * (at your option) any later version.
8  *
9  * This program is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12  * GNU General Public License for more details.
13  *
14  * You should have received a copy of the GNU General Public License along
15  * with this program; if not, write to the Free Software Foundation, Inc.,
16  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
17  */
18 
19 #pragma once
20 
21 #include <gtkmm/adjustment.h>
22 #include "gtkmm2ext/cairo_widget.h"
23 
24 #include "widgets/visibility.h"
25 
26 namespace ArdourWidgets {
27 
28 class LIBWIDGETS_API FaderWidget : public virtual CairoWidget
29 {
30 public:
31  FaderWidget (Gtk::Adjustment&, int orient);
32  virtual ~FaderWidget () {};
33 
34  sigc::signal<void,int> StartGesture;
35  sigc::signal<void,int> StopGesture;
36  sigc::signal<void> OnExpose;
37 
38  virtual void set_default_value (float) = 0;
39 
40  enum Tweaks {
41  NoShowUnityLine = 0x1,
42  NoButtonForward = 0x2,
43  NoVerticalScroll = 0x4,
44  DoubleClickReset = 0x8,
45  };
46 
47  enum Orientation {
50  };
51 
53  Tweaks tweaks() const { return _tweaks; }
54 
55  int orientation () const { return _orien; }
56 
57  virtual void set_bg (Gtkmm2ext::Color) = 0;
58  virtual void set_fg (Gtkmm2ext::Color) = 0;
59  virtual void unset_bg () = 0;
60  virtual void unset_fg () = 0;
61 
62 protected:
71 
73 
75 
77 
79  int _orien;
80  bool _dragging;
81  bool _hovering;
83 
84 
86  double _grab_loc;
87  double _grab_start;
88 };
89 
90 }
virtual void unset_fg()=0
virtual void set_adjustment_from_event(GdkEventButton *)=0
sigc::signal< void > OnExpose
Definition: fader_widget.h:36
bool on_grab_broken_event(GdkEventGrabBroken *)
virtual void set_bg(Gtkmm2ext::Color)=0
sigc::signal< void, int > StartGesture
Definition: fader_widget.h:32
virtual void set_default_value(float)=0
virtual void set_fg(Gtkmm2ext::Color)=0
bool on_touch_end_event(GdkEventTouch *)
bool on_enter_notify_event(GdkEventCrossing *ev)
This is a default handler for the signal signal_enter_notify_event().
bool on_touch_begin_event(GdkEventTouch *)
bool on_leave_notify_event(GdkEventCrossing *ev)
This is a default handler for the signal signal_leave_notify_event().
sigc::signal< void, int > StopGesture
Definition: fader_widget.h:35
bool on_button_release_event(GdkEventButton *)
This is a default handler for the signal signal_button_release_event().
Gtk::Adjustment & _adjustment
Definition: fader_widget.h:76
bool on_scroll_event(GdkEventScroll *ev)
This is a default handler for the signal signal_scroll_event().
virtual void unset_bg()=0
bool on_button_press_event(GdkEventButton *)
This is a default handler for the signal signal_button_press_event().
FaderWidget(Gtk::Adjustment &, int orient)
uint32_t Color
Definition: colors.h:33
#define LIBWIDGETS_API