OSDN Git Service

It's 2011 now.
[qt-creator-jp/qt-creator-jp.git] / src / tools / qtcreatorwidgets / customwidgets.h
1 /**************************************************************************
2 **
3 ** This file is part of Qt Creator
4 **
5 ** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies).
6 **
7 ** Contact: Nokia Corporation (qt-info@nokia.com)
8 **
9 ** No Commercial Usage
10 **
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
14 ** this package.
15 **
16 ** GNU Lesser General Public License Usage
17 **
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.
24 **
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.
28 **
29 ** If you have questions regarding the use of this file, please contact
30 ** Nokia at qt-info@nokia.com.
31 **
32 **************************************************************************/
33
34 #ifndef CUSTOMWIDGETS_H
35 #define CUSTOMWIDGETS_H
36
37 #include "customwidget.h"
38
39 #include <utils/newclasswidget.h>
40 #include <utils/classnamevalidatinglineedit.h>
41 #include <utils/filenamevalidatinglineedit.h>
42 #include <utils/linecolumnlabel.h>
43 #include <utils/pathchooser.h>
44 #include <utils/projectnamevalidatinglineedit.h>
45 #include <utils/filterlineedit.h>
46 #include <utils/qtcolorbutton.h>
47 #include <utils/submiteditorwidget.h>
48 #include <utils/submitfieldwidget.h>
49 #include <utils/pathlisteditor.h>
50 #include <utils/detailsbutton.h>
51 #include <utils/detailswidget.h>
52 #include <utils/styledbar.h>
53 #include <utils/wizard.h>
54 #include <utils/welcomemodetreewidget.h>
55 #include <utils/crumblepath.h>
56
57 #include <QtDesigner/QDesignerCustomWidgetCollectionInterface>
58 #include <QtDesigner/QDesignerContainerExtension>
59 #include <QtDesigner/QExtensionFactory>
60
61 #include <QtCore/qplugin.h>
62 #include <QtCore/QList>
63
64 QT_BEGIN_NAMESPACE
65 class QExtensionManager;
66 QT_END_NAMESPACE
67
68 // Custom Widgets
69
70 class NewClassCustomWidget :
71     public QObject,
72     public CustomWidget<Utils::NewClassWidget>
73 {
74     Q_OBJECT
75     Q_INTERFACES(QDesignerCustomWidgetInterface)
76 public:
77     explicit NewClassCustomWidget(QObject *parent = 0);
78 };
79
80 class ClassNameValidatingLineEdit_CW :
81     public QObject,
82     public CustomWidget<Utils::ClassNameValidatingLineEdit>
83 {
84     Q_OBJECT
85     Q_INTERFACES(QDesignerCustomWidgetInterface)
86 public:
87     explicit ClassNameValidatingLineEdit_CW(QObject *parent = 0);
88 };
89
90 class FileNameValidatingLineEdit_CW :
91     public QObject,
92     public CustomWidget<Utils::FileNameValidatingLineEdit>
93 {
94     Q_OBJECT
95     Q_INTERFACES(QDesignerCustomWidgetInterface)
96 public:
97     explicit FileNameValidatingLineEdit_CW(QObject *parent = 0);
98 };
99
100 class ProjectNameValidatingLineEdit_CW :
101     public QObject,
102     public CustomWidget<Utils::ProjectNameValidatingLineEdit>
103 {
104     Q_OBJECT
105     Q_INTERFACES(QDesignerCustomWidgetInterface)
106 public:
107     explicit ProjectNameValidatingLineEdit_CW(QObject *parent = 0);
108 };
109
110 class LineColumnLabel_CW :
111     public QObject,
112     public CustomWidget<Utils::LineColumnLabel>
113 {
114     Q_OBJECT
115     Q_INTERFACES(QDesignerCustomWidgetInterface)
116 public:
117     explicit LineColumnLabel_CW(QObject *parent = 0);
118 };
119
120 class PathChooser_CW :
121     public QObject,
122     public CustomWidget<Utils::PathChooser>
123 {
124     Q_OBJECT
125     Q_INTERFACES(QDesignerCustomWidgetInterface)
126 public:
127     explicit PathChooser_CW(QObject *parent = 0);
128 };
129
130 class IconButton_CW :
131     public QObject,
132     public CustomWidget<Utils::IconButton>
133 {
134     Q_OBJECT
135     Q_INTERFACES(QDesignerCustomWidgetInterface)
136 public:
137     explicit IconButton_CW(QObject *parent = 0);
138 };
139
140 class FancyLineEdit_CW :
141     public QObject,
142     public CustomWidget<Utils::FancyLineEdit>
143 {
144     Q_OBJECT
145     Q_INTERFACES(QDesignerCustomWidgetInterface)
146 public:
147     explicit FancyLineEdit_CW(QObject *parent = 0);
148
149     virtual QWidget *createWidget(QWidget *parent);
150 };
151
152 class FilterLineEdit_CW :
153     public QObject,
154     public CustomWidget<Utils::FilterLineEdit>
155 {
156     Q_OBJECT
157     Q_INTERFACES(QDesignerCustomWidgetInterface)
158 public:
159     explicit FilterLineEdit_CW(QObject *parent = 0);
160 };
161
162 class QtColorButton_CW :
163     public QObject,
164     public CustomWidget<Utils::QtColorButton>
165 {
166     Q_OBJECT
167     Q_INTERFACES(QDesignerCustomWidgetInterface)
168 public:
169     explicit QtColorButton_CW(QObject *parent = 0);
170 };
171
172 class SubmitEditorWidget_CW :
173     public QObject,
174     public CustomWidget<Utils::SubmitEditorWidget>
175 {
176     Q_OBJECT
177     Q_INTERFACES(QDesignerCustomWidgetInterface)
178 public:
179     explicit SubmitEditorWidget_CW(QObject *parent = 0);
180 };
181
182 class SubmitFieldWidget_CW :
183     public QObject,
184     public CustomWidget<Utils::SubmitFieldWidget>
185 {
186     Q_OBJECT
187     Q_INTERFACES(QDesignerCustomWidgetInterface)
188 public:
189     explicit SubmitFieldWidget_CW(QObject *parent = 0);
190 };
191
192 class PathListEditor_CW :
193     public QObject,
194     public CustomWidget<Utils::PathListEditor>
195 {
196     Q_OBJECT
197     Q_INTERFACES(QDesignerCustomWidgetInterface)
198 public:
199     explicit PathListEditor_CW(QObject *parent = 0);
200 };
201
202 class DetailsButton_CW :
203     public QObject,
204     public CustomWidget<Utils::DetailsButton>
205 {
206     Q_OBJECT
207     Q_INTERFACES(QDesignerCustomWidgetInterface)
208 public:
209     explicit DetailsButton_CW(QObject *parent = 0);
210 };
211
212 class StyledBar_CW :
213     public QObject,
214     public CustomWidget<Utils::StyledBar>
215 {
216     Q_OBJECT
217     Q_INTERFACES(QDesignerCustomWidgetInterface)
218 public:
219     explicit StyledBar_CW(QObject *parent = 0);
220 };
221
222 class StyledSeparator_CW :
223     public QObject,
224     public CustomWidget<Utils::StyledSeparator>
225 {
226     Q_OBJECT
227     Q_INTERFACES(QDesignerCustomWidgetInterface)
228 public:
229     explicit StyledSeparator_CW(QObject *parent = 0);
230 };
231
232 class Wizard_CW :
233     public QObject,
234     public CustomWidget<Utils::Wizard>
235 {
236     Q_OBJECT
237     Q_INTERFACES(QDesignerCustomWidgetInterface)
238 public:
239     explicit Wizard_CW(QObject *parent = 0);
240 };
241
242 class WelcomePageWidget_CW :
243     public QObject,
244     public CustomWidget<Utils::WelcomeModeTreeWidget>
245 {
246     Q_OBJECT
247     Q_INTERFACES(QDesignerCustomWidgetInterface)
248 public:
249     explicit WelcomePageWidget_CW(QObject *parent = 0);
250     virtual QWidget *createWidget(QWidget *parent);
251 };
252
253 class WelcomeModeLabel_CW :
254     public QObject,
255     public CustomWidget<Utils::WelcomeModeLabel>
256 {
257     Q_OBJECT
258     Q_INTERFACES(QDesignerCustomWidgetInterface)
259 public:
260     explicit WelcomeModeLabel_CW(QObject *parent = 0);
261 };
262
263 class CrumblePath_CW :
264     public QObject,
265     public CustomWidget<Utils::CrumblePath>
266 {
267     Q_OBJECT
268     Q_INTERFACES(QDesignerCustomWidgetInterface)
269 public:
270     explicit CrumblePath_CW(QObject *parent = 0);
271 };
272
273 // Details Widget: plugin + simple, hacky container extension that
274 // accepts only one page.
275
276 class DetailsWidget_CW :
277     public QObject,
278     public CustomWidget<Utils::DetailsWidget>
279 {
280     Q_OBJECT
281     Q_INTERFACES(QDesignerCustomWidgetInterface)
282 public:
283     explicit DetailsWidget_CW(QObject *parent = 0);
284     QString domXml() const;
285     void initialize(QDesignerFormEditorInterface *core);
286 };
287
288 class DetailsWidgetContainerExtension: public QObject,
289                                          public QDesignerContainerExtension
290 {
291     Q_OBJECT
292     Q_INTERFACES(QDesignerContainerExtension)
293 public:
294     explicit DetailsWidgetContainerExtension(Utils::DetailsWidget *widget, QObject *parent);
295
296     void addWidget(QWidget *widget);
297     int count() const;
298     int currentIndex() const;
299     void insertWidget(int index, QWidget *widget);
300     void remove(int index);
301     void setCurrentIndex(int index);
302     QWidget *widget(int index) const;
303
304 private:
305     Utils::DetailsWidget *m_detailsWidget;
306 };
307
308 class DetailsWidgetExtensionFactory: public QExtensionFactory
309 {
310     Q_OBJECT
311 public:
312     explicit DetailsWidgetExtensionFactory(QExtensionManager *parent = 0);
313
314 protected:
315     QObject *createExtension(QObject *object, const QString &iid, QObject *parent) const;
316 };
317
318 // ------------ Collection
319
320 class WidgetCollection : public QObject, public QDesignerCustomWidgetCollectionInterface
321 {
322     Q_OBJECT
323     Q_INTERFACES(QDesignerCustomWidgetCollectionInterface)
324 public:
325     explicit WidgetCollection(QObject *parent = 0);
326
327     virtual QList<QDesignerCustomWidgetInterface*> customWidgets() const;
328
329 private:
330     QList<QDesignerCustomWidgetInterface*> m_plugins;
331 };
332
333 #endif // CUSTOMWIDGETS_H