annotate include/gui/layouts/flow_layout.h @ 253:b3549da699a6

*: ooooh! stupid big commit! oops
author Paper <paper@paper.us.eu.org>
date Tue, 06 Feb 2024 16:56:32 -0500
parents
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
253
b3549da699a6 *: ooooh! stupid big commit!
Paper <paper@paper.us.eu.org>
parents:
diff changeset
1 #ifndef __gui__layouts__flow_layout_h
b3549da699a6 *: ooooh! stupid big commit!
Paper <paper@paper.us.eu.org>
parents:
diff changeset
2 #define __gui__layouts__flow_layout_h
b3549da699a6 *: ooooh! stupid big commit!
Paper <paper@paper.us.eu.org>
parents:
diff changeset
3
b3549da699a6 *: ooooh! stupid big commit!
Paper <paper@paper.us.eu.org>
parents:
diff changeset
4 #include <QLayout>
b3549da699a6 *: ooooh! stupid big commit!
Paper <paper@paper.us.eu.org>
parents:
diff changeset
5 #include <QRect>
b3549da699a6 *: ooooh! stupid big commit!
Paper <paper@paper.us.eu.org>
parents:
diff changeset
6 #include <QStyle>
b3549da699a6 *: ooooh! stupid big commit!
Paper <paper@paper.us.eu.org>
parents:
diff changeset
7
b3549da699a6 *: ooooh! stupid big commit!
Paper <paper@paper.us.eu.org>
parents:
diff changeset
8 class QWidget;
b3549da699a6 *: ooooh! stupid big commit!
Paper <paper@paper.us.eu.org>
parents:
diff changeset
9 class QLayoutItem;
b3549da699a6 *: ooooh! stupid big commit!
Paper <paper@paper.us.eu.org>
parents:
diff changeset
10
b3549da699a6 *: ooooh! stupid big commit!
Paper <paper@paper.us.eu.org>
parents:
diff changeset
11 class FlowLayout : public QLayout {
b3549da699a6 *: ooooh! stupid big commit!
Paper <paper@paper.us.eu.org>
parents:
diff changeset
12 public:
b3549da699a6 *: ooooh! stupid big commit!
Paper <paper@paper.us.eu.org>
parents:
diff changeset
13 explicit FlowLayout(QWidget* parent, int margin = -1, int hSpacing = -1, int vSpacing = -1);
b3549da699a6 *: ooooh! stupid big commit!
Paper <paper@paper.us.eu.org>
parents:
diff changeset
14 explicit FlowLayout(int margin = -1, int hSpacing = -1, int vSpacing = -1);
b3549da699a6 *: ooooh! stupid big commit!
Paper <paper@paper.us.eu.org>
parents:
diff changeset
15 ~FlowLayout();
b3549da699a6 *: ooooh! stupid big commit!
Paper <paper@paper.us.eu.org>
parents:
diff changeset
16
b3549da699a6 *: ooooh! stupid big commit!
Paper <paper@paper.us.eu.org>
parents:
diff changeset
17 void addItem(QLayoutItem* item) override;
b3549da699a6 *: ooooh! stupid big commit!
Paper <paper@paper.us.eu.org>
parents:
diff changeset
18 int horizontalSpacing() const;
b3549da699a6 *: ooooh! stupid big commit!
Paper <paper@paper.us.eu.org>
parents:
diff changeset
19 int verticalSpacing() const;
b3549da699a6 *: ooooh! stupid big commit!
Paper <paper@paper.us.eu.org>
parents:
diff changeset
20 Qt::Orientations expandingDirections() const override;
b3549da699a6 *: ooooh! stupid big commit!
Paper <paper@paper.us.eu.org>
parents:
diff changeset
21 bool hasHeightForWidth() const override;
b3549da699a6 *: ooooh! stupid big commit!
Paper <paper@paper.us.eu.org>
parents:
diff changeset
22 int heightForWidth(int) const override;
b3549da699a6 *: ooooh! stupid big commit!
Paper <paper@paper.us.eu.org>
parents:
diff changeset
23 int count() const override;
b3549da699a6 *: ooooh! stupid big commit!
Paper <paper@paper.us.eu.org>
parents:
diff changeset
24 QLayoutItem* itemAt(int index) const override;
b3549da699a6 *: ooooh! stupid big commit!
Paper <paper@paper.us.eu.org>
parents:
diff changeset
25 QSize minimumSize() const override;
b3549da699a6 *: ooooh! stupid big commit!
Paper <paper@paper.us.eu.org>
parents:
diff changeset
26 void setGeometry(const QRect& rect) override;
b3549da699a6 *: ooooh! stupid big commit!
Paper <paper@paper.us.eu.org>
parents:
diff changeset
27 QSize sizeHint() const override;
b3549da699a6 *: ooooh! stupid big commit!
Paper <paper@paper.us.eu.org>
parents:
diff changeset
28 QLayoutItem* takeAt(int index) override;
b3549da699a6 *: ooooh! stupid big commit!
Paper <paper@paper.us.eu.org>
parents:
diff changeset
29
b3549da699a6 *: ooooh! stupid big commit!
Paper <paper@paper.us.eu.org>
parents:
diff changeset
30 private:
b3549da699a6 *: ooooh! stupid big commit!
Paper <paper@paper.us.eu.org>
parents:
diff changeset
31 int doLayout(const QRect& rect, bool testOnly) const;
b3549da699a6 *: ooooh! stupid big commit!
Paper <paper@paper.us.eu.org>
parents:
diff changeset
32 int smartSpacing(QStyle::PixelMetric pm) const;
b3549da699a6 *: ooooh! stupid big commit!
Paper <paper@paper.us.eu.org>
parents:
diff changeset
33
b3549da699a6 *: ooooh! stupid big commit!
Paper <paper@paper.us.eu.org>
parents:
diff changeset
34 QList<QLayoutItem*> item_list;
b3549da699a6 *: ooooh! stupid big commit!
Paper <paper@paper.us.eu.org>
parents:
diff changeset
35 int _horiz_space;
b3549da699a6 *: ooooh! stupid big commit!
Paper <paper@paper.us.eu.org>
parents:
diff changeset
36 int _vert_space;
b3549da699a6 *: ooooh! stupid big commit!
Paper <paper@paper.us.eu.org>
parents:
diff changeset
37 };
b3549da699a6 *: ooooh! stupid big commit!
Paper <paper@paper.us.eu.org>
parents:
diff changeset
38
b3549da699a6 *: ooooh! stupid big commit!
Paper <paper@paper.us.eu.org>
parents:
diff changeset
39 #endif // __gui__layouts__flow_layout_h