summaryrefslogtreecommitdiff
path: root/gtk2_ardour/visibility_group.h
diff options
context:
space:
mode:
authorCarl Hetherington <carl@carlh.net>2011-10-29 20:18:06 +0000
committerCarl Hetherington <carl@carlh.net>2011-10-29 20:18:06 +0000
commit10064587507ab9bc3d73c82971a46fdb3718f7e3 (patch)
tree51ed6d1c04a37771850d634e3cbef5fc074581f0 /gtk2_ardour/visibility_group.h
parentdb429c2362f69664805c14419b95ad6b02759948 (diff)
Add missing files.
git-svn-id: svn://localhost/ardour2/branches/3.0@10342 d708f5d6-7413-0410-9779-e7cbd77b26cf
Diffstat (limited to 'gtk2_ardour/visibility_group.h')
-rw-r--r--gtk2_ardour/visibility_group.h85
1 files changed, 85 insertions, 0 deletions
diff --git a/gtk2_ardour/visibility_group.h b/gtk2_ardour/visibility_group.h
new file mode 100644
index 0000000000..d9e13e1e93
--- /dev/null
+++ b/gtk2_ardour/visibility_group.h
@@ -0,0 +1,85 @@
+/*
+ Copyright (C) 2011 Paul Davis
+ Author: Carl Hetherington <cth@carlh.net>
+
+ 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 __ardour_visibility_group__
+#define __ardour_visibility_group__
+
+#include <gtkmm/liststore.h>
+#include "pbd/signals.h"
+
+class XMLNode;
+class XMLProperty;
+
+/** A class to manage a group of widgets where the visibility of each
+ * can be configured by the user. The class can generate a menu to
+ * set up visibility, and save and restore visibility state to XML.
+ */
+
+class VisibilityGroup
+{
+public:
+ VisibilityGroup (std::string const &);
+
+ void add (Gtk::Widget *, std::string const &, std::string const &, bool visible = true);
+ Gtk::Menu* menu ();
+ Gtk::Widget* list_view ();
+ bool button_press_event (GdkEventButton *);
+ void update ();
+ void set_state (XMLNode const &);
+ void set_state (std::string);
+ std::string get_state_name () const;
+ std::string get_state_value () const;
+
+ PBD::Signal0<void> VisibilityChanged;
+
+private:
+
+ struct Member {
+ Gtk::Widget* widget;
+ std::string id;
+ std::string name;
+ bool visible;
+ };
+
+ class ModelColumns : public Gtk::TreeModelColumnRecord {
+ public:
+ ModelColumns () {
+ add (_visible);
+ add (_name);
+ add (_iterator);
+ }
+
+ Gtk::TreeModelColumn<bool> _visible;
+ Gtk::TreeModelColumn<std::string> _name;
+ Gtk::TreeModelColumn<std::vector<Member>::iterator> _iterator;
+ };
+
+ void toggle (std::vector<Member>::iterator);
+ void list_view_visible_changed (std::string const &);
+ void update_list_view ();
+
+ std::vector<Member> _members;
+ std::string _xml_property_name;
+ ModelColumns _model_columns;
+ Glib::RefPtr<Gtk::ListStore> _model;
+ bool _ignore_list_view_change;
+};
+
+#endif