| 1 | /****************************************************************************
|
|---|
| 2 | ** $Id: flow.h 2 2005-11-16 15:49:26Z dmik $
|
|---|
| 3 | **
|
|---|
| 4 | ** Definition of simple flow layout for custom layout example
|
|---|
| 5 | **
|
|---|
| 6 | ** Created : 979899
|
|---|
| 7 | **
|
|---|
| 8 | ** Copyright (C) 1997 by Trolltech AS. All rights reserved.
|
|---|
| 9 | **
|
|---|
| 10 | ** This file is part of an example program for Qt. This example
|
|---|
| 11 | ** program may be used, distributed and modified without limitation.
|
|---|
| 12 | **
|
|---|
| 13 | *****************************************************************************/
|
|---|
| 14 |
|
|---|
| 15 | #ifndef FLOW_H
|
|---|
| 16 | #define FLOW_H
|
|---|
| 17 |
|
|---|
| 18 | #include <qlayout.h>
|
|---|
| 19 | #include <qptrlist.h>
|
|---|
| 20 |
|
|---|
| 21 | class SimpleFlow : public QLayout
|
|---|
| 22 | {
|
|---|
| 23 | public:
|
|---|
| 24 | SimpleFlow( QWidget *parent, int border=0, int space=-1,
|
|---|
| 25 | const char *name=0 )
|
|---|
| 26 | : QLayout( parent, border, space, name ),
|
|---|
| 27 | cached_width(0) {}
|
|---|
| 28 | SimpleFlow( QLayout* parent, int space=-1, const char *name=0 )
|
|---|
| 29 | : QLayout( parent, space, name ),
|
|---|
| 30 | cached_width(0) {}
|
|---|
| 31 | SimpleFlow( int space=-1, const char *name=0 )
|
|---|
| 32 | : QLayout( space, name ),
|
|---|
| 33 | cached_width(0) {}
|
|---|
| 34 |
|
|---|
| 35 | ~SimpleFlow();
|
|---|
| 36 |
|
|---|
| 37 | void addItem( QLayoutItem *item);
|
|---|
| 38 | bool hasHeightForWidth() const;
|
|---|
| 39 | int heightForWidth( int ) const;
|
|---|
| 40 | QSize sizeHint() const;
|
|---|
| 41 | QSize minimumSize() const;
|
|---|
| 42 | QLayoutIterator iterator();
|
|---|
| 43 | QSizePolicy::ExpandData expanding() const;
|
|---|
| 44 |
|
|---|
| 45 | protected:
|
|---|
| 46 | void setGeometry( const QRect& );
|
|---|
| 47 |
|
|---|
| 48 | private:
|
|---|
| 49 | int doLayout( const QRect&, bool testonly = FALSE );
|
|---|
| 50 | QPtrList<QLayoutItem> list;
|
|---|
| 51 | int cached_width;
|
|---|
| 52 | int cached_hfw;
|
|---|
| 53 |
|
|---|
| 54 | };
|
|---|
| 55 |
|
|---|
| 56 | #endif
|
|---|