source: pacpusframework/branches/2.0-beta1/include/extlib/qwt-5.2.1/qwt_dyngrid_layout.h@ 89

Last change on this file since 89 was 89, checked in by morasjul, 11 years ago

PACPUS 2.0 Beta deployed in new branch

Major changes:
-Add communication interface between components
-Add examples for communications interface (TestComponents)
-Move to Qt5 support

  • Property svn:executable set to *
File size: 2.9 KB
Line 
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
23/*!
24 \brief The QwtDynGridLayout class lays out widgets in a grid,
25 adjusting the number of columns and rows to the current size.
26
27 QwtDynGridLayout takes the space it gets, divides it up into rows and
28 columns, and puts each of the widgets it manages into the correct cell(s).
29 It lays out as many number of columns as possible (limited by maxCols()).
30*/
31
32class QWT_EXPORT QwtDynGridLayout : public QLayout
33{
34 Q_OBJECT
35public:
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
84protected:
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
92private:
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
99public:
100#endif
101 class PrivateData;
102
103private:
104 PrivateData *d_data;
105};
106
107#endif
Note: See TracBrowser for help on using the repository browser.