Image Component Library (ICL)
GUIHandleBase.h
Go to the documentation of this file.
1 /********************************************************************
2 ** Image Component Library (ICL) **
3 ** **
4 ** Copyright (C) 2006-2013 CITEC, University of Bielefeld **
5 ** Neuroinformatics Group **
6 ** Website: www.iclcv.org and **
7 ** http://opensource.cit-ec.de/projects/icl **
8 ** **
9 ** File : ICLQt/src/ICLQt/GUIHandleBase.h **
10 ** Module : ICLQt **
11 ** Authors: Christof Elbrechter **
12 ** **
13 ** **
14 ** GNU LESSER GENERAL PUBLIC LICENSE **
15 ** This file may be used under the terms of the GNU Lesser General **
16 ** Public License version 3.0 as published by the **
17 ** **
18 ** Free Software Foundation and appearing in the file LICENSE.LGPL **
19 ** included in the packaging of this file. Please review the **
20 ** following information to ensure the license requirements will **
21 ** be met: http://www.gnu.org/licenses/lgpl-3.0.txt **
22 ** **
23 ** The development of this software was supported by the **
24 ** Excellence Cluster EXC 277 Cognitive Interaction Technology. **
25 ** The Excellence Cluster EXC 277 is a grant of the Deutsche **
26 ** Forschungsgemeinschaft (DFG) in the context of the German **
27 ** Excellence Initiative. **
28 ** **
29 ********************************************************************/
30 
31 #pragma once
32 
33 #include <ICLUtils/CompatMacros.h>
34 #include <ICLQt/GUIWidget.h>
35 
36 namespace icl{
37  namespace qt{
38 
41 
42  protected:
45 
46  public:
47 
49  virtual ~GUIHandleBase(){}
50 
52  friend class icl::qt::GUI;
53  friend class icl::qt::DataStore;
54  friend class icl::utils::MultiTypeMap;
59  return m_poGUIWidget;
60  }
61 
63 
73  virtual void registerCallback(const GUI::Callback &cb, const std::string &events="all"){
74  (void)events;
75  if(m_poGUIWidget){
77  }else{
78  ERROR_LOG("unable to register a callback function on a null handle");
79  }
80  }
81 
83  virtual void registerCallback(const GUI::ComplexCallback &cb, const std::string &events="all"){
84  (void)events;
85  if(m_poGUIWidget){
87  }else{
88  ERROR_LOG("unable to register a callback function on a null handle");
89  }
90  }
91 
93  virtual void removeCallbacks(){
94  if(m_poGUIWidget){
96  }else{
97  ERROR_LOG("unable to remove callbacks from a null handle");
98  }
99  }
100 
102  virtual void cb(){
103  if(m_poGUIWidget){
104  m_poGUIWidget->cb();
105  }else{
106  ERROR_LOG("unable to call callbacks on a null handle");
107  }
108  }
109 
110  private:
112  };
113  } // namespace qt
114 }
115 
Extension of the associative container MultiTypeMap.
Definition: DataStore.h:47
GUIHandleBase(GUIWidget *w=0)
create a new GUIHandleBase
Definition: GUIHandleBase.h:44
undocument this line if you encounter any issues!
Definition: Any.h:37
Main Class of ICL's GUI creation framework.
Definition: GUI.h:60
Abstract and associative Data Container for Data of different types.
Definition: MultiTypeMap.h:67
GUIWidget * getGUIWidget()
returns parent GUIWidget pointer
Definition: GUIHandleBase.h:58
void removeCallbacks()
remove all callbacks from this widget
Definition: GUIWidget.h:111
void cb()
Callback execution.
void registerCallback(const GUI::Callback &cb)
registers a callback on this gui widget
Definition: GUIWidget.h:103
virtual ~GUIHandleBase()
virtual destructor
Definition: GUIHandleBase.h:49
virtual void removeCallbacks()
removes all callbacks from parent GUIWidget component
Definition: GUIHandleBase.h:93
virtual void registerCallback(const GUI::Callback &cb, const std::string &events="all")
registers a callback on this gui widget
Definition: GUIHandleBase.h:73
virtual void registerCallback(const GUI::ComplexCallback &cb, const std::string &events="all")
registers a complex callback on this gui component
Definition: GUIHandleBase.h:83
Abstract class for GUI components.
Definition: GUIWidget.h:52
#define ERROR_LOG(x)
Definition: Macros.h:111
Base class for GUIHandles providing functions to register callbacks.
Definition: GUIHandleBase.h:40
virtual void cb()
envokes all registered callbacks
Definition: GUIHandleBase.h:102
GUIWidget * m_poGUIWidget
Definition: GUIHandleBase.h:111