25 #include <gui_utils/interface_chooser_dialog.h> 28 #include <core/exception.h> 29 #include <core/exceptions/software.h> 30 #include <blackboard/blackboard.h> 31 #include <interface/interface_info.h> 87 const char* type_pattern,
88 const char* id_pattern,
89 const Glib::ustring& title)
92 d->
init(blackboard, type_pattern, id_pattern);
105 const Glib::ustring& title)
106 : Gtk::Dialog(title, parent, true),
129 const char *type_pattern,
130 const char *id_pattern)
134 set_default_size(360, 240);
139 __scrollwin.set_policy(Gtk::POLICY_AUTOMATIC, Gtk::POLICY_AUTOMATIC);
142 Gtk::Box *vbox = get_vbox();
143 vbox->pack_start(__scrollwin);
146 add_button(Gtk::Stock::CANCEL, 0);
147 add_button(Gtk::Stock::OK, 1);
149 set_default_response(1);
151 __treeview.signal_row_activated().connect(sigc::bind(sigc::hide<0>(sigc::hide<0>(sigc::mem_fun(*
this, &InterfaceChooserDialog::response))), 1));
156 for (InterfaceInfoList::iterator i = infl->begin(); i != infl->end(); ++i) {
157 Gtk::TreeModel::Row row = *
__model->append();
182 this_nonconst->__record =
new Record();
237 const Glib::RefPtr<Gtk::TreeSelection> treesel =
__treeview.get_selection();
238 const Gtk::TreeModel::iterator iter = treesel->get_selected();
240 const Gtk::TreeModel::Row row = *iter;
244 throw Exception(
"No interface selected");
271 Glib::ustring message = *(e.
begin());
272 Gtk::MessageDialog md(__parent, message,
false,
273 Gtk::MESSAGE_ERROR, Gtk::BUTTONS_OK,
275 md.set_title(
"Opening Interface failed");
const char * type() const
Get interface type.
Blackboard interface chooser dialog.
Fawkes library namespace.
const char * id() const
Get interface ID.
void init(BlackBoard *blackboard, const char *type_pattern, const char *id_pattern)
Initialization method.
virtual ~InterfaceChooserDialog()
Destructor.
Glib::RefPtr< Gtk::ListStore > __model
Data model of the tree.
virtual const Record & record() const
Returns the Record of this chooser dialog.
static const char *const DEFAULT_TITLE
Default title of interface chooser dialogs.
Base class for all Fawkes BlackBoard interfaces.
virtual InterfaceInfoList * list(const char *type_pattern, const char *id_pattern)=0
Get list of interfaces matching type and ID patterns.
Interface information list.
virtual int init_columns()
Initializes the columns GUI-wise.
Base class for exceptions in Fawkes.
Gtk::TreeModelColumn< Glib::ustring > type
The type of the interface.
bool has_writer() const
Check if there is a writer.
Gtk::TreeModelColumn< bool > has_writer
Writer exists?
virtual bool is_alive() const =0
Check if the BlackBoard is still alive.
Gtk::TreeView __treeview
Tree widget for interfaces.
iterator begin()
Get iterator for messages.
InterfaceChooserDialog(Gtk::Window &parent, const Glib::ustring &title)
Constructor for subclasses.
Gtk::TreeModelColumn< unsigned int > num_readers
Number of readers.
unsigned int num_readers() const
Get number of readers.
void get_selected_interface(Glib::ustring &type, Glib::ustring &id)
Get selected interface type and ID.
Blackboard interface record.
virtual void init_row(Gtk::TreeModel::Row &row, const InterfaceInfo &ii)
Initializes a row with the given interface.
fawkes::Interface * run_and_open_for_reading()
Run dialog and try to connect.
virtual Interface * open_for_reading(const char *interface_type, const char *identifier, const char *owner=NULL)=0
Open interface for reading.
The BlackBoard abstract class.
Gtk::TreeModelColumn< Glib::ustring > id
The ID of the interface.
static InterfaceChooserDialog * create(Gtk::Window &parent, BlackBoard *blackboard, const char *type_pattern, const char *id_pattern, const Glib::ustring &title=DEFAULT_TITLE)
Factory method.