2 * Copyright (C) 2011-2012 Carl Hetherington <carl@carlh.net>
3 * Copyright (C) 2015-2019 Robin Gareus <robin@gareus.org>
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.
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.
15 * You should have received a copy of the GNU General Public License along
16 * with this program; if not, write to the Free Software Foundation, Inc.,
17 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
20 #ifndef __ardour_visibility_group__
21 #define __ardour_visibility_group__
23 #include <gtkmm/liststore.h>
24 #include "pbd/signals.h"
29 /** A class to manage a group of widgets where the visibility of each
30 * can be configured by the user. The class can generate a menu to
31 * set up visibility, and save and restore visibility state to XML.
37 VisibilityGroup (std::string const &);
44 boost::function<boost::optional<bool> ()> = 0
47 Gtk::Widget* list_view ();
48 bool button_press_event (GdkEventButton *);
50 void set_state (XMLNode const &);
51 void set_state (std::string);
52 std::string get_state_name () const;
53 std::string get_state_value () const;
55 PBD::Signal0<void> VisibilityChanged;
57 static std::string remove_element (std::string const& from, std::string const& element);
58 static std::string add_element (std::string const& from, std::string const& element);
67 boost::function<boost::optional<bool> ()> override;
70 class ModelColumns : public Gtk::TreeModelColumnRecord {
78 Gtk::TreeModelColumn<bool> _visible;
79 Gtk::TreeModelColumn<std::string> _name;
80 Gtk::TreeModelColumn<std::vector<Member>::iterator> _iterator;
83 void toggle (std::vector<Member>::iterator);
84 void list_view_visible_changed (std::string const &);
85 void update_list_view ();
86 bool should_actually_be_visible (Member const &) const;
88 std::vector<Member> _members;
89 std::string _xml_property_name;
90 ModelColumns _model_columns;
91 Glib::RefPtr<Gtk::ListStore> _model;
92 bool _ignore_list_view_change;