summaryrefslogtreecommitdiff
path: root/gtk2_ardour/ardour_button.h
diff options
context:
space:
mode:
authorPaul Davis <paul@linuxaudiosystems.com>2011-10-26 21:01:14 +0000
committerPaul Davis <paul@linuxaudiosystems.com>2011-10-26 21:01:14 +0000
commit51ab5ccabf432540ca935065f6c6f40a96f42dad (patch)
treea5f062738bcedc33cd55b176168d532e4cc6d189 /gtk2_ardour/ardour_button.h
parentae3eb6e3f4f270a03ff297d1bbe7cd3f3a2159a9 (diff)
new ArdourButton class, to start to provide more control over how our buttons work and appear; use ArdourButtons for monitor, solo isolate and solo safe buttons, and in the processor box; don't save UI config file (canvas colors) to the user's home dir unless one or more parameters were modified by the user
git-svn-id: svn://localhost/ardour2/branches/3.0@10311 d708f5d6-7413-0410-9779-e7cbd77b26cf
Diffstat (limited to 'gtk2_ardour/ardour_button.h')
-rw-r--r--gtk2_ardour/ardour_button.h83
1 files changed, 83 insertions, 0 deletions
diff --git a/gtk2_ardour/ardour_button.h b/gtk2_ardour/ardour_button.h
new file mode 100644
index 0000000000..a499f60b3a
--- /dev/null
+++ b/gtk2_ardour/ardour_button.h
@@ -0,0 +1,83 @@
+/*
+ Copyright (C) 2010 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
+ (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., 675 Mass Ave, Cambridge, MA 02139, USA.
+
+*/
+
+#ifndef __gtk2_ardour_ardour_button_h__
+#define __gtk2_ardour_ardour_button_h__
+
+#include <stdint.h>
+
+#include <gtkmm/activatable.h>
+
+#include "cairo_widget.h"
+
+class ArdourButton : public CairoWidget, Gtk::Activatable
+{
+ public:
+ ArdourButton ();
+ virtual ~ArdourButton ();
+
+ void set_diameter (float);
+
+ void set_text (const std::string&);
+ void set_markup (const std::string&);
+
+ void set_led_left (bool yn);
+ void set_distinct_led_click (bool yn);
+
+ sigc::signal<void> signal_clicked;
+
+ void set_state (State s, bool);
+
+ protected:
+ void render (cairo_t *);
+ void on_size_request (Gtk::Requisition* req);
+ void on_realize ();
+ bool on_button_press_event (GdkEventButton*);
+ bool on_button_release_event (GdkEventButton*);
+
+ private:
+ Glib::RefPtr<Pango::Layout> _layout;
+ std::string _text;
+ int _text_width;
+ int _text_height;
+ bool _led_left;
+ float _diameter;
+ bool _fixed_diameter;
+ bool _distinct_led_click;
+
+ cairo_pattern_t* edge_pattern;
+ cairo_pattern_t* fill_pattern;
+ cairo_pattern_t* led_inset_pattern;
+ cairo_pattern_t* reflection_pattern;
+
+ double text_r;
+ double text_g;
+ double text_b;
+ double text_a;
+
+ double led_r;
+ double led_g;
+ double led_b;
+ double led_a;
+
+ void set_colors ();
+ void color_handler ();
+};
+
+#endif /* __gtk2_ardour_ardour_button_h__ */