Ardour  8.12
visibility_group.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2011-2012 Carl Hetherington <carl@carlh.net>
3  * Copyright (C) 2015-2019 Robin Gareus <robin@gareus.org>
4  *
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.
9  *
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.
14  *
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.
18  */
19 
20 #ifndef __ardour_visibility_group__
21 #define __ardour_visibility_group__
22 
23 #include <gtkmm/liststore.h>
24 #include "pbd/signals.h"
25 
26 class XMLNode;
27 class XMLProperty;
28 
35 {
36 public:
37  VisibilityGroup (std::string const &);
38 
39  void add (
40  Gtk::Widget *,
41  std::string const &,
42  std::string const &,
43  bool visible = false,
44  boost::function<boost::optional<bool> ()> = 0
45  );
46 
49  void update ();
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;
54 
55  PBD::Signal0<void> VisibilityChanged;
56 
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);
59 
60 private:
61 
62  struct Member {
64  std::string id;
65  std::string name;
66  bool visible;
67  boost::function<boost::optional<bool> ()> override;
68  };
69 
71  public:
73  add (_visible);
74  add (_name);
75  add (_iterator);
76  }
77 
81  };
82 
83  void toggle (std::vector<Member>::iterator);
84  void list_view_visible_changed (std::string const &);
86  bool should_actually_be_visible (Member const &) const;
87 
88  std::vector<Member> _members;
89  std::string _xml_property_name;
91  Glib::RefPtr<Gtk::ListStore> _model;
93 };
94 
95 #endif
void add(TreeModelColumnBase &column)
Gtk::TreeModelColumn< std::vector< Member >::iterator > _iterator
Gtk::TreeModelColumn< std::string > _name
Gtk::TreeModelColumn< bool > _visible
std::string get_state_value() const
void update_list_view()
VisibilityGroup(std::string const &)
static std::string remove_element(std::string const &from, std::string const &element)
bool button_press_event(GdkEventButton *)
void set_state(std::string)
Glib::RefPtr< Gtk::ListStore > _model
std::vector< Member > _members
ModelColumns _model_columns
std::string _xml_property_name
void toggle(std::vector< Member >::iterator)
static std::string add_element(std::string const &from, std::string const &element)
void list_view_visible_changed(std::string const &)
void set_state(XMLNode const &)
bool should_actually_be_visible(Member const &) const
PBD::Signal0< void > VisibilityChanged
void add(Gtk::Widget *, std::string const &, std::string const &, bool visible=false, boost::function< boost::optional< bool >()>=0)
std::string get_state_name() const
Gtk::Widget * list_view()
Definition: xml++.h:114