1 /* Copyright (C) 2017 Paul Davis
2 * based on gtkmm example Copyright (C) 2002 gtkmm development team
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License version 2
6 * as published by the Free Software Foundation.
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
13 * You should have received a copy of the GNU General Public License
14 * along with this program; if not, write to the Free Software
15 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18 #ifndef __gtk2_ardour_stripable_treemodel_h__
19 #define __gtk2_ardour_stripable_treemodel_h__
23 #include <boost/shared_ptr.hpp>
24 #include <boost/weak_ptr.hpp>
27 #include <gtkmm/treemodel.h>
35 class AxisViewProvider;
36 class StripableSorter;
38 class StripableTreeModel : public Gtk::TreeModel, public Glib::Object
41 StripableTreeModel (AxisViewProvider&);
42 virtual ~StripableTreeModel();
45 static Glib::RefPtr<StripableTreeModel> create (AxisViewProvider&);
46 void set_session (ARDOUR::Session&);
49 Gtk::TreeModelFlags get_flags_vfunc() const;
50 int get_n_columns_vfunc() const;
51 GType get_column_type_vfunc(int index) const;
52 void get_value_vfunc(const TreeModel::iterator& iter, int column, Glib::ValueBase& value) const;
53 bool iter_next_vfunc(const iterator& iter, iterator& iter_next) const;
54 bool iter_children_vfunc(const iterator& parent, iterator& iter) const;
55 bool iter_has_child_vfunc(const iterator& iter) const;
56 int iter_n_children_vfunc(const iterator& iter) const;
57 int iter_n_root_children_vfunc() const;
58 bool iter_nth_child_vfunc(const iterator& parent, int n, iterator& iter) const;
59 bool iter_nth_root_child_vfunc(int n, iterator& iter) const;
60 bool iter_parent_vfunc(const iterator& child, iterator& iter) const;
61 Path get_path_vfunc(const iterator& iter) const;
62 bool get_iter_vfunc(const Path& path, iterator& iter) const;
63 bool iter_is_valid(const iterator& iter) const;
66 typedef Gtk::TreeModelColumn<std::string> StringColumn;
67 typedef Gtk::TreeModelColumn<bool> BoolColumn;
68 typedef Gtk::TreeModelColumn<uint32_t> UnsignedColumn;
69 typedef Gtk::TreeModelColumn<AxisView*> AVColumn;
70 typedef Gtk::TreeModelColumn<boost::shared_ptr<ARDOUR::Stripable> > StripableColumn;
72 struct Columns : public Gtk::TreeModel::ColumnRecord
82 add (solo_isolate_state);
83 add (solo_safe_state);
88 add (is_input_active);
95 UnsignedColumn rec_state;
96 UnsignedColumn rec_safe;
97 UnsignedColumn mute_state;
98 UnsignedColumn solo_state;
99 /** true if the solo buttons are visible for this route, otherwise false */
100 BoolColumn solo_visible;
101 UnsignedColumn solo_isolate_state;
102 UnsignedColumn solo_safe_state;
105 StripableColumn stripable;
106 BoolColumn name_editable;
107 BoolColumn is_input_active;
115 ARDOUR::Session* _session;
116 AxisViewProvider& axis_view_provider;
120 void text_value (boost::shared_ptr<ARDOUR::Stripable> stripable, Glib::ValueBase& value) const;
124 Glue (boost::shared_ptr<ARDOUR::Stripable>);
126 boost::weak_ptr<ARDOUR::Stripable> stripable;
129 typedef std::set<Glue*> GlueList;
130 mutable GlueList glue_list;
131 void remember_glue_item (Glue*) const;
134 #endif /* __gtk2_ardour_stripable_treemodel_h__ */