Main Page | Class Hierarchy | Alphabetical List | Class List | File List | Class Members | File Members | Related Pages

# 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 #include "qwt_array.h"
    00016 #include <qvaluelist.h>
    00017 #include "qwt_global.h"
    00018
    00019 class QwtDynGridLayoutPrivate;
    00020
    00030 class QWT_EXPORT QwtDynGridLayout : public QLayout
    00031 {
    00032     Q_OBJECT
    00033 public:
    00034     QwtDynGridLayout(QWidget *, int margin=0,
    00035         int space=-1, const char *name = 0);
    00036     QwtDynGridLayout(QLayout *, int space=-1, const char * name = 0 );
    00037     QwtDynGridLayout(int space=-1, const char * name=0 );
    00038
    00039     virtual ~QwtDynGridLayout();
    00040
    00041     virtual void invalidate();
    00042
    00043     void setMaxCols(uint maxCols);
    00044     uint maxCols() const;
    00045
    00046     uint numRows () const;
    00047     uint numCols () const;
    00048
    00049     virtual void addItem(QLayoutItem *);
    00050     virtual QLayoutIterator iterator();
    00051
    00052     virtual int maxItemWidth() const;
    00053
    00054     virtual void setGeometry(const QRect &rect);
    00055
    00056     virtual bool hasHeightForWidth() const;
    00057     virtual int heightForWidth(int) const;
    00058
    00059     virtual QSize sizeHint() const;
    00060
    00061     void setExpanding(QSizePolicy::ExpandData);
    00062     virtual QSizePolicy::ExpandData expanding() const;
    00063
    00064     virtual bool isEmpty() const;
    00065     uint itemCount() const;
    00066
    00067     virtual uint columnsForWidth(int width) const;
    00068
    00069     QValueList<QRect> layoutItems(const QRect &, uint numCols) const;
    00070
    00071 protected:
    00072
    00073     void layoutGrid(uint numCols,
    00074             QwtArray<int>& rowHeight, QwtArray<int>& colWidth) const;
    00075     void stretchGrid(const QRect &rect, uint numCols,
    00076         QwtArray<int>& rowHeight, QwtArray<int>& colWidth) const;
    00077
    00078
    00079 private:
    00080     void init();
    00081     int maxRowWidth(int numCols) const;
    00082     void updateLayoutCache();
    00083
    00084     uint d_maxCols;
    00085     uint d_numRows;
    00086     uint d_numCols;
    00087
    00088     QSizePolicy::ExpandData d_expanding;
    00089     QwtDynGridLayoutPrivate *d_layoutData;
    00090 };
    00091
    00092 #endif
    00093
    00094 // Local Variables:
    00095 // mode: C++
    00096 // c-file-style: "stroustrup"
    00097 // indent-tabs-mode: nil
    00098 // End: