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

« back to all changes in this revision

Viewing changes to tools/designer/src/designer/qdesigner_workbench.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 QDESIGNER_WORKBENCH_H
 
30
#define QDESIGNER_WORKBENCH_H
 
31
 
 
32
#include <QtCore/QObject>
 
33
#include <QtCore/QPointer>
 
34
#include <QtCore/QHash>
 
35
#include <QtCore/QList>
 
36
#include <QtCore/QRect>
 
37
 
 
38
class QDesigner;
 
39
class QDesignerActions;
 
40
class QDesignerToolWindow;
 
41
class QDesignerFormWindow;
 
42
class QDesignerIntegration;
 
43
 
 
44
class QAction;
 
45
class QActionGroup;
 
46
class QDockWidget;
 
47
class QMenu;
 
48
class QMenuBar;
 
49
class QVariant;
 
50
class QToolBar;
 
51
class QWorkspace;
 
52
class QCloseEvent;
 
53
 
 
54
class QDesignerFormEditorInterface;
 
55
class QDesignerFormWindowInterface;
 
56
class QDesignerFormWindowManagerInterface;
 
57
 
 
58
class QDesignerWorkbench: public QObject
 
59
{
 
60
    Q_OBJECT
 
61
public:
 
62
    enum UIMode
 
63
    {
 
64
        NeutralMode,
 
65
        TopLevelMode,
 
66
        DockedMode
 
67
    };
 
68
 
 
69
public:
 
70
    QDesignerWorkbench();
 
71
    virtual ~QDesignerWorkbench();
 
72
 
 
73
    UIMode mode() const;
 
74
 
 
75
    QDesignerFormEditorInterface *core() const;
 
76
 
 
77
    QDesignerToolWindow *findToolWindow(QWidget *widget) const;
 
78
    QDesignerFormWindow *findFormWindow(QWidget *widget) const;
 
79
 
 
80
    QDesignerFormWindow *createFormWindow();
 
81
 
 
82
    int toolWindowCount() const;
 
83
    QDesignerToolWindow *toolWindow(int index) const;
 
84
 
 
85
    int formWindowCount() const;
 
86
    QDesignerFormWindow *formWindow(int index) const;
 
87
 
 
88
    QDesignerActions *actionManager() const;
 
89
 
 
90
    QActionGroup *modeActionGroup() const;
 
91
 
 
92
    QRect availableGeometry() const;
 
93
    int marginHint() const;
 
94
 
 
95
    void saveSettings() const;
 
96
 
 
97
    bool readInForm(const QString &fileName) const;
 
98
    bool writeOutForm(QDesignerFormWindowInterface *formWindow, const QString &fileName) const;
 
99
    bool saveForm(QDesignerFormWindowInterface *fw);
 
100
    bool handleClose();
 
101
    void closeAllToolWindows();
 
102
 
 
103
signals:
 
104
    void modeChanged(UIMode mode);
 
105
    void initialized();
 
106
 
 
107
public slots:
 
108
    void addToolWindow(QDesignerToolWindow *toolWindow);
 
109
    void addFormWindow(QDesignerFormWindow *formWindow);
 
110
    void removeToolWindow(QDesignerToolWindow *toolWindow);
 
111
    void removeFormWindow(QDesignerFormWindow *formWindow);
 
112
    void setUIMode(UIMode mode);
 
113
    void setUseBigIcons(bool superSizeMe);
 
114
 
 
115
// ### private slots:
 
116
    void switchToNeutralMode();
 
117
    void switchToDockedMode();
 
118
    void switchToTopLevelMode();
 
119
 
 
120
    void initializeCorePlugins();
 
121
 
 
122
private slots:
 
123
    void initialize();
 
124
    void activateWorkspaceChildWindow(QWidget *widget);
 
125
    void updateWindowMenu(QDesignerFormWindowInterface *fw);
 
126
    void formWindowActionTriggered(QAction *a);
 
127
    void showToolBars();
 
128
    void adjustFormPositions();
 
129
 
 
130
private:
 
131
    QWidget *magicalParent() const;
 
132
    Qt::WindowFlags magicalWindowFlags(const QWidget *widgetForFlags) const;
 
133
    QDockWidget *magicalDockWidget(QWidget *widget) const;
 
134
 
 
135
    QDesignerFormWindowManagerInterface *formWindowManager() const;
 
136
    void changeBringToFrontVisiblity(bool visible);
 
137
    void changeToolBarIconSize(bool big);
 
138
 
 
139
 
 
140
private:
 
141
    QDesignerFormEditorInterface *m_core;
 
142
    QDesignerIntegration *m_integration;
 
143
 
 
144
    QDesignerActions *m_actionManager;
 
145
    QActionGroup *m_toolActions;
 
146
    QActionGroup *m_windowActions;
 
147
 
 
148
    QMenu *m_fileMenu;
 
149
    QMenu *m_editMenu;
 
150
    QMenu *m_formMenu;
 
151
    QMenu *m_toolMenu;
 
152
    QMenu *m_windowMenu;
 
153
    QMenu *m_helpMenu;
 
154
 
 
155
    QMenuBar *m_globalMenuBar;
 
156
    QToolBar *m_toolToolBar;
 
157
    QToolBar *m_formToolBar;
 
158
    QToolBar *m_editToolBar;
 
159
 
 
160
    UIMode m_mode;
 
161
 
 
162
    QList<QDesignerToolWindow*> m_toolWindows;
 
163
    QList<QDesignerFormWindow*> m_formWindows;
 
164
 
 
165
    QWorkspace *m_workspace;
 
166
    QHash<QWidget*, bool> m_visibilities;
 
167
    QHash<QWidget*, QRect> m_geometries;
 
168
 
 
169
    class ToolWindowExtra {};
 
170
    class FormWindowExtra {};
 
171
 
 
172
    QHash<QDesignerToolWindow*, ToolWindowExtra> m_toolWindowExtras;
 
173
    QHash<QDesignerFormWindow*, FormWindowExtra> m_formWindowExtras;
 
174
    bool m_initializing;
 
175
};
 
176
 
 
177
#endif // QDESIGNER_WORKBENCH_H