Image Component Library (ICL)
ContainerGUIComponent.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/ContainerGUIComponent.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/GUI.h>
35 
36 namespace icl{
37  namespace qt{
39 
44  struct ContainerGUIComponent : public GUI{
45  protected:
47 
50 
52  ContainerGUIComponent(const std::string &type, const std::string &params, QWidget *parent):
53  GUI(type+'('+params+')',parent), component(type, params){}
54 
55  public:
56 
59  return const_cast<GUI*>(static_cast<const GUI*>(this))->operator<<(component);
60  }
61 
63  GUI &operator<<(const GUI &g) const{
64  return const_cast<GUI*>(static_cast<const GUI*>(this))->operator<<(g);
65  }
66 
68  const ContainerGUIComponent &handle(const std::string &handle) const{
69  component.handle(handle); return *this;
70  }
71 
73  const ContainerGUIComponent &label(const std::string &label) const{
74  component.label(label); return *this;
75  }
76 
78  const ContainerGUIComponent &size(const utils::Size &size) const {
79  component.size(size); return *this;
80  }
81 
83  const ContainerGUIComponent &size(int w, int h) const {
84  return size(utils::Size(w,h));
85  }
86 
89  component.minSize(minSize); return *this;
90  }
91 
93  const ContainerGUIComponent &minSize(int w, int h) const {
94  return minSize(utils::Size(w,h));
95  }
96 
99  component.maxSize(maxSize); return *this;
100  }
101 
103  const ContainerGUIComponent &maxSize(int w, int h) const {
104  return maxSize(utils::Size(w,h));
105  }
106 
109  component.m_options.margin = margin; return *this;
110  }
111 
114  component.m_options.spacing = spacing; return *this;
115  }
116 
118  ContainerGUIComponent &handle(const std::string &handle){
119  component.handle(handle); return *this;
120  }
121 
123  ContainerGUIComponent &label(const std::string &label){
124  component.label(label); return *this;
125  }
126 
129  component.size(size); return *this;
130  }
131 
133  ContainerGUIComponent &size(int w, int h){
134  return size(utils::Size(w,h));
135  }
136 
139  component.minSize(minSize); return *this;
140  }
141 
144  return minSize(utils::Size(w,h));
145  }
146 
149  component.maxSize(maxSize); return *this;
150  }
151 
154  return maxSize(utils::Size(w,h));
155  }
156 
159  component.m_options.margin = margin; return *this;
160  }
161 
164  component.m_options.spacing = spacing; return *this;
165  }
166 
167  protected:
169  virtual std::string createDefinition() const { return component.toString(); }
170  };
171 
172 
173 
174  } // namespace qt
175 } // namespace icl
176 
177 
ContainerGUIComponent & maxSize(int w, int h)
sets the component's maximum size constraint
Definition: ContainerGUIComponent.h:153
ContainerGUIComponent & maxSize(const utils::Size &maxSize)
sets the component's maximum size constraint
Definition: ContainerGUIComponent.h:148
const ContainerGUIComponent & size(int w, int h) const
sets the component's initial size
Definition: ContainerGUIComponent.h:83
const GUIComponent & size(const utils::Size &size) const
sets the component initial size
Definition: GUIComponent.h:136
Special GUI extension, that mimics the GUIComponent interface.
Definition: ContainerGUIComponent.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
ContainerGUIComponent & spacing(int spacing)
sets the component's layout spacing
Definition: ContainerGUIComponent.h:163
const GUIComponent & handle(const std::string &handle) const
sets the component handle
Definition: GUIComponent.h:118
const GUIComponent & minSize(const utils::Size &minSize) const
sets the component minimum size constraint
Definition: GUIComponent.h:147
const ContainerGUIComponent & maxSize(const utils::Size &maxSize) const
sets the component's maximum size constraint
Definition: ContainerGUIComponent.h:98
ContainerGUIComponent & margin(int margin)
sets the component's layout margin
Definition: ContainerGUIComponent.h:158
GUIComponent component
we use these options to create the
Definition: ContainerGUIComponent.h:49
virtual std::string createDefinition() const
special reimplementation of the GUI::createDefinition method
Definition: ContainerGUIComponent.h:169
const GUIComponent & maxSize(const utils::Size &maxSize) const
sets the component maximum size constraint
Definition: GUIComponent.h:158
const ContainerGUIComponent & margin(int margin) const
sets the component's layout margin
Definition: ContainerGUIComponent.h:108
ContainerGUIComponent & size(int w, int h)
sets the component's initial size
Definition: ContainerGUIComponent.h:133
const ContainerGUIComponent & size(const utils::Size &size) const
sets the component's initial size
Definition: ContainerGUIComponent.h:78
ContainerGUIComponent(const std::string &type, const std::string &params, QWidget *parent)
protected constructor
Definition: ContainerGUIComponent.h:52
int margin
layout margin (only for containers)
Definition: GUIComponent.h:61
ContainerGUIComponent & handle(const std::string &handle)
sets the component's handle
Definition: ContainerGUIComponent.h:118
Size class of the ICL.
Definition: Size.h:61
ContainerGUIComponent & size(const utils::Size &size)
sets the component's initial size
Definition: ContainerGUIComponent.h:128
The GUIComponent class servers as a generic interface for GUI definitions.
Definition: GUIComponent.h:44
const ContainerGUIComponent & maxSize(int w, int h) const
sets the component's maximum size constraint
Definition: ContainerGUIComponent.h:103
ContainerGUIComponent & label(const std::string &label)
sets the component's label
Definition: ContainerGUIComponent.h:123
std::string toString() const
creates a string representation of the component
Definition: GUIComponent.h:247
const ContainerGUIComponent & minSize(int w, int h) const
sets the component's minimum size constraint
Definition: ContainerGUIComponent.h:93
GUI & operator<<(const GUIComponent &component) const
hierarchical stream operator to create complex GUIs
Definition: ContainerGUIComponent.h:58
const ContainerGUIComponent & spacing(int spacing) const
sets the component's layout spacing
Definition: ContainerGUIComponent.h:113
GUI & operator<<(const GUI &g) const
hierarchical stream operator to create complex GUIs
Definition: ContainerGUIComponent.h:63
ContainerGUIComponent & minSize(int w, int h)
sets the component's minimum size constraint
Definition: ContainerGUIComponent.h:143
Options m_options
all component options (mutable for C++-reasons)
Definition: GUIComponent.h:71
const ContainerGUIComponent & minSize(const utils::Size &minSize) const
sets the component's minimum size constraint
Definition: ContainerGUIComponent.h:88
const GUIComponent & label(const std::string &label) const
sets the component label
Definition: GUIComponent.h:124
ContainerGUIComponent & minSize(const utils::Size &minSize)
sets the component's minimum size constraint
Definition: ContainerGUIComponent.h:138
const ContainerGUIComponent & label(const std::string &label) const
sets the component's label
Definition: ContainerGUIComponent.h:73
int spacing
layout spacing (onyl for containers)
Definition: GUIComponent.h:62
const ContainerGUIComponent & handle(const std::string &handle) const
sets the component's handle
Definition: ContainerGUIComponent.h:68