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 
00026 class KEXIGUIUTILS_EXPORT KexiFlowLayout : public QLayout
00027 {
00028     public:
00029         KexiFlowLayout(QWidget *parent, int border=0, int space=-1, const char *name=0);
00030         KexiFlowLayout(QLayout* parent, int space=-1, const char *name=0);
00031         KexiFlowLayout(int space=-1, const char *name=0);
00032 
00033         ~KexiFlowLayout();
00034 
00037         QPtrList<QWidget>* widgetList() const;
00038 
00040         void  setOrientation(Orientation orientation) { m_orientation = orientation; }
00041 
00043         Qt::Orientation orientation() const { return m_orientation; }
00044 
00045         void setJustified(bool justify) { m_justify = justify; }
00046         bool isJustified() const { return m_justify; }
00047 
00048         virtual void addItem(QLayoutItem *item);
00049         virtual void addSpacing(int size);
00050         virtual QLayoutIterator iterator();
00051         virtual void  invalidate();
00052 
00053         virtual bool hasHeightForWidth() const;
00054         virtual int heightForWidth(int width) const;
00055         virtual QSize sizeHint() const;
00056         virtual QSize minimumSize() const;
00057         virtual QSizePolicy::ExpandData expanding() const;
00058 
00059         virtual bool isEmpty();
00060 
00061     protected:
00062         virtual void setGeometry(const QRect&);
00063         int simulateLayout(const QRect &r);
00064         int doHorizontalLayout(const QRect&, bool testonly = false);
00065         int doVerticalLayout(const QRect&, bool testonly = false);
00066 
00067     private:
00068         QPtrList<QLayoutItem> m_list;
00069         int m_cached_width;
00070         int m_cached_hfw;
00071         bool m_justify;
00072         Orientation m_orientation;
00073         QSize m_cached_sizeHint;
00074         QSize m_cached_minSize;
00075 };
00076 
00077 #endif
00078 
KDE Home | KDE Accessibility Home | Description of Access Keys