Ardour  9.0-pre0-582-g084a23a80d
step_button.h
Go to the documentation of this file.
1 /*
2  Copyright (C) 2011-2013 Paul Davis
3  Author: Carl Hetherington <cth@carlh.net>
4 
5  This program is free software; you can redistribute it and/or modify
6  it under the terms of the GNU General Public License as published by
7  the Free Software Foundation; either version 2 of the License, or
8  (at your option) any later version.
9 
10  This program is distributed in the hope that it will be useful,
11  but WITHOUT ANY WARRANTY; without even the implied warranty of
12  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13  GNU General Public License for more details.
14 
15  You should have received a copy of the GNU General Public License
16  along with this program; if not, write to the Free Software
17  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
18 */
19 
20 #ifndef __CANVAS_STEP_H__
21 #define __CANVAS_STEP_H__
22 
23 #include <cairomm/pattern.h>
24 
25 #include "canvas/visibility.h"
26 #include "canvas/item.h"
27 #include "canvas/types.h"
28 
29 #include "gtkmm2ext/colors.h"
30 
31 namespace Cairo {
32 class LinearGradient;
33 }
34 
35 namespace ArdourCanvas
36 {
37 class Text;
38 
40 {
41 public:
42  StepButton (Canvas*, double width, double height, Gtkmm2ext::Color c = Gtkmm2ext::rgba_to_color (0, 0, 0, 1.0));
43 
44  void render (Rect const &, Cairo::RefPtr<Cairo::Context>) const;
45  void compute_bounding_box () const;
46 
47  void set_value (double val);
48  double value() const { return current_value; }
49 
50  void set_size (double w, double h);
51  void set_highlight (bool);
53 
54  Text* text() const { return label; }
55 
56  private:
57  double width;
58  double height;
60  double current_value;
61  bool prelight;
62  bool highlight;
63  bool dragging;
64  bool clicking;
65  double scale;
67 
68  Cairo::RefPtr<Cairo::LinearGradient> inactive_pattern;
69  Cairo::RefPtr<Cairo::LinearGradient> enabled_pattern;
70 
71  void create_patterns ();
73 };
74 
75 }
76 
77 #endif
#define LIBCANVAS_API
void render(Rect const &, Cairo::RefPtr< Cairo::Context >) const
double value() const
Definition: step_button.h:48
void set_size(double w, double h)
Cairo::RefPtr< Cairo::LinearGradient > enabled_pattern
Definition: step_button.h:69
Text * text() const
Definition: step_button.h:54
Cairo::RefPtr< Cairo::LinearGradient > inactive_pattern
Definition: step_button.h:68
bool event_handler(GdkEvent *)
void set_color(Gtkmm2ext::Color)
void compute_bounding_box() const
Gtkmm2ext::HSV color
Definition: step_button.h:66
StepButton(Canvas *, double width, double height, Gtkmm2ext::Color c=Gtkmm2ext::rgba_to_color(0, 0, 0, 1.0))
void set_value(double val)
Color rgba_to_color(double r, double g, double b, double a)
uint32_t Color
Definition: colors.h:33
gint height
Definition: xcursors.h:1
gint width
Definition: xcursors.h:1