# 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 "qwt_global.h"
    00014 #include <qlayout.h>
    00015 #include <qsize.h>
    00016 #include <qlist.h>
    00017
    00027 class QWT_EXPORT QwtDynGridLayout : public QLayout
    00028 {
    00029     Q_OBJECT
    00030 public:
    00031     explicit QwtDynGridLayout( QWidget *, int margin = 0, int space = -1 );
    00032     explicit QwtDynGridLayout( int space = -1 );
    00033
    00034     virtual ~QwtDynGridLayout();
    00035
    00036     virtual void invalidate();
    00037
    00038     void setMaxCols( uint maxCols );
    00039     uint maxCols() const;
    00040
    00041     uint numRows () const;
    00042     uint numCols () const;
    00043
    00044     virtual void addItem( QLayoutItem * );
    00045
    00046     virtual QLayoutItem *itemAt( int index ) const;
    00047     virtual QLayoutItem *takeAt( int index );
    00048     virtual int count() const;
    00049
    00050     void setExpandingDirections( Qt::Orientations );
    00051     virtual Qt::Orientations expandingDirections() const;
    00052     QList<QRect> layoutItems( const QRect &, uint numCols ) const;
    00053
    00054     virtual int maxItemWidth() const;
    00055
    00056     virtual void setGeometry( const QRect &rect );
    00057
    00058     virtual bool hasHeightForWidth() const;
    00059     virtual int heightForWidth( int ) const;
    00060
    00061     virtual QSize sizeHint() const;
    00062
    00063     virtual bool isEmpty() const;
    00064     uint itemCount() const;
    00065
    00066     virtual uint columnsForWidth( int width ) const;
    00067
    00068 protected:
    00069
    00070     void layoutGrid( uint numCols,
    00071         QVector<int>& rowHeight, QVector<int>& colWidth ) const;
    00072     void stretchGrid( const QRect &rect, uint numCols,
    00073         QVector<int>& rowHeight, QVector<int>& colWidth ) const;
    00074
    00075 private:
    00076     void init();
    00077     int maxRowWidth( int numCols ) const;
    00078
    00079     class PrivateData;
    00080     PrivateData *d_data;
    00081 };
    00082
    00083 #endif