1
/****************************************************************************
3
** Copyright (C) 1992-2005 Trolltech AS. All rights reserved.
5
** This file is part of the designer application of the Qt Toolkit.
7
** This file may be distributed under the terms of the Q Public License
8
** as defined by Trolltech AS of Norway and appearing in the file
9
** LICENSE.QPL included in the packaging of this file.
11
** This file may be distributed and/or modified under the terms of the
12
** GNU General Public License version 2 as published by the Free Software
13
** Foundation and appearing in the file LICENSE.GPL included in the
14
** packaging of this file.
16
** See http://www.trolltech.com/pricing.html or email sales@trolltech.com for
17
** information about Qt Commercial License Agreements.
18
** See http://www.trolltech.com/qpl/ for QPL licensing information.
19
** See http://www.trolltech.com/gpl/ for GPL licensing information.
21
** Contact info@trolltech.com if any conditions of this licensing are
24
** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
25
** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
27
****************************************************************************/
29
#ifndef FORMWINDOWMANAGER_H
30
#define FORMWINDOWMANAGER_H
32
#include "formeditor_global.h"
33
#include "formwindow.h"
35
#include <QtDesigner/QtDesigner>
37
#include <QtCore/QObject>
38
#include <QtCore/QList>
39
#include <QtCore/QPointer>
44
class QDesignerFormEditorInterface;
45
class QDesignerWidgetBoxInterface;
47
namespace qdesigner_internal {
49
class QT_FORMEDITOR_EXPORT FormWindowManager: public QDesignerFormWindowManagerInterface
53
FormWindowManager(QDesignerFormEditorInterface *core, QObject *parent = 0);
54
virtual ~FormWindowManager();
56
virtual QDesignerFormEditorInterface *core() const;
58
inline QAction *actionCut() const { return m_actionCut; }
59
inline QAction *actionCopy() const { return m_actionCopy; }
60
inline QAction *actionPaste() const { return m_actionPaste; }
61
inline QAction *actionDelete() const { return m_actionDelete; }
62
inline QAction *actionSelectAll() const { return m_actionSelectAll; }
63
inline QAction *actionLower() const { return m_actionLower; }
64
inline QAction *actionRaise() const { return m_actionRaise; }
65
QAction *actionUndo() const;
66
QAction *actionRedo() const;
68
inline QAction *actionHorizontalLayout() const { return m_actionHorizontalLayout; }
69
inline QAction *actionVerticalLayout() const { return m_actionVerticalLayout; }
70
inline QAction *actionSplitHorizontal() const { return m_actionSplitHorizontal; }
71
inline QAction *actionSplitVertical() const { return m_actionSplitVertical; }
72
inline QAction *actionGridLayout() const { return m_actionGridLayout; }
73
inline QAction *actionBreakLayout() const { return m_actionBreakLayout; }
74
inline QAction *actionAdjustSize() const { return m_actionAdjustSize; }
76
QDesignerFormWindowInterface *activeFormWindow() const;
78
int formWindowCount() const;
79
QDesignerFormWindowInterface *formWindow(int index) const;
81
QDesignerFormWindowInterface *createFormWindow(QWidget *parentWidget = 0, Qt::WindowFlags flags = 0);
83
bool eventFilter(QObject *o, QEvent *e);
85
void dragItems(const QList<QDesignerDnDItemInterface*> &item_list);
88
void addFormWindow(QDesignerFormWindowInterface *formWindow);
89
void removeFormWindow(QDesignerFormWindowInterface *formWindow);
90
void setActiveFormWindow(QDesignerFormWindowInterface *formWindow);
93
void slotActionCutActivated();
94
void slotActionCopyActivated();
95
void slotActionPasteActivated();
96
void slotActionDeleteActivated();
97
void slotActionSelectAllActivated();
98
void slotActionLowerActivated();
99
void slotActionRaiseActivated();
100
void slotActionHorizontalLayoutActivated();
101
void slotActionVerticalLayoutActivated();
102
void slotActionSplitHorizontalActivated();
103
void slotActionSplitVerticalActivated();
104
void slotActionGridLayoutActivated();
105
void slotActionBreakLayoutActivated();
106
void slotActionAdjustSizeActivated();
108
void slotUpdateActions();
112
FormWindow *findFormWindow(QWidget *w);
113
QWidget *findManagedWidget(FormWindow *fw, QWidget *w);
115
void layoutContainerHorizontal();
116
void layoutContainerVertical();
117
void layoutContainerGrid();
119
void setCurrentUndoStack(QtUndoStack *stack);
122
QDesignerFormEditorInterface *m_core;
123
FormWindow *m_activeFormWindow;
124
QList<FormWindow*> m_formWindows;
129
QAction *m_actionCut;
130
QAction *m_actionCopy;
131
QAction *m_actionPaste;
132
QAction *m_actionSelectAll;
133
QAction *m_actionDelete;
134
QAction *m_actionLower;
135
QAction *m_actionRaise;
137
QAction *m_actionHorizontalLayout;
138
QAction *m_actionVerticalLayout;
139
QAction *m_actionSplitHorizontal;
140
QAction *m_actionSplitVertical;
141
QAction *m_actionGridLayout;
142
QAction *m_actionBreakLayout;
143
QAction *m_actionAdjustSize;
145
QAction *m_actionUndo;
146
QAction *m_actionRedo;
149
void beginDrag(const QList<QDesignerDnDItemInterface*> &item_list, const QPoint &globalPos);
150
void endDrag(const QPoint &pos);
151
void setItemsPos(const QPoint &pos);
152
bool isDecoration(QWidget *widget) const;
153
QList<QDesignerDnDItemInterface*> m_drag_item_list;
154
QWidget *m_last_widget_under_mouse;
155
FormWindow *m_last_form_under_mouse;
156
QDesignerWidgetBoxInterface *m_widget_box_under_mouse;
159
} // namespace qdesigner_internal
161
#endif // FORMWINDOWMANAGER_H