1 /****************************************************************************
2 ** $Id: qt/qwidgetplugin.h   3.3.8   edited Jan 11 14:46 $
3 **
4 ** Definition of QWidgetPlugin class
5 **
6 ** Created : 010920
7 **
8 ** Copyright (C) 2001-2007 Trolltech ASA.  All rights reserved.
9 **
10 ** This file is part of the widgets module of the Qt GUI Toolkit.
11 **
12 ** This file may be distributed under the terms of the Q Public License
13 ** as defined by Trolltech ASA of Norway and appearing in the file
14 ** LICENSE.QPL included in the packaging of this file.
15 **
16 ** This file may be distributed and/or modified under the terms of the
17 ** GNU General Public License version 2 as published by the Free Software
18 ** Foundation and appearing in the file LICENSE.GPL included in the
19 ** packaging of this file.
20 **
21 ** Licensees holding valid Qt Enterprise Edition or Qt Professional Edition
22 ** licenses may use this file in accordance with the Qt Commercial License
23 ** Agreement provided with the Software.
24 **
25 ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
26 ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
27 **
28 ** See http://www.trolltech.com/pricing.html or email sales@trolltech.com for
29 **   information about Qt Commercial License Agreements.
30 ** See http://www.trolltech.com/qpl/ for QPL licensing information.
31 ** See http://www.trolltech.com/gpl/ for GPL licensing information.
32 **
33 ** Contact info@trolltech.com if any conditions of this licensing are
34 ** not clear to you.
35 **
36 **********************************************************************/
37 
38 #ifndef QWIDGETPLUGIN_H
39 #define QWIDGETPLUGIN_H
40 
41 #ifndef QT_H
42 #include "qgplugin.h"
43 #include "qstringlist.h"
44 #include "qiconset.h"
45 #endif // QT_H
46 #ifndef QT_NO_WIDGETPLUGIN
47 
48 #ifdef Q_WS_WIN
49 #ifdef QT_PLUGIN
50 #define QT_WIDGET_PLUGIN_EXPORT __declspec(dllexport)
51 #else
52 #define QT_WIDGET_PLUGIN_EXPORT __declspec(dllimport)
53 #endif
54 #else
55 #define QT_WIDGET_PLUGIN_EXPORT
56 #endif
57 
58 class QWidgetPluginPrivate;
59 class QWidget;
60 
61 class Q_EXPORT QWidgetPlugin : public QGPlugin
62 {
63     Q_OBJECT
64 public:
65     QWidgetPlugin();
66     ~QWidgetPlugin();
67 
68     virtual QStringList keys() const = 0;
69     virtual QWidget *create( const QString &key, QWidget *parent = 0, const char *name = 0 ) = 0;
70 
71     virtual QString group( const QString &key ) const;
72     virtual QIconSet iconSet( const QString &key ) const;
73     virtual QString includeFile( const QString &key ) const;
74     virtual QString toolTip( const QString &key ) const;
75     virtual QString whatsThis( const QString &key ) const;
76     virtual bool isContainer( const QString &key ) const;
77 
78 private:
79     QWidgetPluginPrivate *d;
80 };
81 
82 #ifdef QT_CONTAINER_CUSTOM_WIDGETS
83 
84 class QWidgetContainerPluginPrivate;
85 
86 class Q_EXPORT QWidgetContainerPlugin : public QWidgetPlugin
87 {
88 
89 public:
90     QWidgetContainerPlugin();
91     ~QWidgetContainerPlugin();
92 
93     virtual QWidget* containerOfWidget( const QString &key, QWidget *container ) const;
94     virtual bool isPassiveInteractor( const QString &key, QWidget *container ) const;
95 
96     virtual bool supportsPages( const QString &key ) const;
97 
98     virtual QWidget *addPage( const QString &key, QWidget *container,
99 			      const QString &name, int index ) const;
100     virtual void insertPage( const QString &key, QWidget *container,
101 			     const QString &name, int index, QWidget *page ) const;
102     virtual void removePage( const QString &key, QWidget *container, int index ) const;
103     virtual void movePage( const QString &key, QWidget *container, int fromIndex, int toIndex ) const;
104     virtual int count( const QString &key, QWidget *container ) const;
105     virtual int currentIndex( const QString &key, QWidget *container ) const;
106     virtual QString pageLabel( const QString &key, QWidget *container, int index ) const;
107     virtual QWidget *page( const QString &key, QWidget *container, int index ) const;
108     virtual void renamePage( const QString &key, QWidget *container,
109 			     int index, const QString &newName ) const;
110     virtual QWidgetList pages( const QString &key, QWidget *container ) const;
111     virtual QString createCode( const QString &key, const QString &container,
112 				const QString &page, const QString &pageName ) const;
113 };
114 
115 #endif // QT_CONTAINER_CUSTOM_WIDGETS
116 #endif // QT_NO_WIDGETPLUGIN
117 #endif // QWIDGETPLUGIN_H
118