~oif-team/ubuntu/natty/qt4-x11/xi2.1

« back to all changes in this revision

Viewing changes to tools/designer/src/components/formeditor/formwindowmanager.h

  • Committer: Bazaar Package Importer
  • Author(s): Adam Conrad
  • Date: 2005-08-24 04:09:09 UTC
  • Revision ID: james.westby@ubuntu.com-20050824040909-xmxe9jfr4a0w5671
Tags: upstream-4.0.0
ImportĀ upstreamĀ versionĀ 4.0.0

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/****************************************************************************
 
2
**
 
3
** Copyright (C) 1992-2005 Trolltech AS. All rights reserved.
 
4
**
 
5
** This file is part of the designer application of the Qt Toolkit.
 
6
**
 
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.
 
10
**
 
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.
 
15
**
 
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.
 
20
**
 
21
** Contact info@trolltech.com if any conditions of this licensing are
 
22
** not clear to you.
 
23
**
 
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.
 
26
**
 
27
****************************************************************************/
 
28
 
 
29
#ifndef FORMWINDOWMANAGER_H
 
30
#define FORMWINDOWMANAGER_H
 
31
 
 
32
#include "formeditor_global.h"
 
33
#include "formwindow.h"
 
34
 
 
35
#include <QtDesigner/QtDesigner>
 
36
 
 
37
#include <QtCore/QObject>
 
38
#include <QtCore/QList>
 
39
#include <QtCore/QPointer>
 
40
 
 
41
class QAction;
 
42
class QActionGroup;
 
43
class MetaDataBase;
 
44
class QDesignerFormEditorInterface;
 
45
class QDesignerWidgetBoxInterface;
 
46
 
 
47
namespace qdesigner_internal {
 
48
 
 
49
class QT_FORMEDITOR_EXPORT FormWindowManager: public QDesignerFormWindowManagerInterface
 
50
{
 
51
    Q_OBJECT
 
52
public:
 
53
    FormWindowManager(QDesignerFormEditorInterface *core, QObject *parent = 0);
 
54
    virtual ~FormWindowManager();
 
55
 
 
56
    virtual QDesignerFormEditorInterface *core() const;
 
57
 
 
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;
 
67
 
 
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; }
 
75
 
 
76
    QDesignerFormWindowInterface *activeFormWindow() const;
 
77
 
 
78
    int formWindowCount() const;
 
79
    QDesignerFormWindowInterface *formWindow(int index) const;
 
80
 
 
81
    QDesignerFormWindowInterface *createFormWindow(QWidget *parentWidget = 0, Qt::WindowFlags flags = 0);
 
82
 
 
83
    bool eventFilter(QObject *o, QEvent *e);
 
84
 
 
85
    void dragItems(const QList<QDesignerDnDItemInterface*> &item_list);
 
86
 
 
87
public slots:
 
88
    void addFormWindow(QDesignerFormWindowInterface *formWindow);
 
89
    void removeFormWindow(QDesignerFormWindowInterface *formWindow);
 
90
    void setActiveFormWindow(QDesignerFormWindowInterface *formWindow);
 
91
 
 
92
private slots:
 
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();
 
107
 
 
108
    void slotUpdateActions();
 
109
 
 
110
private:
 
111
    void setupActions();
 
112
    FormWindow *findFormWindow(QWidget *w);
 
113
    QWidget *findManagedWidget(FormWindow *fw, QWidget *w);
 
114
 
 
115
    void layoutContainerHorizontal();
 
116
    void layoutContainerVertical();
 
117
    void layoutContainerGrid();
 
118
 
 
119
    void setCurrentUndoStack(QtUndoStack *stack);
 
120
 
 
121
private:
 
122
    QDesignerFormEditorInterface *m_core;
 
123
    FormWindow *m_activeFormWindow;
 
124
    QList<FormWindow*> m_formWindows;
 
125
 
 
126
    bool m_layoutChilds;
 
127
 
 
128
    // edit actions
 
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;
 
136
    // layout actions
 
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;
 
144
 
 
145
    QAction *m_actionUndo;
 
146
    QAction *m_actionRedo;
 
147
 
 
148
    // DnD stuff
 
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;
 
157
};
 
158
 
 
159
}  // namespace qdesigner_internal
 
160
 
 
161
#endif // FORMWINDOWMANAGER_H