Image Component Library (ICL)
GUIWidget.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/GUIWidget.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 <QWidget>
34 #include <ICLUtils/Size.h>
35 #include <ICLQt/GUI.h>
36 #include <ICLUtils/Uncopyable.h>
37 
39 class QGridLayout;
40 class QLayout;
44 namespace icl{
45  namespace qt{
47  class GUIDefinition;
48  class ProxyLayout;
51  class ICLQt_API GUIWidget : public QWidget, public utils::Uncopyable{
53  Q_OBJECT;
54  public:
55  enum layoutType{
56  noLayout, // do not call setLayout(..)
57  hboxLayout, // use a QHBoxLayout
58  vboxLayout, // use a QVBoxLayout
59  gridLayout // use the default GridLayout
60  };
61 
63 
69  GUIWidget(const GUIDefinition &def,
70  int minParamCount,
71  int maxParamCount=-1,
72  layoutType lt=gridLayout,
73  const utils::Size &defMinSize=utils::Size(0,0));
74 
75 
77  virtual ~GUIWidget();
78 
79  public Q_SLOTS:
81 
84  void ioSlot();
85 
87 
88  void addToGrid(QWidget *c, int x = 0, int y = 0, int width = 1, int height = 1);
89 
91  virtual void processIO(){}
92 
94  virtual QLayout *getGUIWidgetLayout() { return m_poGridLayout ? (QLayout*)m_poGridLayout : m_poOtherLayout; }
95 
97  virtual ProxyLayout *getProxyLayout() { return 0; }
98 
100  GUI *getGUI(){ return m_poGUI; }
101 
104  m_vecCallbacks.push_back(cb);
105  }
108  m_vecComplexCallbacks.push_back(cb);
109  }
112  m_vecCallbacks.clear();
113  m_vecComplexCallbacks.clear();
114  }
115 
117 
120  void cb();
121 
123  virtual QSize sizeHint() const;
124 
125  private:
127  QGridLayout *m_poGridLayout;
128  QLayout *m_poOtherLayout;
130  std::string *m_handle;
131  std::vector<GUI::Callback> m_vecCallbacks;
132  std::vector<GUI::ComplexCallback> m_vecComplexCallbacks;
134  };
135  } // namespace qt
136 }
The General Function Template.
Definition: Function.h:284
undocument this line if you encounter any issues!
Definition: Any.h:37
Utilty class to simplify creation of GUI components.
Definition: GUIDefinition.h:52
Main Class of ICL's GUI creation framework.
Definition: GUI.h:60
GUI * m_poGUI
Definition: GUIWidget.h:129
Definition: GUIWidget.h:58
GUI * getGUI()
returns the underlying GUI structure
Definition: GUIWidget.h:100
std::vector< GUI::ComplexCallback > m_vecComplexCallbacks
Definition: GUIWidget.h:132
void removeCallbacks()
remove all callbacks from this widget
Definition: GUIWidget.h:111
virtual QLayout * getGUIWidgetLayout()
this function must be reimplemented for other layouts the hbox, vbox or grid
Definition: GUIWidget.h:94
virtual ProxyLayout * getProxyLayout()
this shall help to add containes that dont work with layouts (such as tab-widgets)
Definition: GUIWidget.h:97
std::vector< GUI::Callback > m_vecCallbacks
Definition: GUIWidget.h:131
Definition: GUIWidget.h:56
QLayout * m_poOtherLayout
Definition: GUIWidget.h:128
void registerCallback(const GUI::Callback &cb)
registers a callback on this gui widget
Definition: GUIWidget.h:103
just a helper class for GUI Layouting
Definition: ProxyLayout.h:43
std::string * m_handle
Definition: GUIWidget.h:130
QGridLayout * m_poGridLayout
initial layout managers
Definition: GUIWidget.h:127
Size class of the ICL.
Definition: Size.h:61
virtual void processIO()
virtual function which must be implemented for a components custom "new-data"-event
Definition: GUIWidget.h:91
Abstract class for GUI components.
Definition: GUIWidget.h:52
utils::Size m_preferredSize
Definition: GUIWidget.h:133
#define ICLQt_API
Definition: CompatMacros.h:178
void registerCallback(const GUI::ComplexCallback &cb)
registers a callback on this gui widget
Definition: GUIWidget.h:107
Definition: GUIWidget.h:57
layoutType
Definition: GUIWidget.h:55