Image Component Library (ICL)
Public Types | Public Member Functions | Static Public Member Functions | Static Public Attributes | Protected Member Functions | Private Member Functions | Static Private Member Functions | Private Attributes | List of all members
icl::qt::GUI Class Reference

Main Class of ICL's GUI creation framework. More...

#include <GUI.h>

Inheritance diagram for icl::qt::GUI:
icl::qt::ChromaGUI icl::qt::ContainerGUIComponent icl::qt::DynamicGUI icl::qt::Border icl::qt::HBox icl::qt::HScroll icl::qt::HSplit icl::qt::Tab icl::qt::VBox icl::qt::VScroll icl::qt::VSplit

Public Types

typedef utils::Function< GUIWidget *, const GUIDefinition & > CreatorFunction
 registered widget type creator function More...
 
typedef utils::Function< void > Callback
 simple callback, that can be registered at GUI components More...
 
typedef utils::Function< void, const std::string & > ComplexCallback
 complex callback type that can be registered at GUI components More...
 

Public Member Functions

 GUI (QWidget *parent=0)
 Default constructor, creates a vbox GUI Component. More...
 
 GUI (const GUIComponent &component, QWidget *parent=0)
 creates a GUI from a givne GUIComponent More...
 
 GUI (const GUI &gui, QWidget *parent=0)
 copy constructor More...
 
GUIoperator= (const GUI &other)
 gui-copy operator More...
 
virtual ~GUI ()
 Destructor. More...
 
virtual GUIoperator<< (const GUIComponent &component)
 adds a new GUI component More...
 
virtual GUIoperator<< (const GUI &g)
 stream operator to add new other GUIs More...
 
template<class T >
T & allocValue (const std::string &id, const T &val=T())
 wraps the data-stores allocValue function More...
 
template<class T >
void release (const std::string &id)
 wraps the datastores release function More...
 
template<class T >
T & get (const std::string &id, bool typeCheck=true)
 
DataStore::Data operator[] (const std::string &key)
 returns a Data instance from the datastore More...
 
template<class T >
std::vector< T > collect (const std::vector< std::string > &keys)
 collects data from different components at once More...
 
virtual bool isVisible () const
 returns whether this gui is actually visible More...
 
virtual void create ()
 internally creates everything More...
 
virtual void show ()
 internally creates everything (and makes the gui visible) More...
 
virtual void hide ()
 make this gui invisible (nothing more) More...
 
virtual void switchVisibility ()
 if widget is visible, this hides the widget, otherwise the widget is shown More...
 
GUIWidgetgetRootWidget ()
 returns the root widget of the gui (only avialable after create() or show()) More...
 
void lockData ()
 internally locks the datastore More...
 
void unlockData ()
 internally unlocks the data store More...
 
void waitForCreation ()
 waits for the gui to be created completely More...
 
const DataStoregetDataStore () const
 returns the GUI internal dataStore More...
 
void registerCallback (const Callback &cb, const std::string &handleNamesList, char listDelim=',')
 registers a callback function on each component More...
 
void registerCallback (const ComplexCallback &cb, const std::string &handleNamesList, char listDelim=',')
 registeres a complex callback at a given GUI component More...
 
void removeCallbacks (const std::string &handleNamesList, char listDelim=',')
 removes all callbacks from components More...
 
bool isDummy () const
 returns whether this GUI is a dummy GUI More...
 
bool hasBeenCreated () const
 returns whether this GUI has been created or not More...
 
std::string createXMLDescription () const
 creates a hierarchical xml-description of the GUI Layout More...
 

Static Public Member Functions

static void register_widget_type (const std::string &tag, CreatorFunction f)
 registers a new widget type More...
 
static GUI create_gui_from_string (const std::string &definition, QWidget *parent)
 legacy creation method (use with care) More...
 

Static Public Attributes

static const int CELLW = 20
 cell width (all sizes are given in this unit) More...
 
static const int CELLH = 20
 cell height (all sizes are given in this unit) More...
 

