1 /**************************************************************************
3 ** This file is part of Qt Creator
5 ** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies).
7 ** Contact: Nokia Corporation (qt-info@nokia.com)
11 ** This file contains pre-release code and may not be distributed.
12 ** You may use this file in accordance with the terms and conditions
13 ** contained in the Technology Preview License Agreement accompanying
16 ** GNU Lesser General Public License Usage
18 ** Alternatively, this file may be used under the terms of the GNU Lesser
19 ** General Public License version 2.1 as published by the Free Software
20 ** Foundation and appearing in the file LICENSE.LGPL included in the
21 ** packaging of this file. Please review the following information to
22 ** ensure the GNU Lesser General Public License version 2.1 requirements
23 ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
25 ** In addition, as a special exception, Nokia gives you certain additional
26 ** rights. These rights are described in the Nokia Qt LGPL Exception
27 ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
29 ** If you have questions regarding the use of this file, please contact
30 ** Nokia at qt-info@nokia.com.
32 **************************************************************************/
34 #ifndef CONTEXTPANEWIDGET_H
35 #define CONTEXTPANEWIDGET_H
37 #include <qmleditorwidgets_global.h>
38 #include <QtGui/QFrame>
39 #include <QtCore/QWeakPointer>
44 class QGraphicsDropShadowEffect;
45 class QGraphicsOpacityEffect;
52 namespace QmlEditorWidgets {
54 class CustomColorDialog;
55 class ContextPaneTextWidget;
56 class EasingContextPane;
57 class ContextPaneWidgetRectangle;
58 class ContextPaneWidgetImage;
60 class QMLEDITORWIDGETS_EXPORT DragWidget : public QFrame
65 explicit DragWidget(QWidget *parent = 0);
66 void setSecondaryTarget(QWidget* w)
67 { m_secondaryTarget = w; }
71 void mousePressEvent(QMouseEvent * event);
72 void mouseReleaseEvent(QMouseEvent * event);
73 void mouseMoveEvent(QMouseEvent * event);
74 void virtual protectedMoved();
75 void leaveEvent(QEvent *);
76 void enterEvent(QEvent *);
79 QGraphicsDropShadowEffect *m_dropShadowEffect;
80 QGraphicsOpacityEffect *m_opacityEffect;
82 QWeakPointer<QWidget> m_secondaryTarget;
85 class QMLEDITORWIDGETS_EXPORT ContextPaneWidget : public DragWidget
90 explicit ContextPaneWidget(QWidget *parent = 0);
92 void activate(const QPoint &pos, const QPoint &alternative, const QPoint &alternative2, bool pinned);
93 void rePosition(const QPoint &pos, const QPoint &alternative , const QPoint &alternative3, bool pinned);
95 void setOptions(bool enabled, bool pinned);
96 CustomColorDialog *colorDialog();
97 void setProperties(QmlJS::PropertyReader *propertyReader);
98 void setPath(const QString &path);
99 bool setType(const QStringList &types);
100 bool acceptsType(const QStringList &types);
101 QWidget* currentWidget() const { return m_currentWidget; }
102 void setIsPropertyChanges(bool b)
103 { m_isPropertyChanges = b; }
104 bool isPropertyChanges() const
105 { return m_isPropertyChanges; }
109 void onShowColorDialog(bool, const QPoint &);
112 void propertyChanged(const QString &, const QVariant &);
113 void removeProperty(const QString &);
114 void removeAndChangeProperty(const QString &, const QString &, const QVariant &, bool);
115 void pinnedChanged(bool);
116 void enabledChanged(bool);
120 void onDisable(bool);
121 void onResetPosition(bool toggle);
125 void protectedMoved();
127 QToolButton *m_toolButton;
128 QWidget *createFontWidget();
129 QWidget *createEasingWidget();
130 QWidget *createImageWidget();
131 QWidget *createBorderImageWidget();
132 QWidget *createRectangleWidget();
135 void setLineButton();
138 QWidget *m_currentWidget;
139 ContextPaneTextWidget *m_textWidget;
140 EasingContextPane *m_easingWidget;
141 ContextPaneWidgetImage *m_imageWidget;
142 ContextPaneWidgetImage *m_borderImageWidget;
143 ContextPaneWidgetRectangle *m_rectangleWidget;
144 QWeakPointer<CustomColorDialog> m_bauhausColorDialog;
145 QWeakPointer<QAction> m_resetAction;
146 QWeakPointer<QAction> m_disableAction;
148 QPoint m_originalPos;
150 bool m_isPropertyChanges;
155 #endif // CONTEXTPANEWIDGET_H