Qwt User's Guide: qwt_dyngrid_layout.h Source File

Qwt User's Guide 5.2.3

- Main Page
- Related Pages
- Classes

qwt_dyngrid_layout.h
1 /* -*- mode: C++ ; c-file-style: "stroustrup" -*- *****************************
2 * Qwt Widget Library
3 * Copyright (C) 1997 Josef Wilgen
4 * Copyright (C) 2002 Uwe Rathmann
5 *
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the Qwt License, Version 1.0
8 *****************************************************************************/
9
10 #ifndef QWT_DYNGRID_LAYOUT_H
11 #define QWT_DYNGRID_LAYOUT_H
12
13 #include <qlayout.h>
14 #include <qsize.h>
15 #if QT_VERSION >= 0x040000
16 #include <qlist.h>
17 #else
18 #include <qvaluelist.h>
19 #endif
20 #include "qwt_global.h"
21 #include "qwt_array.h"
22
32 class QWT_EXPORT QwtDynGridLayout : public QLayout
33 {
34 Q_OBJECT
35 public:
36 explicit QwtDynGridLayout(QWidget *, int margin = 0, int space = -1);
37 #if QT_VERSION < 0x040000
38 explicit QwtDynGridLayout(QLayout *, int space = -1);
39 #endif
40 explicit QwtDynGridLayout(int space = -1);
41
42 virtual ~QwtDynGridLayout();
43
44 virtual void invalidate();
45
46 void setMaxCols(uint maxCols);
47 uint maxCols() const;
48
49 uint numRows () const;
50 uint numCols () const;
51
52 virtual void addItem(QLayoutItem *);
53
54 #if QT_VERSION >= 0x040000
55 virtual QLayoutItem *itemAt( int index ) const;
56 virtual QLayoutItem *takeAt( int index );
57 virtual int count() const;
58
59 void setExpandingDirections(Qt::Orientations);
60 virtual Qt::Orientations expandingDirections() const;
61 QList<QRect> layoutItems(const QRect &, uint numCols) const;
62 #else
63 virtual QLayoutIterator iterator();
64
65 void setExpanding(QSizePolicy::ExpandData);
66 virtual QSizePolicy::ExpandData expanding() const;
67 QValueList<QRect> layoutItems(const QRect &, uint numCols) const;
68 #endif
69
70 virtual int maxItemWidth() const;
71
72 virtual void setGeometry(const QRect &rect);
73
74 virtual bool hasHeightForWidth() const;
75 virtual int heightForWidth(int) const;
76
77 virtual QSize sizeHint() const;
78
79 virtual bool isEmpty() const;
80 uint itemCount() const;
81
82 virtual uint columnsForWidth(int width) const;
83
84 protected:
85
86 void layoutGrid(uint numCols,
87 QwtArray<int>& rowHeight, QwtArray<int>& colWidth) const;
88 void stretchGrid(const QRect &rect, uint numCols,
89 QwtArray<int>& rowHeight, QwtArray<int>& colWidth) const;
90
91
92 private:
93 void init();
94 int maxRowWidth(int numCols) const;
95 void updateLayoutCache();
96
97 #if QT_VERSION < 0x040000
98 // xlC 5.1, the IBM/AIX C++ compiler, needs it to be public
99 public:
100 #endif
101 class PrivateData;
102
103 private:
104 PrivateData *d_data;
105 };
106
107 #endif