kexi

kexiflowlayout.h

00001 /* This file is part of the KDE project
00002    Copyright (C) 2005 Cedric Pasteur <cedric.pasteur@free.fr>
00003 
00004    This library is free software; you can redistribute it and/or
00005    modify it under the terms of the GNU Library General Public
00006    License as published by the Free Software Foundation; either
00007    version 2 of the License, or (at your option) any later version.
00008 
00009    This library is distributed in the hope that it will be useful,
00010    but WITHOUT ANY WARRANTY; without even the implied warranty of
00011    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00012    Library General Public License for more details.
00013 
00014    You should have received a copy of the GNU Library General Public License
00015    along with this library; see the file COPYING.LIB.  If not, write to
00016    the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
00017  * Boston, MA 02110-1301, USA.
00018 */
00019 
00020 #ifndef KEXIFLOWLAYOUT_H
00021 #define KEXIFLOWLAYOUT_H
00022 
00023 #include <qlayout.h>
00024 #include <qptrlist.h>
00025 
00027 class KEXIGUIUTILS_EXPORT KexiFlowLayout : public QLayout
00028 {
00029     public:
00030         KexiFlowLayout(QWidget *parent, int border=0, int space=-1, const char *name=0);
00031         KexiFlowLayout(QLayout* parent, int space=-1, const char *name=0);
00032         KexiFlowLayout(int space=-1, const char *name=0);
00033 
00034         ~KexiFlowLayout();
00035 
00038         QPtrList<QWidget>* widgetList() const;
00039 
00041         void  setOrientation(Orientation orientation) { m_orientation = orientation; }
00042 
00044         Qt::Orientation orientation() const { return m_orientation; }
00045 
00046         void setJustified(bool justify) { m_justify = justify; }
00047         bool isJustified() const { return m_justify; }
00048 
00049         virtual void addItem(QLayoutItem *item);
00050         virtual void addSpacing(int size);
00051         virtual QLayoutIterator iterator();
00052         virtual void  invalidate();
00053 
00054         virtual bool hasHeightForWidth() const;
00055         virtual int heightForWidth(int width) const;
00056         virtual QSize sizeHint() const;
00057         virtual QSize minimumSize() const;
00058         virtual QSizePolicy::ExpandData expanding() const;
00059 
00060         virtual bool isEmpty();
00061 
00062     protected:
00063         virtual void setGeometry(const QRect&);
00064         int simulateLayout(const QRect &r);
00065         int doHorizontalLayout(const QRect&, bool testonly = false);
00066         int doVerticalLayout(const QRect&, bool testonly = false);
00067 
00068     private:
00069         QPtrList<QLayoutItem> m_list;
00070         int m_cached_width;
00071         int m_cached_hfw;
00072         bool m_justify;
00073         Orientation m_orientation;
00074         QSize m_cached_sizeHint;
00075         QSize m_cached_minSize;
00076 };
00077 
00078 #endif
00079 
KDE Home | KDE Accessibility Home | Description of Access Keys