Protected Member Functions

 GUI (const std::string &definition, QWidget *parent)
 default constructor More...
 
virtual std::string createDefinition () const
 can be overwritten in subclasses (such as ContainerGUIComponent) More...
 

Private Member Functions

virtual GUIoperator<< (const std::string &definition)
 stream operator to add new widgets More...
 
void create (QLayout *parentLayout, ProxyLayout *proxy, QWidget *parentWidget, DataStore *ds)
 

Static Private Member Functions

static void to_string_recursive (const GUI *gui, std::ostream &str, int level)
 

Private Attributes

std::string m_sDefinition
 own definition string More...
 
std::vector< GUI * > m_children
 
GUIWidgetm_poWidget
 
DataStore m_oDataStore
 
bool m_bCreated
 
QWidget * m_poParent
 

Detailed Description

Main Class of ICL's GUI creation framework.

Please refer to the ICL manual for details

Member Typedef Documentation

◆ Callback

simple callback, that can be registered at GUI components

Simple callback methods don't get any information about the source

◆ ComplexCallback

typedef utils::Function<void, const std::string&> icl::qt::GUI::ComplexCallback

complex callback type that can be registered at GUI components

Complex callback methods get the GUI components handle name as parameters. By these means, single callbacks can be registered to several components and still be able to handle events differently

◆ CreatorFunction

registered widget type creator function

Constructor & Destructor Documentation

◆ GUI() [1/4]

icl::qt::GUI::GUI ( const std::string &  definition,
QWidget *  parent 
)
protected

default constructor

◆ GUI() [2/4]

icl::qt::GUI::GUI ( QWidget *  parent = 0)

Default constructor, creates a vbox GUI Component.

◆ GUI() [3/4]

icl::qt::GUI::GUI ( const GUIComponent component,
QWidget *  parent = 0 
)

creates a GUI from a givne GUIComponent

◆ GUI() [4/4]

icl::qt::GUI::GUI ( const GUI gui,
QWidget *  parent = 0 
)

copy constructor

◆ ~GUI()

virtual icl::qt::GUI::~GUI ( )
virtual

Destructor.

Member Function Documentation

◆ allocValue()

template<class T >
T& icl::qt::GUI::allocValue ( const std::string &  id,
const T &  val = T() 
)
inline

wraps the data-stores allocValue function

◆ collect()

template<class T >
std::vector<T> icl::qt::GUI::collect ( const std::vector< std::string > &  keys)
inline

collects data from different components at once

◆ create() [1/2]

virtual void icl::qt::GUI::create ( )
virtual

internally creates everything

◆ create() [2/2]

void icl::qt::GUI::create ( QLayout *  parentLayout,
ProxyLayout proxy,
QWidget *  parentWidget,
DataStore ds 
)
private

◆ create_gui_from_string()

static GUI icl::qt::GUI::create_gui_from_string ( const std::string &  definition,
QWidget *  parent 
)
inlinestatic

legacy creation method (use with care)

◆ createDefinition()

virtual std::string icl::qt::GUI::createDefinition ( ) const
inlineprotectedvirtual

can be overwritten in subclasses (such as ContainerGUIComponent)

Reimplemented in icl::qt::ContainerGUIComponent.

◆ createXMLDescription()

std::string icl::qt::GUI::createXMLDescription ( ) const

creates a hierarchical xml-description of the GUI Layout

◆ get()

template<class T >
T& icl::qt::GUI::get ( const std::string &  id,
bool  typeCheck = true 
)
inline

◆ getDataStore()

const DataStore& icl::qt::GUI::getDataStore ( ) const
inline

returns the GUI internal dataStore

◆ getRootWidget()

GUIWidget* icl::qt::GUI::getRootWidget ( )
inline

returns the root widget of the gui (only avialable after create() or show())

◆ hasBeenCreated()

bool icl::qt::GUI::hasBeenCreated ( ) const

returns whether this GUI has been created or not

◆ hide()

