QtLayout.h

Go to the documentation of this file.
00001 //# QtLayout.h: Qt definition of the flow-layout and borderlayout.
00002 //# Copyright (C) 2005
00003 //# Associated Universities, Inc. Washington DC, USA.
00004 //#
00005 //# This library is free software; you can redistribute it and/or modify it
00006 //# under the terms of the GNU Library General Public License as published by
00007 //# the Free Software Foundation; either version 2 of the License, or (at your
00008 //# option) any later version.
00009 //#
00010 //# This library is distributed in the hope that it will be useful, but WITHOUT
00011 //# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
00012 //# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Library General Public
00013 //# License for more details.
00014 //#
00015 //# You should have received a copy of the GNU Library General Public License
00016 //# along with this library; if not, write to the Free Software Foundation,
00017 //# Inc., 675 Massachusetts Ave, Cambridge, MA 02139, USA.
00018 //#
00019 //# Correspondence concerning AIPS++ should be addressed as follows:
00020 //#        Internet email: aips2-request@nrao.edu.
00021 //#        Postal address: AIPS++ Project Office
00022 //#                        National Radio Astronomy Observatory
00023 //#                        520 Edgemont Road
00024 //#                        Charlottesville, VA 22903-2475 USA
00025 //#
00026 //# $Id$
00027 
00028 
00029 #ifndef QTFLOWLAYOUT_H
00030 #define QTFLOWLAYOUT_H
00031 
00032 #include <casa/aips.h>
00033 
00034 #include <graphics/X11/X_enter.h>
00035 #  include <QLayout>
00036 #  include <QRect>
00037 #  include <QWidgetItem>
00038 #include <graphics/X11/X_exit.h>
00039 
00040 
00041 namespace casa { //# NAMESPACE CASA - BEGIN
00042 
00043 
00044 
00045         class QtFlowLayout : public QLayout {
00046         public:
00047                 QtFlowLayout(QWidget *parent, int margin = 0, int spacing = -1);
00048                 QtFlowLayout(int spacing = -1);
00049                 ~QtFlowLayout();
00050 
00051                 void addItem(QLayoutItem *item);
00052                 Qt::Orientations expandingDirections() const;
00053                 bool hasHeightForWidth() const;
00054                 int heightForWidth(int) const;
00055                 int count() const;
00056                 QLayoutItem *itemAt(int index) const;
00057                 QSize minimumSize() const;
00058                 void setGeometry(const QRect &rect);
00059                 QSize sizeHint() const;
00060                 QLayoutItem *takeAt(int index);
00061 
00062         private:
00063                 int doLayout(const QRect &rect, bool testOnly) const;
00064 
00065                 QList<QLayoutItem *> itemList;
00066         };
00067 
00068 
00069         class QtBorderLayout : public QLayout {
00070         public:
00071                 enum Position { West, North, South, East, Center };
00072 
00073                 QtBorderLayout(QWidget *parent, int margin = 0, int spacing = -1);
00074                 QtBorderLayout(int spacing = -1);
00075                 ~QtBorderLayout();
00076 
00077                 void addItem(QLayoutItem *item);
00078                 void addWidget(QWidget *widget, Position position);
00079                 Qt::Orientations expandingDirections() const;
00080                 bool hasHeightForWidth() const;
00081                 int count() const;
00082                 QLayoutItem *itemAt(int index) const;
00083                 QSize minimumSize() const;
00084                 void setGeometry(const QRect &rect);
00085                 QSize sizeHint() const;
00086                 QLayoutItem *takeAt(int index);
00087 
00088                 void add(QLayoutItem *item, Position position);
00089 
00090         private:
00091                 struct ItemWrapper {
00092                         ItemWrapper(QLayoutItem *i, Position p) {
00093                                 item = i;
00094                                 position = p;
00095                         }
00096 
00097                         QLayoutItem *item;
00098                         Position position;
00099                 };
00100 
00101                 enum SizeType { MinimumSize, SizeHint };
00102                 QSize calculateSize(SizeType sizeType) const;
00103 
00104                 QList<ItemWrapper *> list;
00105         };
00106 
00107 } //# NAMESPACE CASA - END
00108 
00109 #endif
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines

Generated on 31 Aug 2016 for casa by  doxygen 1.6.1