Fawkes API  Fawkes Development Version
fawkes::InterfaceChooserDialog Class Reference

Blackboard interface chooser dialog. More...

#include <>>

Inheritance diagram for fawkes::InterfaceChooserDialog:

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::Interfacerun_and_open_for_reading ()
 Run dialog and try to connect. More...
 

Static Public Member Functions

static InterfaceChooserDialogcreate (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 Recordrecord () 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...
 

Detailed Description

Blackboard interface chooser dialog.

Allows to choose a blackboard interface from a list of interfaces matching given type and ID patterns.

Author
Tim Niemueller, Christoph Schwering

Definition at line 43 of file interface_chooser_dialog.h.

Constructor & Destructor Documentation

◆ ~InterfaceChooserDialog()

fawkes::InterfaceChooserDialog::~InterfaceChooserDialog ( )
virtual

Destructor.

Definition at line 165 of file interface_chooser_dialog.cpp.

◆ InterfaceChooserDialog()

fawkes::InterfaceChooserDialog::InterfaceChooserDialog ( Gtk::Window &  parent,
const Glib::ustring &  title 
)
protected

Constructor for subclasses.

After calling this constructor, the init() method needs to be called.

Parameters
parentparent window
titletitle of the dialog

Definition at line 104 of file interface_chooser_dialog.cpp.

Referenced by create().

Member Function Documentation

◆ create()

InterfaceChooserDialog * fawkes::InterfaceChooserDialog::create ( Gtk::Window &  parent,
BlackBoard blackboard,
const char *  type_pattern,
const char *  id_pattern,
const Glib::ustring &  title = DEFAULT_TITLE 
)
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).

Parameters
parentparent window
blackboardblackboard instance to query interfaces from
type_patternpattern with shell like globs (* for any number of characters, ? for exactly one character) to match the interface type.
id_patternpattern with shell like globs (* for any number of characters, ? for exactly one character) to match the interface ID.
titletitle of the dialog
Returns
new InterfaceChooserDialog

Definition at line 84 of file interface_chooser_dialog.cpp.

References init(), and InterfaceChooserDialog().

◆ get_selected_interface()

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.

Parameters
typeupon return contains the type of the interface
idupon return contains the ID of the interface
Exceptions
Exceptionthrown 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.

◆ init()

void fawkes::InterfaceChooserDialog::init ( BlackBoard blackboard,
const char *  type_pattern,
const char *  id_pattern 
)
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.

Parameters
blackboardblackboard instance to query interfaces from
type_patternpattern with shell like globs (* for any number of characters, ? for exactly one character) to match the interface type.
id_patternpattern 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().

◆ init_columns()

int fawkes::InterfaceChooserDialog::init_columns ( )
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).

Returns
The number of columns added.

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().

◆ init_row()

void fawkes::InterfaceChooserDialog::init_row ( Gtk::TreeModel::Row &  row,
const InterfaceInfo ii 
)
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).

Parameters
rowThe row whose content is to be set.
iiThe 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().

◆ record()

const InterfaceChooserDialog::Record & fawkes::InterfaceChooserDialog::record ( ) const
protectedvirtual

Returns the Record of this chooser dialog.

Subclasses of InterfaceChooserDialog might want to override this method.

Returns
Record implementation.

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().

◆ run_and_open_for_reading()

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.

Returns
interface instant of the selected interface. Note that this is only an untyped interface instance which is useful for instrospection purposes only.

Definition at line 260 of file interface_chooser_dialog.cpp.

References fawkes::Exception::begin(), fawkes::BlackBoard::is_alive(), and fawkes::BlackBoard::open_for_reading().

Member Data Documentation

◆ __model

Glib::RefPtr<Gtk::ListStore> fawkes::InterfaceChooserDialog::__model
protected

◆ __treeview

Gtk::TreeView fawkes::InterfaceChooserDialog::__treeview
protected

◆ DEFAULT_TITLE

const char *const fawkes::InterfaceChooserDialog::DEFAULT_TITLE = "Select Interfaces"
static

Default title of interface chooser dialogs.

Definition at line 47 of file interface_chooser_dialog.h.


The documentation for this class was generated from the following files: