Fawkes API
Fawkes Development Version
|
Blackboard interface chooser dialog. More...
#include <>>
Classes | |
class | Record |
Blackboard interface record. More... | |
Public Member Functions | |
virtual | ~InterfaceChooserDialog () |
Destructor. More... | |
void | get_selected_interface (Glib::ustring &type, Glib::ustring &id) |
Get selected interface type and ID. More... | |
fawkes::Interface * | run_and_open_for_reading () |
Run dialog and try to connect. More... | |
Static Public Member Functions | |
static InterfaceChooserDialog * | create (Gtk::Window &parent, BlackBoard *blackboard, const char *type_pattern, const char *id_pattern, const Glib::ustring &title=DEFAULT_TITLE) |
Factory method. More... | |
Static Public Attributes | |
static const char *const | DEFAULT_TITLE = "Select Interfaces" |
Default title of interface chooser dialogs. More... | |
Protected Member Functions | |
InterfaceChooserDialog (Gtk::Window &parent, const Glib::ustring &title) | |
Constructor for subclasses. More... | |
void | init (BlackBoard *blackboard, const char *type_pattern, const char *id_pattern) |
Initialization method. More... | |
virtual const Record & | record () const |
Returns the Record of this chooser dialog. More... | |
virtual int | init_columns () |
Initializes the columns GUI-wise. More... | |
virtual void | init_row (Gtk::TreeModel::Row &row, const InterfaceInfo &ii) |
Initializes a row with the given interface. More... | |
Protected Attributes | |
Gtk::TreeView | __treeview |
Tree widget for interfaces. More... | |
Glib::RefPtr< Gtk::ListStore > | __model |
Data model of the tree. More... | |
Blackboard interface chooser dialog.
Allows to choose a blackboard interface from a list of interfaces matching given type and ID patterns.
Definition at line 43 of file interface_chooser_dialog.h.
|
virtual |
Destructor.
Definition at line 165 of file interface_chooser_dialog.cpp.
|
protected |
Constructor for subclasses.
After calling this constructor, the init() method needs to be called.
parent | parent window |
title | title of the dialog |
Definition at line 104 of file interface_chooser_dialog.cpp.
Referenced by create().
|
static |
Factory method.
Why a factory method instead of a ctor? The factory method calls init(), and init() calls other virtual methods. If this was a ctor, this ctor would not be allowed to be called by subclasses, because then the virtual methods in init() don't dispatch the right way during construction (see Effective C++ #9).
parent | parent window |
blackboard | blackboard instance to query interfaces from |
type_pattern | pattern with shell like globs (* for any number of characters, ? for exactly one character) to match the interface type. |
id_pattern | pattern with shell like globs (* for any number of characters, ? for exactly one character) to match the interface ID. |
title | title of the dialog |
Definition at line 84 of file interface_chooser_dialog.cpp.
References init(), and InterfaceChooserDialog().
void fawkes::InterfaceChooserDialog::get_selected_interface | ( | Glib::ustring & | type, |
Glib::ustring & | id | ||
) |
Get selected interface type and ID.
If an interface has been selected use this method to get the type and ID. Only applicable if get_multi() == false.
type | upon return contains the type of the interface |
id | upon return contains the ID of the interface |
Exception | thrown if no interface has been selected |
Definition at line 234 of file interface_chooser_dialog.cpp.
References __treeview, fawkes::InterfaceChooserDialog::Record::id, record(), and fawkes::InterfaceChooserDialog::Record::type.
|
protected |
Initialization method.
Subclasses should use the protected constructor and should then call the init() method. This ensures that init()'s calls to virtual methods dispatch to the right ones.
blackboard | blackboard instance to query interfaces from |
type_pattern | pattern with shell like globs (* for any number of characters, ? for exactly one character) to match the interface type. |
id_pattern | pattern with shell like globs (* for any number of characters, ? for exactly one character) to match the interface ID. |
Definition at line 128 of file interface_chooser_dialog.cpp.
References __model, __treeview, init_columns(), init_row(), fawkes::BlackBoard::list(), and record().
Referenced by fawkes::MultiInterfaceChooserDialog::create(), and create().
|
protectedvirtual |
Initializes the columns GUI-wise.
Called in the ctor. Subclasses of InterfaceChooserDialog might want to override this method, but should probably still call their super-class's implementation (i.e., this one).
Reimplemented in fawkes::MultiInterfaceChooserDialog.
Definition at line 196 of file interface_chooser_dialog.cpp.
References __treeview, and record().
Referenced by init(), and fawkes::MultiInterfaceChooserDialog::init_columns().
|
protectedvirtual |
Initializes a row with the given interface.
Called in the ctor. Subclasses of InterfaceChooserDialog might want to override this method, but should probably still call their super-class's implementation (i.e., this one).
row | The row whose content is to be set. |
ii | The interface info that should populate the row. |
Reimplemented in fawkes::MultiInterfaceChooserDialog.
Definition at line 215 of file interface_chooser_dialog.cpp.
References fawkes::InterfaceInfo::has_writer(), fawkes::InterfaceChooserDialog::Record::has_writer, fawkes::InterfaceInfo::id(), fawkes::InterfaceChooserDialog::Record::id, fawkes::InterfaceInfo::num_readers(), fawkes::InterfaceChooserDialog::Record::num_readers, record(), fawkes::InterfaceInfo::type(), and fawkes::InterfaceChooserDialog::Record::type.
Referenced by init(), and fawkes::MultiInterfaceChooserDialog::init_row().
|
protectedvirtual |
Returns the Record of this chooser dialog.
Subclasses of InterfaceChooserDialog might want to override this method.
Reimplemented in fawkes::MultiInterfaceChooserDialog.
Definition at line 178 of file interface_chooser_dialog.cpp.
Referenced by get_selected_interface(), init(), init_columns(), and init_row().
fawkes::Interface * fawkes::InterfaceChooserDialog::run_and_open_for_reading | ( | ) |
Run dialog and try to connect.
This runs the service chooser dialog and connects to the given service with the attached FawkesNetworkClient. If the connection couldn't be established an error dialog is shown. You should not rely on the connection to be active after calling this method, rather you should use a ConnectionDispatcher to get the "connected" signal.
Definition at line 260 of file interface_chooser_dialog.cpp.
References fawkes::Exception::begin(), fawkes::BlackBoard::is_alive(), and fawkes::BlackBoard::open_for_reading().
|
protected |
Data model of the tree.
Definition at line 85 of file interface_chooser_dialog.h.
Referenced by fawkes::MultiInterfaceChooserDialog::get_newly_selected_interfaces(), fawkes::MultiInterfaceChooserDialog::get_selected_interfaces(), init(), and fawkes::MultiInterfaceChooserDialog::~MultiInterfaceChooserDialog().
|
protected |
Tree widget for interfaces.
Definition at line 84 of file interface_chooser_dialog.h.
Referenced by get_selected_interface(), init(), fawkes::MultiInterfaceChooserDialog::init_columns(), init_columns(), and fawkes::MultiInterfaceChooserDialog::MultiInterfaceChooserDialog().
|
static |
Default title of interface chooser dialogs.
Definition at line 47 of file interface_chooser_dialog.h.