23 #include <gui_utils/multi_interface_chooser_dialog.h> 26 #include <core/exception.h> 27 #include <core/exceptions/software.h> 28 #include <blackboard/blackboard.h> 29 #include <interface/interface_info.h> 79 const char* type_pattern,
80 const char* id_pattern,
82 const Glib::ustring& title)
85 parent, loaded_interfaces, title);
86 d->
init(blackboard, type_pattern, id_pattern);
102 const Glib::ustring& title)
106 __loaded_interfaces.insert(loaded_interfaces.begin(), loaded_interfaces.end());
107 Glib::RefPtr<Gtk::TreeSelection> treesel =
__treeview.get_selection();
109 __treeview.set_tooltip_text(
"Drag the rows to change the painting order.");
110 treesel->set_mode(Gtk::SELECTION_NONE);
125 MultiInterfaceChooserDialog::on_load_toggled(
const Glib::ustring& path)
127 Gtk::TreeModel::Row row = *
__model->get_iter(path);
141 this_nonconst->__record =
new Record();
161 Gtk::CellRendererToggle* renderer =
dynamic_cast<Gtk::CellRendererToggle*
>(
163 assert(renderer != NULL);
165 renderer->set_activatable(
true);
166 renderer->signal_toggled().connect(
167 sigc::mem_fun(*
this, &MultiInterfaceChooserDialog::on_load_toggled));
186 row[
record().
load] = __loaded_interfaces.find(std::make_pair(ii.
type(), ii.
id())) !=
187 __loaded_interfaces.end();
199 const Gtk::TreeNodeChildren children =
__model->children();
200 for (Gtk::TreeNodeChildren::const_iterator it = children.begin();
201 it != children.end(); ++it)
203 const Gtk::TreeRow& row = *it;
206 types_and_ids.push_back(pair);
210 return types_and_ids;
224 const Gtk::TreeNodeChildren children =
__model->children();
225 for (Gtk::TreeNodeChildren::const_iterator it = children.begin();
226 it != children.end(); ++it)
228 const Gtk::TreeRow& row = *it;
231 if (__loaded_interfaces.find(pair) == __loaded_interfaces.end())
233 types_and_ids.push_back(pair);
238 return types_and_ids;
const char * type() const
Get interface type.
Blackboard interface record.
Blackboard interface chooser dialog.
MultiInterfaceChooserDialog(Gtk::Window &parent, const TypeIdPairList &loaded_interfaces, const Glib::ustring &title)
Constructor for subclasses.
virtual ~MultiInterfaceChooserDialog()
Destructor.
std::list< TypeIdPair > TypeIdPairList
List of type and ID of an interface.
Fawkes library namespace.
Gtk::TreeModelColumn< bool > load
Load this interface?
const char * id() const
Get interface ID.
void init(BlackBoard *blackboard, const char *type_pattern, const char *id_pattern)
Initialization method.
Glib::RefPtr< Gtk::ListStore > __model
Data model of the tree.
virtual int init_columns()
Initializes the columns GUI-wise.
Blackboard interface chooser dialog that supports multiple choices.
virtual int init_columns()
Initializes the columns GUI-wise.
TypeIdPairList get_newly_selected_interfaces() const
Get selected interface types and their respective IDs.
Gtk::TreeView __treeview
Tree widget for interfaces.
std::pair< Glib::ustring, Glib::ustring > TypeIdPair
Pair of type and IDs of interfaces.
virtual void init_row(Gtk::TreeModel::Row &row, const InterfaceInfo &ii)
Initializes a row with the given interface.
TypeIdPairList get_selected_interfaces() const
Get selected interface types and their respective IDs.
virtual void init_row(Gtk::TreeModel::Row &row, const InterfaceInfo &ii)
Initializes a row with the given interface.
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.
The BlackBoard abstract class.