virtual void icl::qt::GUI::hide ( )
virtual

make this gui invisible (nothing more)

◆ isDummy()

bool icl::qt::GUI::isDummy ( ) const
inline

returns whether this GUI is a dummy GUI

Please note: dummy GUIs cannot be created are not added by the stream operator

◆ isVisible()

virtual bool icl::qt::GUI::isVisible ( ) const
virtual

returns whether this gui is actually visible

◆ lockData()

void icl::qt::GUI::lockData ( )
inline

internally locks the datastore

◆ operator<<() [1/3]

virtual GUI& icl::qt::GUI::operator<< ( const std::string &  definition)
privatevirtual

stream operator to add new widgets

if the given definition is "" or "dummy", this operator does nothing

◆ operator<<() [2/3]

virtual GUI& icl::qt::GUI::operator<< ( const GUIComponent component)
virtual

adds a new GUI component

◆ operator<<() [3/3]

virtual GUI& icl::qt::GUI::operator<< ( const GUI g)
virtual

stream operator to add new other GUIs

if the given GUI is a dummy GUI, this operator does nothing

◆ operator=()

GUI& icl::qt::GUI::operator= ( const GUI other)

gui-copy operator

◆ operator[]()

DataStore::Data icl::qt::GUI::operator[] ( const std::string &  key)
inline

returns a Data instance from the datastore

◆ register_widget_type()

static void icl::qt::GUI::register_widget_type ( const std::string &  tag,
CreatorFunction  f 
)
static

registers a new widget type

The registered widget can then be added using a corresponding extension of the GUIComponent class

◆ registerCallback() [1/2]

void icl::qt::GUI::registerCallback ( const Callback cb,
const std::string &  handleNamesList,
char  listDelim = ',' 
)

registers a callback function on each component

Parameters
cbcallback to execute
handleNamesList'listDelim'-separated list of handle names
listDelimdelimiter for the handle list ownership is passed to the childrens; deletion is performed by the smart pointers that are used...

◆ registerCallback() [2/2]

void icl::qt::GUI::registerCallback ( const ComplexCallback cb,
const std::string &  handleNamesList,
char  listDelim = ',' 
)

registeres a complex callback at a given GUI component

complex callbacks are called with the actual GUI components handle name as parameter

◆ release()

template<class T >
void icl::qt::GUI::release ( const std::string &  id)
inline

wraps the datastores release function

◆ removeCallbacks()

void icl::qt::GUI::removeCallbacks ( const std::string &  handleNamesList,
char  listDelim = ',' 
)

removes all callbacks from components

◆ show()

virtual void icl::qt::GUI::show ( )
virtual

internally creates everything (and makes the gui visible)

◆ switchVisibility()

virtual void icl::qt::GUI::switchVisibility ( )
virtual

if widget is visible, this hides the widget, otherwise the widget is shown

◆ to_string_recursive()

static void icl::qt::GUI::to_string_recursive ( const GUI gui,
std::ostream &  str,
int  level 
)
staticprivate

◆ unlockData()

void icl::qt::GUI::unlockData ( )
inline

internally unlocks the data store

◆ waitForCreation()

void icl::qt::GUI::waitForCreation ( )

waits for the gui to be created completely

Member Data Documentation

◆ CELLH

const int icl::qt::GUI::CELLH = 20
static

cell height (all sizes are given in this unit)

◆ CELLW

const int icl::qt::GUI::CELLW = 20
static

cell width (all sizes are given in this unit)

◆ m_bCreated

bool icl::qt::GUI::m_bCreated
private

◆ m_children

std::vector<GUI*> icl::qt::GUI::m_children
private

◆ m_oDataStore

DataStore icl::qt::GUI::m_oDataStore
private

◆ m_poParent

QWidget* icl::qt::GUI::m_poParent
private

◆ m_poWidget

GUIWidget* icl::qt::GUI::m_poWidget
private

◆ m_sDefinition

std::string icl::qt::GUI::m_sDefinition
private

own definition string


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