- Main Page
- Related Pages
- Classes
- Files

- File List

# qwt_dyngrid_layout.h

    00001 /* -*- mode: C++ ; c-file-style: "stroustrup" -*- *****************************
    00002  * Qwt Widget Library
    00003  * Copyright (C) 1997   Josef Wilgen
    00004  * Copyright (C) 2002   Uwe Rathmann
    00005  *
    00006  * This library is free software; you can redistribute it and/or
    00007  * modify it under the terms of the Qwt License, Version 1.0
    00008  *****************************************************************************/
    00009
    00010 #ifndef QWT_DYNGRID_LAYOUT_H
    00011 #define QWT_DYNGRID_LAYOUT_H
    00012
    00013 #include <qlayout.h>
    00014 #include <qsize.h>
    00015 #if QT_VERSION >= 0x040000
    00016 #include <qlist.h>
    00017 #else
    00018 #include <qvaluelist.h>
    00019 #endif
    00020 #include "qwt_global.h"
    00021 #include "qwt_array.h"
    00022
    00032 class QWT_EXPORT QwtDynGridLayout : public QLayout
    00033 {
    00034     Q_OBJECT
    00035 public:
    00036     explicit QwtDynGridLayout(QWidget *, int margin = 0, int space = -1);
    00037 #if QT_VERSION < 0x040000
    00038     explicit QwtDynGridLayout(QLayout *, int space = -1);
    00039 #endif
    00040     explicit QwtDynGridLayout(int space = -1);
    00041
    00042     virtual ~QwtDynGridLayout();
    00043
    00044     virtual void invalidate();
    00045
    00046     void setMaxCols(uint maxCols);
    00047     uint maxCols() const;
    00048
    00049     uint numRows () const;
    00050     uint numCols () const;
    00051
    00052     virtual void addItem(QLayoutItem *);
    00053
    00054 #if QT_VERSION >= 0x040000
    00055     virtual QLayoutItem *itemAt( int index ) const;
    00056     virtual QLayoutItem *takeAt( int index );
    00057     virtual int count() const;
    00058
    00059     void setExpandingDirections(Qt::Orientations);
    00060     virtual Qt::Orientations expandingDirections() const;
    00061     QList<QRect> layoutItems(const QRect &, uint numCols) const;
    00062 #else
    00063     virtual QLayoutIterator iterator();
    00064
    00065     void setExpanding(QSizePolicy::ExpandData);
    00066     virtual QSizePolicy::ExpandData expanding() const;
    00067     QValueList<QRect> layoutItems(const QRect &, uint numCols) const;
    00068 #endif
    00069
    00070     virtual int maxItemWidth() const;
    00071
    00072     virtual void setGeometry(const QRect &rect);
    00073
    00074     virtual bool hasHeightForWidth() const;
    00075     virtual int heightForWidth(int) const;
    00076
    00077     virtual QSize sizeHint() const;
    00078
    00079     virtual bool isEmpty() const;
    00080     uint itemCount() const;
    00081
    00082     virtual uint columnsForWidth(int width) const;
    00083
    00084 protected:
    00085
    00086     void layoutGrid(uint numCols,
    00087         QwtArray<int>& rowHeight, QwtArray<int>& colWidth) const;
    00088     void stretchGrid(const QRect &rect, uint numCols,
    00089         QwtArray<int>& rowHeight, QwtArray<int>& colWidth) const;
    00090
    00091
    00092 private:
    00093     void init();
    00094     int maxRowWidth(int numCols) const;
    00095     void updateLayoutCache();
    00096
    00097 #if QT_VERSION < 0x040000
    00098 // xlC 5.1, the IBM/AIX C++ compiler, needs it to be public
    00099 public:
    00100 #endif
    00101    class PrivateData;
    00102
    00103 private:
    00104     PrivateData *d_data;
    00105 };
    00106
    00107 #endif