1 /**************************************************************************
3 ** This file is part of Qt Creator
5 ** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies).
7 ** Contact: Nokia Corporation (info@qt.nokia.com)
10 ** GNU Lesser General Public License Usage
12 ** This file may be used under the terms of the GNU Lesser General Public
13 ** License version 2.1 as published by the Free Software Foundation and
14 ** appearing in the file LICENSE.LGPL included in the packaging of this file.
15 ** Please review the following information to ensure the GNU Lesser General
16 ** Public License version 2.1 requirements will be met:
17 ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
19 ** In addition, as a special exception, Nokia gives you certain additional
20 ** rights. These rights are described in the Nokia Qt LGPL Exception
21 ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
25 ** Alternatively, this file may be used in accordance with the terms and
26 ** conditions contained in a signed written agreement between you and Nokia.
28 ** If you have questions regarding the use of this file, please contact
29 ** Nokia at qt-info@nokia.com.
31 **************************************************************************/
33 #ifndef ANCHORLINECONTROLLER_H
34 #define ANCHORLINECONTROLLER_H
36 #include <QWeakPointer>
37 #include <QSharedPointer>
38 #include <qmlanchors.h>
40 namespace QmlDesigner {
44 class AnchorLineHandleItem;
46 class AnchorLineControllerData
49 AnchorLineControllerData(LayerItem *layerItem,
50 FormEditorItem *formEditorItem);
51 AnchorLineControllerData(const AnchorLineControllerData &other);
52 ~AnchorLineControllerData();
54 QWeakPointer<LayerItem> layerItem;
55 FormEditorItem *formEditorItem;
57 AnchorLineHandleItem *topItem;
58 AnchorLineHandleItem *leftItem;
59 AnchorLineHandleItem *rightItem;
60 AnchorLineHandleItem *bottomItem;
64 class AnchorLineController
67 AnchorLineController();
68 AnchorLineController(LayerItem *layerItem, FormEditorItem *formEditorItem);
69 AnchorLineController(const QSharedPointer<AnchorLineControllerData> &data);
71 void show(AnchorLine::Type anchorLineMask);
74 void updatePosition();
78 QWeakPointer<AnchorLineControllerData> weakPointer() const;
81 FormEditorItem *formEditorItem() const;
83 bool isTopHandle(const AnchorLineHandleItem *handle) const;
84 bool isLeftHandle(const AnchorLineHandleItem *handle) const;
85 bool isRightHandle(const AnchorLineHandleItem *handle) const;
86 bool isBottomHandle(const AnchorLineHandleItem *handle) const;
88 void clearHighlight();
91 QSharedPointer<AnchorLineControllerData> m_data;
94 } // namespace QmlDesigner
96 #endif // ANCHORLINECONTROLLER_H