casa  5.7.0-16
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
QtLayout.h
Go to the documentation of this file.
1 //# QtLayout.h: Qt definition of the flow-layout and borderlayout.
2 //# Copyright (C) 2005
3 //# Associated Universities, Inc. Washington DC, USA.
4 //#
5 //# This library is free software; you can redistribute it and/or modify it
6 //# under the terms of the GNU Library General Public License as published by
7 //# the Free Software Foundation; either version 2 of the License, or (at your
8 //# option) any later version.
9 //#
10 //# This library is distributed in the hope that it will be useful, but WITHOUT
11 //# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
12 //# FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public
13 //# License for more details.
14 //#
15 //# You should have received a copy of the GNU Library General Public License
16 //# along with this library; if not, write to the Free Software Foundation,
17 //# Inc., 675 Massachusetts Ave, Cambridge, MA 02139, USA.
18 //#
19 //# Correspondence concerning AIPS++ should be addressed as follows:
20 //# Internet email: aips2-request@nrao.edu.
21 //# Postal address: AIPS++ Project Office
22 //# National Radio Astronomy Observatory
23 //# 520 Edgemont Road
24 //# Charlottesville, VA 22903-2475 USA
25 //#
26 //# $Id$
27 
28 
29 #ifndef QTFLOWLAYOUT_H
30 #define QTFLOWLAYOUT_H
31 
32 #include <casa/aips.h>
33 
34 #include <graphics/X11/X_enter.h>
35 # include <QLayout>
36 # include <QRect>
37 # include <QWidgetItem>
38 #include <graphics/X11/X_exit.h>
39 
40 
41 namespace casa { //# NAMESPACE CASA - BEGIN
42 
43 
44 
45  class QtFlowLayout : public QLayout {
46  public:
47  QtFlowLayout(QWidget *parent, int margin = 0, int spacing = -1);
48  QtFlowLayout(int spacing = -1);
49  ~QtFlowLayout();
50 
51  void addItem(QLayoutItem *item);
52  Qt::Orientations expandingDirections() const;
53  bool hasHeightForWidth() const;
54  int heightForWidth(int) const;
55  int count() const;
56  QLayoutItem *itemAt(int index) const;
57  QSize minimumSize() const;
58  void setGeometry(const QRect &rect);
59  QSize sizeHint() const;
60  QLayoutItem *takeAt(int index);
61 
62  private:
63  int doLayout(const QRect &rect, bool testOnly) const;
64 
65  QList<QLayoutItem *> itemList;
66  };
67 
68 
69  class QtBorderLayout : public QLayout {
70  public:
72 
73  QtBorderLayout(QWidget *parent, int margin = 0, int spacing = -1);
74  QtBorderLayout(int spacing = -1);
76 
77  void addItem(QLayoutItem *item);
78  void addWidget(QWidget *widget, Position position);
79  Qt::Orientations expandingDirections() const;
80  bool hasHeightForWidth() const;
81  int count() const;
82  QLayoutItem *itemAt(int index) const;
83  QSize minimumSize() const;
84  void setGeometry(const QRect &rect);
85  QSize sizeHint() const;
86  QLayoutItem *takeAt(int index);
87 
88  void add(QLayoutItem *item, Position position);
89 
90  private:
91  struct ItemWrapper {
92  ItemWrapper(QLayoutItem *i, Position p) {
93  item = i;
94  position = p;
95  }
96 
97  QLayoutItem *item;
99  };
100 
102  QSize calculateSize(SizeType sizeType) const;
103 
104  QList<ItemWrapper *> list;
105  };
106 
107 } //# NAMESPACE CASA - END
108 
109 #endif
QList< QLayoutItem * > itemList
Definition: QtLayout.h:65
Qt::Orientations expandingDirections() const
void add(QLayoutItem *item, Position position)
void addItem(QLayoutItem *item)
QList< ItemWrapper * > list
Definition: QtLayout.h:104
void setGeometry(const QRect &rect)
void addWidget(QWidget *widget, Position position)
int count() const
QSize minimumSize() const
QLayoutItem * takeAt(int index)
Qt::Orientations expandingDirections() const
int heightForWidth(int) const
QSize sizeHint() const
bool hasHeightForWidth() const
QtFlowLayout(QWidget *parent, int margin=0, int spacing=-1)
QLayoutItem * takeAt(int index)
void addItem(QLayoutItem *item)
QLayoutItem * itemAt(int index) const
QtBorderLayout(QWidget *parent, int margin=0, int spacing=-1)
int count() const
bool hasHeightForWidth() const
QSize calculateSize(SizeType sizeType) const
QSize sizeHint() const
QLayoutItem * itemAt(int index) const
ItemWrapper(QLayoutItem *i, Position p)
Definition: QtLayout.h:92
QSize minimumSize() const
int doLayout(const QRect &rect, bool testOnly) const
void setGeometry(const QRect &rect)