23#include <blackboard/blackboard.h>
24#include <core/exception.h>
25#include <core/exceptions/software.h>
26#include <gui_utils/multi_interface_chooser_dialog.h>
27#include <interface/interface_info.h>
76 const char * type_pattern,
77 const char * id_pattern,
79 const Glib::ustring & title)
83 d->
init(blackboard, type_pattern, id_pattern);
97 const Glib::ustring & title)
100 loaded_interfaces_.insert(loaded_interfaces.begin(), loaded_interfaces.end());
101 Glib::RefPtr<Gtk::TreeSelection> treesel =
treeview_.get_selection();
103 treeview_.set_tooltip_text(
"Drag the rows to change the painting order.");
104 treesel->set_mode(Gtk::SELECTION_NONE);
117MultiInterfaceChooserDialog::on_load_toggled(
const Glib::ustring &path)
119 Gtk::TreeModel::Row row = *
model_->get_iter(path);
127const MultiInterfaceChooserDialog::Record &
132 this_nonconst->record_ =
new Record();
151 Gtk::CellRendererToggle *renderer =
152 dynamic_cast<Gtk::CellRendererToggle *
>(
treeview_.get_column_cell_renderer(0));
153 assert(renderer != NULL);
155 renderer->set_activatable(
true);
156 renderer->signal_toggled().connect(
157 sigc::mem_fun(*
this, &MultiInterfaceChooserDialog::on_load_toggled));
175 loaded_interfaces_.find(std::make_pair(ii.
type(), ii.
id())) != loaded_interfaces_.end();
186 const Gtk::TreeNodeChildren children =
model_->children();
187 for (Gtk::TreeNodeChildren::const_iterator it = children.begin(); it != children.end(); ++it) {
188 const Gtk::TreeRow &row = *it;
191 types_and_ids.push_back(pair);
195 return types_and_ids;
208 const Gtk::TreeNodeChildren children =
model_->children();
209 for (Gtk::TreeNodeChildren::const_iterator it = children.begin(); it != children.end(); ++it) {
210 const Gtk::TreeRow &row = *it;
213 if (loaded_interfaces_.find(pair) == loaded_interfaces_.end()) {
214 types_and_ids.push_back(pair);
219 return types_and_ids;
The BlackBoard abstract class.
Blackboard interface chooser dialog.
virtual int init_columns()
Initializes the columns GUI-wise.
Gtk::TreeView treeview_
Tree widget for interfaces.
void init(BlackBoard *blackboard, const char *type_pattern, const char *id_pattern)
Initialization method.
virtual void init_row(Gtk::TreeModel::Row &row, const InterfaceInfo &ii)
Initializes a row with the given interface.
Glib::RefPtr< Gtk::ListStore > model_
Data model of the tree.
const char * type() const
Get interface type.
const char * id() const
Get interface ID.
Blackboard interface record.
Gtk::TreeModelColumn< bool > load
Load this interface?
Blackboard interface chooser dialog that supports multiple choices.
virtual int init_columns()
Initializes the columns GUI-wise.
std::list< TypeIdPair > TypeIdPairList
List of type and ID of an interface.
virtual ~MultiInterfaceChooserDialog()
Destructor.
TypeIdPairList get_selected_interfaces() const
Get selected interface types and their respective IDs.
TypeIdPairList get_newly_selected_interfaces() const
Get selected interface types and their respective IDs.
virtual const Record & record() const
Returns the Record of this chooser dialog.
static MultiInterfaceChooserDialog * create(Gtk::Window &parent, BlackBoard *blackboard, const char *type_pattern, const char *id_pattern, const TypeIdPairList &loaded_interfaces, const Glib::ustring &title=DEFAULT_TITLE)
Factory method.
virtual void init_row(Gtk::TreeModel::Row &row, const InterfaceInfo &ii)
Initializes a row with the given interface.
std::pair< Glib::ustring, Glib::ustring > TypeIdPair
Pair of type and IDs of interfaces.
MultiInterfaceChooserDialog(Gtk::Window &parent, const TypeIdPairList &loaded_interfaces, const Glib::ustring &title)
Constructor for subclasses.
Fawkes library namespace.