2 Copyright (C) 2010 Paul Davis
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.
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.
14 You should have received a copy of the GNU General Public License
15 along with this program; if not, write to the Free Software
16 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
20 #ifndef __gtk2_ardour_ardour_button_h__
21 #define __gtk2_ardour_ardour_button_h__
25 #include <gtkmm/activatable.h>
27 #include "cairo_widget.h"
29 class ArdourButton : public CairoWidget, Gtk::Activatable
40 static Element default_elements;
41 static Element led_default_elements;
43 ArdourButton (Element e = default_elements);
44 virtual ~ArdourButton ();
46 void set_elements (Element);
47 Element elements() const { return _elements; }
49 void set_corner_radius (float);
50 void set_diameter (float);
52 void set_text (const std::string&);
53 void set_markup (const std::string&);
55 void set_led_left (bool yn);
56 void set_distinct_led_click (bool yn);
58 sigc::signal<void> signal_led_clicked;
61 void render (cairo_t *);
62 void on_size_request (Gtk::Requisition* req);
63 void on_size_allocate (Gtk::Allocation&);
64 bool on_button_press_event (GdkEventButton*);
65 bool on_button_release_event (GdkEventButton*);
68 Glib::RefPtr<Pango::Layout> _layout;
77 cairo_pattern_t* edge_pattern;
78 cairo_pattern_t* fill_pattern;
79 cairo_pattern_t* led_inset_pattern;
80 cairo_pattern_t* reflection_pattern;
94 bool _distinct_led_click;
97 void color_handler ();
98 void state_handler ();
101 #endif /* __gtk2_ardour_ardour_button_h__ */