1 /* abGate - LV2 Noise Gate Plugin
2  *
3  * Copyright 2011 Antanas Bružas
4  *
5  * This library is free software; you can redistribute it and/or
6  * modify it under the terms of the GNU Lesser General Public
7  * License as published by the Free Software Foundation; either
8  * version 3 of the License, or (at your option) any later version.
9  *
10  * This library 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 GNU
13  * Lesser General Public License for more details.
14  *
15  * You should have received a copy of the GNU Lesser General Public
16  * License along with this library; if not, write to the Free
17  * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
18  */
19 
20 #ifndef _TOGGLE_H
21 #define _TOGGLE_H
22 
23 #include "plugin_configuration.h"
24 
25 #include <gtkmm/adjustment.h>
26 #include <gtkmm/misc.h>
27 
28 using namespace Gtk;
29 
30 class toggle: public Misc {
31 public:
32 	toggle(const sigc::slot<void> toggle_slot);
33 	~toggle();
34 
35 	void connecting(Adjustment*, const sigc::slot<void> slot);
36 	void value_changed();
37 	float get_toggle_value();
38 	void set_toggle_value(float value);
39 
40 	// Dispacher used to update GUI from the main (GUI) thread
41 	Glib::Dispatcher dis_sig;
42 
43 protected:
44 	virtual bool on_expose_event(GdkEventExpose*);
45 	virtual bool on_button_press_event(GdkEventButton*);
46 	virtual bool on_button_release_event(GdkEventButton*);
47 private:
48 	Glib::RefPtr<Gdk::Pixbuf> pixbuf, on, off;
49 	Glib::RefPtr<Gdk::Drawable> m_drawable;
50 	Adjustment *a_tog;
51 };
52 
53 #endif
54