2
* Copyright 2016 Canonical Ltd.
4
* This program is free software; you can redistribute it and/or modify
5
* it under the terms of the GNU Lesser General Public License as published by
6
* the Free Software Foundation; version 3.
8
* This program is distributed in the hope that it will be useful,
9
* but WITHOUT ANY WARRANTY; without even the implied warranty of
10
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11
* GNU Lesser General Public License for more details.
13
* You should have received a copy of the GNU Lesser General Public License
14
* along with this program. If not, see <http://www.gnu.org/licenses/>.
16
* Author: Zsombor Egri <zsombor.egri@canonical.com>
22
#include <QtQuick/private/qquickpositioners_p.h>
24
#include "ubuntutoolkitglobal.h"
28
class ViewColumnPrivate;
29
class ViewColumn : public QObject, public QQmlParserStatus
32
Q_INTERFACES(QQmlParserStatus)
33
Q_PRIVATE_PROPERTY(ViewColumn::d_func(), bool fillWidth MEMBER fillWidth WRITE setFillWidth NOTIFY fillWidthChanged)
34
Q_PRIVATE_PROPERTY(ViewColumn::d_func(), qreal minimumWidth MEMBER minimumWidth WRITE setMinimumWidth NOTIFY minimumWidthChanged)
35
Q_PRIVATE_PROPERTY(ViewColumn::d_func(), qreal maximumWidth MEMBER maximumWidth WRITE setMaximumWidth NOTIFY maximumWidthChanged)
36
Q_PRIVATE_PROPERTY(ViewColumn::d_func(), qreal preferredWidth MEMBER preferredWidth WRITE setPreferredWidth NOTIFY preferredWidthChanged)
38
explicit ViewColumn(QObject *parent = 0);
40
bool resize(qreal delta);
43
void minimumWidthChanged();
44
void maximumWidthChanged();
45
void preferredWidthChanged();
46
void fillWidthChanged();
49
// from QQmlParserStatus
50
void classBegin() override {}
51
void componentComplete() override;
53
Q_DECLARE_PRIVATE(ViewColumn)
56
class SplitViewLayoutPrivate;
57
class SplitViewLayout : public QObject
61
Q_PRIVATE_PROPERTY(SplitViewLayout::d_func(), bool when MEMBER when NOTIFY whenChanged)
63
Q_PRIVATE_PROPERTY(SplitViewLayout::d_func(), QQmlListProperty<ViewColumn> columns READ columns NOTIFY columnsChanged DESIGNABLE false)
65
Q_PRIVATE_PROPERTY(SplitViewLayout::d_func(), QQmlListProperty<UT_PREPEND_NAMESPACE(ViewColumn)> columns READ columns NOTIFY columnsChanged DESIGNABLE false)
67
Q_CLASSINFO("DefaultProperty", "columns")
69
explicit SplitViewLayout(QObject *parent = 0);
73
void columnsChanged();
76
Q_DECLARE_PRIVATE(SplitViewLayout)
80
class SplitViewAttachedPrivate;
81
class SplitViewAttached : public QObject
84
Q_PRIVATE_PROPERTY(SplitViewAttached::d_func(), int column READ getColumn NOTIFY columnChanged)
86
Q_PRIVATE_PROPERTY(SplitViewAttached::d_func(), SplitView* view READ view)
87
Q_PRIVATE_PROPERTY(SplitViewAttached::d_func(), ViewColumn* columnConfig READ config NOTIFY columnChanged)
89
Q_PRIVATE_PROPERTY(SplitViewAttached::d_func(), UT_PREPEND_NAMESPACE(SplitView*) view READ view)
90
Q_PRIVATE_PROPERTY(SplitViewAttached::d_func(), UT_PREPEND_NAMESPACE(ViewColumn*) columnConfig READ config NOTIFY columnChanged)
93
explicit SplitViewAttached(QObject *parent = 0);
95
static SplitViewAttached *get(QQuickItem *item);
97
void resize(qreal delta);
100
void columnChanged();
103
Q_DECLARE_PRIVATE(SplitViewAttached)
106
class SplitViewPrivate;
107
class SplitView : public QQuickBasePositioner
111
Q_PRIVATE_PROPERTY(SplitView::d_func(), QQmlListProperty<SplitViewLayout> layouts READ layouts NOTIFY layoutsChanged DESIGNABLE false)
112
Q_PRIVATE_PROPERTY(SplitView::d_func(), SplitViewLayout *activeLayout READ getActiveLayout NOTIFY activeLayoutChanged)
114
Q_PRIVATE_PROPERTY(SplitView::d_func(), QQmlListProperty<UT_PREPEND_NAMESPACE(SplitViewLayout)> layouts READ layouts NOTIFY layoutsChanged DESIGNABLE false)
115
Q_PRIVATE_PROPERTY(SplitView::d_func(), UT_PREPEND_NAMESPACE(SplitViewLayout) *activeLayout READ getActiveLayout NOTIFY activeLayoutChanged)
117
Q_PRIVATE_PROPERTY(SplitView::d_func(), QQmlComponent *handleDelegate MEMBER handleDelegate WRITE setHandle NOTIFY handleDelegateChanged)
119
Q_PROPERTY(qreal spacing READ spacing WRITE setSpacing2 NOTIFY spacingChanged2)
121
explicit SplitView(QQuickItem *parent = 0);
123
static UT_PREPEND_NAMESPACE(SplitViewAttached) *qmlAttachedProperties(QObject*);
126
void layoutsChanged();
127
void activeLayoutChanged();
128
void handleDelegateChanged();
129
void spacingChanged2();
132
SplitView(SplitViewPrivate &, QQuickItem *);
136
void setSpacing2(qreal spacing, bool reset = true);
138
// from QQuickBasePositioner
139
void doPositioning(QSizeF *contentSize) override;
140
void reportConflictingAnchors() override;
143
void componentComplete() override;
144
void geometryChanged(const QRectF &newGeometry, const QRectF &oldGeometry) override;
145
void itemChange(ItemChange, const ItemChangeData &) override;
147
// QQuickBasePositionerPrivate is not an exported API, therefore we cannot derive from it
148
SplitViewPrivate* const d_ptr;
149
Q_DECLARE_PRIVATE_D(d_ptr, SplitView)
150
Q_PRIVATE_SLOT(d_func(), void changeLayout())
155
QML_DECLARE_TYPE(UT_PREPEND_NAMESPACE(ViewColumn))
156
QML_DECLARE_TYPE(UT_PREPEND_NAMESPACE(SplitViewLayout))
157
QML_DECLARE_TYPE(UT_PREPEND_NAMESPACE(SplitView))
158
QML_DECLARE_TYPEINFO(UT_PREPEND_NAMESPACE(SplitView), QML_HAS_ATTACHED_PROPERTIES)
160
#endif // SPLITVIEW_P_H