Image Component Library (ICL)
GUIDefinition.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/GUIDefinition.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 <ICLUtils/Size.h>
35 #include <string>
36 #include <vector>
37 
39 class QLayout;
40 class QWidget;
43 namespace icl{
44  namespace qt{
45 
47  class GUI;
48  class ProxyLayout;
51  class ICLQt_API GUIDefinition{
53  public:
55  GUIDefinition(const std::string &def, GUI *gui,
56  QLayout *parentLayout=0,
57  ProxyLayout *parentProxyLayout=0,
58  QWidget *parentWidget=0);
59 
61  const std::string &type() const { return m_sType; }
62 
64  const std::string &label() const { return m_sLabel; }
65 
67  const std::string &handle() const { return m_sHandle; }
68 
70  const utils::Size &size() const { return m_oSize; }
71 
73  const utils::Size &minSize() const { return m_oMinSize; }
74 
76  const utils::Size &maxSize() const { return m_oMaxSize; }
77 
79  int margin() const { return m_iMargin; }
80 
82  int spacing() const { return m_iSpacing; }
83 
85  GUI *getGUI() const { return m_poGUI; }
86 
88  QLayout *parentLayout() const { return m_poParentLayout; }
89 
91  ProxyLayout *getProxyLayout() const { return m_poParentProxyLayout; }
92 
94  unsigned int numParams() const { return m_vecParams.size(); }
95 
97  const std::string &param(unsigned int idx) const;
98 
100  int intParam(unsigned int idx) const;
101 
103  float floatParam(unsigned int idx) const;
104 
106 
108  const std::string &input(unsigned int idx) const;
109 
111 
113  const std::string &output(unsigned int idx) const;
114 
116  unsigned int numInputs() const { return m_vecInputs.size(); }
117 
119  unsigned int numOutputs() const { return m_vecOutputs.size(); }
120 
122  void show() const;
123 
125  const std::string &defString() const { return m_sDefinitionString; }
126 
128  QWidget *parentWidget() const { return m_poParentWidget; }
129 
131  const std::vector<std::string> &allParams() const { return m_vecParams; }
132 
134  inline const std::string &toolTip() const { return m_toolTip; }
135 
137  inline bool hasToolTip() const { return m_toolTip.length(); }
138 
139  private:
140  std::string m_sDefinitionString; //<! whole definition string
141  std::string m_sType; //<! parsed type string
142  std::vector<std::string> m_vecParams; //<! vector of mandatory params
143  std::vector<std::string> m_vecOutputs; //<! vector of output names
144  std::vector<std::string> m_vecInputs; //<! vector of input names
145  std::string m_sLabel; //<! parsed label (unused this time)
146  std::string m_sHandle; //<! parsed handle id string
147  utils::Size m_oSize; //<! parsed size
148  utils::Size m_oMinSize; //<! parsed minimal size
149  utils::Size m_oMaxSize; //<! parsed maximum size
150  int m_iMargin; //<! parsed layout margin
151  int m_iSpacing; //<! parsed layout spacing
152  GUI *m_poGUI; //<! parent GUI
153  QLayout *m_poParentLayout; //<! parent layout or NULL if there is no parent
154  QWidget *m_poParentWidget; //<! parent widget to avoid reparenting calls
155  ProxyLayout *m_poParentProxyLayout; //<! parent widget proxy layout
156  std::string m_toolTip; //<! optionally given tooltip
157  };
158  } // namespace qt
159 }
160 
unsigned int numInputs() const
returns the number of params
Definition: GUIDefinition.h:116
bool hasToolTip() const
returns whether the tooltip text is not ""
Definition: GUIDefinition.h:137
undocument this line if you encounter any issues!
Definition: Any.h:37
utils::Size m_oSize
Definition: GUIDefinition.h:147
const std::string & toolTip() const
returns the tooltip text
Definition: GUIDefinition.h:134
utils::Size m_oMinSize
Definition: GUIDefinition.h:148
Main Class of ICL's GUI creation framework.
Definition: GUI.h:60
const std::string & defString() const
returns the whole definition string (for debugging!)
Definition: GUIDefinition.h:125
std::vector< std::string > m_vecOutputs
Definition: GUIDefinition.h:143
int m_iSpacing
Definition: GUIDefinition.h:151
utils::Size m_oMaxSize
Definition: GUIDefinition.h:149
int m_iMargin
Definition: GUIDefinition.h:150
std::string m_toolTip
Definition: GUIDefinition.h:156
ProxyLayout * getProxyLayout() const
returns the parent widgets proxy layout
Definition: GUIDefinition.h:91
std::vector< std::string > m_vecParams
Definition: GUIDefinition.h:142
const std::string & handle() const
return the handle id string
Definition: GUIDefinition.h:67
const std::string & label() const
return the lable string
Definition: GUIDefinition.h:64
GUI * m_poGUI
Definition: GUIDefinition.h:152
std::string m_sType
Definition: GUIDefinition.h:141
just a helper class for GUI Layouting
Definition: ProxyLayout.h:43
int margin() const
returns the layout margin
Definition: GUIDefinition.h:79
int spacing() const
returns the layout spacing
Definition: GUIDefinition.h:82
const std::string & type() const
return the type string
Definition: GUIDefinition.h:61
GUI * getGUI() const
return the parent GUI
Definition: GUIDefinition.h:85
const utils::Size & maxSize() const
returns the maxinum size of the widget or size::null
Definition: GUIDefinition.h:76
QWidget * m_poParentWidget
Definition: GUIDefinition.h:154
Size class of the ICL.
Definition: Size.h:61
QWidget * parentWidget() const
returns the current parent widget (or 0 if there is non)
Definition: GUIDefinition.h:128
std::string m_sHandle
Definition: GUIDefinition.h:146
const utils::Size & minSize() const
retunrs the minimum size of the widget or size::null
Definition: GUIDefinition.h:73
const std::vector< std::string > & allParams() const
returns a list of all parameters
Definition: GUIDefinition.h:131
unsigned int numOutputs() const
returns the number of params
Definition: GUIDefinition.h:119
const utils::Size & size() const
return this size (or utils::Size::null)
Definition: GUIDefinition.h:70
#define ICLQt_API
Definition: CompatMacros.h:178
std::vector< std::string > m_vecInputs
Definition: GUIDefinition.h:144
std::string m_sLabel
Definition: GUIDefinition.h:145
QLayout * parentLayout() const
return the parent layout or null if there is nor parent
Definition: GUIDefinition.h:88
QLayout * m_poParentLayout
Definition: GUIDefinition.h:153
ProxyLayout * m_poParentProxyLayout
Definition: GUIDefinition.h:155
ICLQt_API void show(const icl::core::ImgBase &image)
shows an image using TestImages::show
unsigned int numParams() const
returns the number of params
Definition: GUIDefinition.h:94
std::string m_sDefinitionString
Definition: GUIDefinition.h:140