1 /****************************************************************************
2 **
3 ** Copyright (C) 2016 The Qt Company Ltd.
4 ** Contact: https://www.qt.io/licensing/
5 **
6 ** This file is part of the Qt Designer of the Qt Toolkit.
7 **
8 ** $QT_BEGIN_LICENSE:GPL-EXCEPT$
9 ** Commercial License Usage
10 ** Licensees holding valid commercial Qt licenses may use this file in
11 ** accordance with the commercial license agreement provided with the
12 ** Software or, alternatively, in accordance with the terms contained in
13 ** a written agreement between you and The Qt Company. For licensing terms
14 ** and conditions see https://www.qt.io/terms-conditions. For further
15 ** information use the contact form at https://www.qt.io/contact-us.
16 **
17 ** GNU General Public License Usage
18 ** Alternatively, this file may be used under the terms of the GNU
19 ** General Public License version 3 as published by the Free Software
20 ** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
21 ** included in the packaging of this file. Please review the following
22 ** information to ensure the GNU General Public License requirements will
23 ** be met: https://www.gnu.org/licenses/gpl-3.0.html.
24 **
25 ** $QT_END_LICENSE$
26 **
27 ****************************************************************************/
28 
29 #ifndef ABSTRACTFORMWINDOWMANAGER_H
30 #define ABSTRACTFORMWINDOWMANAGER_H
31 
32 #include <QtDesigner/sdk_global.h>
33 #include <QtDesigner/abstractformwindow.h>
34 
35 #include <QtCore/qobject.h>
36 #include <QtCore/qscopedpointer.h>
37 
38 QT_BEGIN_NAMESPACE
39 
40 class QDesignerFormEditorInterface;
41 class QDesignerDnDItemInterface;
42 
43 class QWidget;
44 class QPixmap;
45 class QAction;
46 class QActionGroup;
47 
48 class QDESIGNER_SDK_EXPORT QDesignerFormWindowManagerInterface: public QObject
49 {
50     Q_OBJECT
51 public:
52     explicit QDesignerFormWindowManagerInterface(QObject *parent = nullptr);
53     virtual ~QDesignerFormWindowManagerInterface();
54 
55     enum Action
56     {
57 #if QT_CONFIG(clipboard)
58         CutAction = 100,
59         CopyAction,
60         PasteAction,
61 #endif
62         DeleteAction = 103,
63         SelectAllAction,
64 
65         LowerAction = 200,
66         RaiseAction,
67 
68         UndoAction = 300,
69         RedoAction,
70 
71         HorizontalLayoutAction = 400,
72         VerticalLayoutAction,
73         SplitHorizontalAction,
74         SplitVerticalAction,
75         GridLayoutAction,
76         FormLayoutAction,
77         BreakLayoutAction,
78         AdjustSizeAction,
79         SimplifyLayoutAction,
80 
81         DefaultPreviewAction = 500,
82 
83         FormWindowSettingsDialogAction = 600
84     };
85 
86     enum ActionGroup
87     {
88         StyledPreviewActionGroup = 100
89     };
90 
91     virtual QAction *action(Action action) const = 0;
92     virtual QActionGroup *actionGroup(ActionGroup actionGroup) const = 0;
93 
94 #if QT_CONFIG(clipboard)
95     QAction *actionCut() const;
96     QAction *actionCopy() const;
97     QAction *actionPaste() const;
98 #endif
99     QAction *actionDelete() const;
100     QAction *actionSelectAll() const;
101     QAction *actionLower() const;
102     QAction *actionRaise() const;
103     QAction *actionUndo() const;
104     QAction *actionRedo() const;
105 
106     QAction *actionHorizontalLayout() const;
107     QAction *actionVerticalLayout() const;
108     QAction *actionSplitHorizontal() const;
109     QAction *actionSplitVertical() const;
110     QAction *actionGridLayout() const;
111     QAction *actionFormLayout() const;
112     QAction *actionBreakLayout() const;
113     QAction *actionAdjustSize() const;
114     QAction *actionSimplifyLayout() const;
115 
116     virtual QDesignerFormWindowInterface *activeFormWindow() const = 0;
117 
118     virtual int formWindowCount() const = 0;
119     virtual QDesignerFormWindowInterface *formWindow(int index) const = 0;
120 
121     virtual QDesignerFormWindowInterface *createFormWindow(QWidget *parentWidget = nullptr, Qt::WindowFlags flags = Qt::WindowFlags()) = 0;
122 
123     virtual QDesignerFormEditorInterface *core() const = 0;
124 
125     virtual void dragItems(const QList<QDesignerDnDItemInterface*> &item_list) = 0;
126 
127     virtual QPixmap createPreviewPixmap() const = 0;
128 
129 Q_SIGNALS:
130     void formWindowAdded(QDesignerFormWindowInterface *formWindow);
131     void formWindowRemoved(QDesignerFormWindowInterface *formWindow);
132     void activeFormWindowChanged(QDesignerFormWindowInterface *formWindow);
133     void formWindowSettingsChanged(QDesignerFormWindowInterface *fw);
134 
135 public Q_SLOTS:
136     virtual void addFormWindow(QDesignerFormWindowInterface *formWindow) = 0;
137     virtual void removeFormWindow(QDesignerFormWindowInterface *formWindow) = 0;
138     virtual void setActiveFormWindow(QDesignerFormWindowInterface *formWindow) = 0;
139     virtual void showPreview() = 0;
140     virtual void closeAllPreviews() = 0;
141     virtual void showPluginDialog() = 0;
142 
143 private:
144     QScopedPointer<int> d;
145 };
146 
147 QT_END_NAMESPACE
148 
149 #endif // ABSTRACTFORMWINDOWMANAGER_H
150