Ardour  9.0-pre0-582-g084a23a80d
stripable_treemodel.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2017 Robin Gareus <robin@gareus.org>
3  *
4  * This program is free software; you can redistribute it and/or modify
5  * it under the terms of the GNU General Public License as published by
6  * the Free Software Foundation; either version 2 of the License, or
7  * (at your option) any later version.
8  *
9  * This program is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12  * GNU General Public License for more details.
13  *
14  * You should have received a copy of the GNU General Public License along
15  * with this program; if not, write to the Free Software Foundation, Inc.,
16  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
17  */
18 
19 #ifndef __gtk2_ardour_stripable_treemodel_h__
20 #define __gtk2_ardour_stripable_treemodel_h__
21 
22 #include <cstdint>
23 #include <memory>
24 #include <set>
25 
26 #include <gtkmm/treemodel.h>
27 
28 namespace ARDOUR {
29  class Session;
30  class Stripable;
31 }
32 
33 class AxisView;
34 class AxisViewProvider;
35 class StripableSorter;
36 
37 class StripableTreeModel : public Gtk::TreeModel, public Glib::Object
38 {
39 protected:
42 
43 public:
44  static Glib::RefPtr<StripableTreeModel> create (AxisViewProvider&);
46 
47 protected:
49  int get_n_columns_vfunc() const;
50  GType get_column_type_vfunc(int index) const;
51  void get_value_vfunc(const TreeModel::iterator& iter, int column, Glib::ValueBase& value) const;
52  bool iter_next_vfunc(const iterator& iter, iterator& iter_next) const;
53  bool iter_children_vfunc(const iterator& parent, iterator& iter) const;
54  bool iter_has_child_vfunc(const iterator& iter) const;
55  int iter_n_children_vfunc(const iterator& iter) const;
57  bool iter_nth_child_vfunc(const iterator& parent, int n, iterator& iter) const;
58  bool iter_nth_root_child_vfunc(int n, iterator& iter) const;
59  bool iter_parent_vfunc(const iterator& child, iterator& iter) const;
60  Path get_path_vfunc(const iterator& iter) const;
61  bool get_iter_vfunc(const Path& path, iterator& iter) const;
62  bool iter_is_valid(const iterator& iter) const;
63 
64 public:
70 
72  {
73  Columns () {
74  add (text);
75  add (visible);
76  add (rec_state);
77  add (rec_safe);
78  add (mute_state);
79  add (solo_state);
80  add (solo_visible);
83  add (is_track);
84  add (av);
85  add (stripable);
88  add (is_midi);
89  add (active);
90  }
91 
109  };
110 
112 
113 private:
116 
118 
119  void text_value (std::shared_ptr<ARDOUR::Stripable> stripable, Glib::ValueBase& value) const;
120 
121  struct Glue
122  {
123  Glue (std::shared_ptr<ARDOUR::Stripable>);
124 
125  std::weak_ptr<ARDOUR::Stripable> stripable;
126  };
127 
128  typedef std::set<Glue*> GlueList;
130  void remember_glue_item (Glue*) const;
131 };
132 
133 #endif /* __gtk2_ardour_stripable_treemodel_h__ */
void add(TreeModelColumnBase &column)
bool iter_nth_root_child_vfunc(int n, iterator &iter) const
int iter_n_children_vfunc(const iterator &iter) const
bool iter_children_vfunc(const iterator &parent, iterator &iter) const
void get_value_vfunc(const TreeModel::iterator &iter, int column, Glib::ValueBase &value) const
bool iter_is_valid(const iterator &iter) const
Gtk::TreeModelColumn< uint32_t > UnsignedColumn
bool iter_has_child_vfunc(const iterator &iter) const
ARDOUR::Session * _session
Gtk::TreeModelColumn< std::shared_ptr< ARDOUR::Stripable > > StripableColumn
bool iter_parent_vfunc(const iterator &child, iterator &iter) const
void remember_glue_item(Glue *) const
int get_n_columns_vfunc() const
Path get_path_vfunc(const iterator &iter) const
bool iter_next_vfunc(const iterator &iter, iterator &iter_next) const
bool get_iter_vfunc(const Path &path, iterator &iter) const
AxisViewProvider & axis_view_provider
void set_session(ARDOUR::Session &)
void text_value(std::shared_ptr< ARDOUR::Stripable > stripable, Glib::ValueBase &value) const
StripableTreeModel(AxisViewProvider &)
std::set< Glue * > GlueList
bool iter_nth_child_vfunc(const iterator &parent, int n, iterator &iter) const
Gtk::TreeModelFlags get_flags_vfunc() const
GType get_column_type_vfunc(int index) const
int iter_n_root_children_vfunc() const
Gtk::TreeModelColumn< std::string > StringColumn
Gtk::TreeModelColumn< AxisView * > AVColumn
virtual ~StripableTreeModel()
static Glib::RefPtr< StripableTreeModel > create(AxisViewProvider &)
Gtk::TreeModelColumn< bool > BoolColumn
TreeModelFlags
Definition: treemodel.h:68
std::weak_ptr< ARDOUR::Stripable > stripable
Glue(std::shared_ptr< ARDOUR::Stripable >)