Ardour  9.0-pre0-582-g084a23a80d
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 <gtkmm/widget.h>
25 
26 #include "pbd/signals.h"
27 
28 class XMLNode;
29 class XMLProperty;
30 
37 {
38 public:
39  VisibilityGroup (std::string const &);
40 
41  void add (
42  Gtk::Widget *,
43  std::string const &,
44  std::string const &,
45  bool visible = false,
46  std::function<std::optional<bool> ()> = 0
47  );
48 
51  void update ();
52  void set_state (XMLNode const &);
53  void set_state (std::string);
54  std::string get_state_name () const;
55  std::string get_state_value () const;
56 
58 
59  static std::string remove_element (std::string const& from, std::string const& element);
60  static std::string add_element (std::string const& from, std::string const& element);
61 
62 private:
63 
64  struct Member {
66  std::string id;
67  std::string name;
68  bool visible;
69  std::function<std::optional<bool> ()> override;
70  };
71 
73  public:
75  add (_visible);
76  add (_name);
77  add (_iterator);
78  }
79 
83  };
84 
85  void toggle (std::vector<Member>::iterator);
86  void list_view_visible_changed (std::string const &);
88  bool should_actually_be_visible (Member const &) const;
89 
90  std::vector<Member> _members;
91  std::string _xml_property_name;
93  Glib::RefPtr<Gtk::ListStore> _model;
95 };
96 
97 #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 &)
PBD::Signal< void()> VisibilityChanged
bool should_actually_be_visible(Member const &) const
std::string get_state_name() const
void add(Gtk::Widget *, std::string const &, std::string const &, bool visible=false, std::function< std::optional< bool >()>=0)
Gtk::Widget * list_view()
Definition: xml++.h:114