25#include <blackboard/blackboard.h>
26#include <core/exception.h>
27#include <core/exceptions/software.h>
28#include <gui_utils/interface_chooser_dialog.h>
29#include <interface/interface_info.h>
81 const char * type_pattern,
82 const char * id_pattern,
83 const Glib::ustring &title)
86 d->
init(blackboard, type_pattern, id_pattern);
98: Gtk::Dialog(title, parent, true), parent_(parent), record_(NULL)
118 const char *type_pattern,
119 const char *id_pattern)
123 set_default_size(360, 240);
128 scrollwin_.set_policy(Gtk::POLICY_AUTOMATIC, Gtk::POLICY_AUTOMATIC);
131 Gtk::Box *vbox = get_vbox();
132 vbox->pack_start(scrollwin_);
135 add_button(Gtk::Stock::CANCEL, 0);
136 add_button(Gtk::Stock::OK, 1);
138 set_default_response(1);
140 treeview_.signal_row_activated().connect(sigc::bind(
141 sigc::hide<0>(sigc::hide<0>(sigc::mem_fun(*
this, &InterfaceChooserDialog::response))), 1));
146 for (InterfaceInfoList::iterator i = infl->begin(); i != infl->end(); ++i) {
147 Gtk::TreeModel::Row row = *
model_->append();
170 this_nonconst->record_ =
new Record();
220 const Glib::RefPtr<Gtk::TreeSelection> treesel =
treeview_.get_selection();
221 const Gtk::TreeModel::iterator iter = treesel->get_selected();
223 const Gtk::TreeModel::Row row = *iter;
227 throw Exception(
"No interface selected");
245 throw Exception(
"BlackBoard is not alive");
254 Glib::ustring message = *(e.
begin());
255 Gtk::MessageDialog md(parent_,
261 md.set_title(
"Opening Interface failed");
The BlackBoard abstract class.
virtual bool is_alive() const noexcept=0
Check if the BlackBoard is still alive.
virtual Interface * open_for_reading(const char *interface_type, const char *identifier, const char *owner=NULL)=0
Open interface for reading.
virtual InterfaceInfoList * list(const char *type_pattern, const char *id_pattern)=0
Get list of interfaces matching type and ID patterns.
Base class for exceptions in Fawkes.
iterator begin() noexcept
Get iterator for messages.
Blackboard interface record.
Gtk::TreeModelColumn< bool > has_writer
Writer exists?
Gtk::TreeModelColumn< Glib::ustring > id
The ID of the interface.
Gtk::TreeModelColumn< Glib::ustring > type
The type of the interface.
Gtk::TreeModelColumn< unsigned int > num_readers
Number of readers.
Blackboard interface chooser dialog.
virtual int init_columns()
Initializes the columns GUI-wise.
Gtk::TreeView treeview_
Tree widget for interfaces.
static const char *const DEFAULT_TITLE
Default title of interface chooser dialogs.
void init(BlackBoard *blackboard, const char *type_pattern, const char *id_pattern)
Initialization method.
void get_selected_interface(Glib::ustring &type, Glib::ustring &id)
Get selected interface type and ID.
virtual void init_row(Gtk::TreeModel::Row &row, const InterfaceInfo &ii)
Initializes a row with the given interface.
virtual ~InterfaceChooserDialog()
Destructor.
virtual const Record & record() const
Returns the Record of this chooser dialog.
Glib::RefPtr< Gtk::ListStore > model_
Data model of the tree.
InterfaceChooserDialog(Gtk::Window &parent, const Glib::ustring &title)
Constructor for subclasses.
static InterfaceChooserDialog * create(Gtk::Window &parent, BlackBoard *blackboard, const char *type_pattern, const char *id_pattern, const Glib::ustring &title=DEFAULT_TITLE)
Factory method.
fawkes::Interface * run_and_open_for_reading()
Run dialog and try to connect.
Interface information list.
bool has_writer() const
Check if there is a writer.
const char * type() const
Get interface type.
const char * id() const
Get interface ID.
unsigned int num_readers() const
Get number of readers.
Base class for all Fawkes BlackBoard interfaces.
Fawkes library namespace.