#include <vector>
+#include <gtkmm/combobox.h>
+
#include "pbd/i18n.h"
#include "pbd/strsplit.h"
row[_columns.path] = *p;
}
}
+
+bool
+ActionManager::ActionModel::find_action_in_model (const TreeModel::iterator& iter, std::string const & action_path, TreeModel::iterator* found) const
+{
+ TreeModel::Row row = *iter;
+ string path = row[_columns.path];
+
+ if (path == action_path) {
+ *found = iter;
+ return true;
+ }
+
+ return false;
+}
+
+void
+ActionManager::ActionModel::build_action_combo (ComboBox& cb, string const& current_action) const
+{
+ cb.set_model (_model);
+ cb.pack_start (_columns.name);
+
+ if (current_action.empty()) {
+ cb.set_active (0); /* "disabled" */
+ return;
+ }
+
+ TreeModel::iterator iter = _model->children().end();
+
+ _model->foreach_iter (sigc::bind (sigc::mem_fun (*this, &ActionManager::ActionModel::find_action_in_model), current_action, &iter));
+
+ if (iter != _model->children().end()) {
+ cb.set_active (iter);
+ } else {
+ cb.set_active (0);
+ }
+}
#include "gtkmm2ext/visibility.h"
+namespace Gtk
+{
+class ComboBox;
+}
+
/*
The singleton ActionModel provides a Gtk::Treestore of all actions known to
ardour.
const Columns& columns() const { return _columns; }
+ void build_action_combo (Gtk::ComboBox& cb, std::string const& current_action) const;
+
private:
ActionModel ();
+ bool find_action_in_model (const Gtk::TreeModel::iterator& iter, std::string const & action_path, Gtk::TreeModel::iterator* found) const;
+
const Columns _columns;
Glib::RefPtr<Gtk::TreeStore> _model;
};