Image Component Library (ICL)
BoxHandle.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/BoxHandle.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/GUIHandle.h>
35 #include <ICLQt/ContainerHandle.h>
36 #include <QWidget>
37 #include <QLayout>
38 
40 class QScrollArea;
43 namespace icl{
44  namespace qt{
45 
47  class BoxHandle : public GUIHandle<QWidget>, public ContainerHandle{
48  bool horizontal;
49  QScrollArea * scroll;
50 
51  public:
53  BoxHandle():horizontal(false),scroll(0){}
54 
56  BoxHandle(bool isHorizontal, QWidget *w, GUIWidget *guiw, QScrollArea *scroll=0):
57  GUIHandle<QWidget>(w,guiw),horizontal(isHorizontal),scroll(scroll){}
58 
60  QLayout *getLayout() { return (**this)->layout(); }
61 
63 
64  virtual void add(QWidget *comp, const QString &name=""){ getLayout()->addWidget(comp); }
65 
67  virtual void insert(int idx, QWidget *comp, const QString &name=""){add(comp,name); }
68 
70  bool hasScroll() const { return scroll; }
71 
73  QScrollArea *getScroll() { return scroll; }
74 
76  bool isHorizontal() const { return horizontal; }
77 
79  bool isVertical() const { return !horizontal; }
80 
81  };
82  } // namespace qt
83 }
84 
QScrollArea * getScroll()
returns the parent scroll area (which is null, if the component is hbox or vbox)
Definition: BoxHandle.h:73
bool horizontal
internal property that indicate the underlying layout orientation
Definition: BoxHandle.h:48
undocument this line if you encounter any issues!
Definition: Any.h:37
virtual void add(QWidget *comp, const QString &name="")
adds an external compnent to the underlying widgets layout
Definition: BoxHandle.h:64
virtual void insert(int idx, QWidget *comp, const QString &name="")
this does not work here (calls add, idx and name is ignored)
Definition: BoxHandle.h:67
A Handle for container GUI components (hbox, vbox, hscroll and vscroll)
Definition: BoxHandle.h:47
BoxHandle(bool isHorizontal, QWidget *w, GUIWidget *guiw, QScrollArea *scroll=0)
create an empty handle
Definition: BoxHandle.h:56
Abstract base class for Handle classes.
Definition: GUIHandle.h:40
bool isHorizontal() const
returns whether the layout orientation is horizontal
Definition: BoxHandle.h:76
Abstract class for GUI components.
Definition: GUIWidget.h:52
BoxHandle()
empty base constructor
Definition: BoxHandle.h:53
QLayout * getLayout()
returns the associated layout
Definition: BoxHandle.h:60
bool hasScroll() const
returns whether this handle has
Definition: BoxHandle.h:70
Base class for Container like GUI handles as Box- or Tab widgets.
Definition: ContainerHandle.h:40
QScrollArea * scroll
optional parent QScrollArea
Definition: BoxHandle.h:49
bool isVertical() const
returns whether the layout orientation is vertical
Definition: BoxHandle.h:79