| 1 | /**************************************************************************** | 
|---|
| 2 | ** | 
|---|
| 3 | ** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). | 
|---|
| 4 | ** Contact: Qt Software Information (qt-info@nokia.com) | 
|---|
| 5 | ** | 
|---|
| 6 | ** This file is part of the examples of the Qt Toolkit. | 
|---|
| 7 | ** | 
|---|
| 8 | ** $QT_BEGIN_LICENSE:LGPL$ | 
|---|
| 9 | ** Commercial Usage | 
|---|
| 10 | ** Licensees holding valid Qt Commercial licenses may use this file in | 
|---|
| 11 | ** accordance with the Qt Commercial License Agreement provided with the | 
|---|
| 12 | ** Software or, alternatively, in accordance with the terms contained in | 
|---|
| 13 | ** a written agreement between you and Nokia. | 
|---|
| 14 | ** | 
|---|
| 15 | ** GNU Lesser General Public License Usage | 
|---|
| 16 | ** Alternatively, this file may be used under the terms of the GNU Lesser | 
|---|
| 17 | ** General Public License version 2.1 as published by the Free Software | 
|---|
| 18 | ** Foundation and appearing in the file LICENSE.LGPL included in the | 
|---|
| 19 | ** packaging of this file.  Please review the following information to | 
|---|
| 20 | ** ensure the GNU Lesser General Public License version 2.1 requirements | 
|---|
| 21 | ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. | 
|---|
| 22 | ** | 
|---|
| 23 | ** In addition, as a special exception, Nokia gives you certain | 
|---|
| 24 | ** additional rights. These rights are described in the Nokia Qt LGPL | 
|---|
| 25 | ** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this | 
|---|
| 26 | ** package. | 
|---|
| 27 | ** | 
|---|
| 28 | ** GNU General Public License Usage | 
|---|
| 29 | ** Alternatively, this file may be used under the terms of the GNU | 
|---|
| 30 | ** General Public License version 3.0 as published by the Free Software | 
|---|
| 31 | ** Foundation and appearing in the file LICENSE.GPL included in the | 
|---|
| 32 | ** packaging of this file.  Please review the following information to | 
|---|
| 33 | ** ensure the GNU General Public License version 3.0 requirements will be | 
|---|
| 34 | ** met: http://www.gnu.org/copyleft/gpl.html. | 
|---|
| 35 | ** | 
|---|
| 36 | ** If you are unsure which license is appropriate for your use, please | 
|---|
| 37 | ** contact the sales department at qt-sales@nokia.com. | 
|---|
| 38 | ** $QT_END_LICENSE$ | 
|---|
| 39 | ** | 
|---|
| 40 | ****************************************************************************/ | 
|---|
| 41 |  | 
|---|
| 42 | #include <QAxFactory> | 
|---|
| 43 | #include <QCheckBox> | 
|---|
| 44 | #include <QRadioButton> | 
|---|
| 45 | #include <QPushButton> | 
|---|
| 46 | #include <QToolButton> | 
|---|
| 47 | #include <QPixmap> | 
|---|
| 48 |  | 
|---|
| 49 | /* XPM */ | 
|---|
| 50 | static const char *fileopen[] = { | 
|---|
| 51 | "    16    13        5            1", | 
|---|
| 52 | ". c #040404", | 
|---|
| 53 | "# c #808304", | 
|---|
| 54 | "a c None", | 
|---|
| 55 | "b c #f3f704", | 
|---|
| 56 | "c c #f3f7f3", | 
|---|
| 57 | "aaaaaaaaa...aaaa", | 
|---|
| 58 | "aaaaaaaa.aaa.a.a", | 
|---|
| 59 | "aaaaaaaaaaaaa..a", | 
|---|
| 60 | "a...aaaaaaaa...a", | 
|---|
| 61 | ".bcb.......aaaaa", | 
|---|
| 62 | ".cbcbcbcbc.aaaaa", | 
|---|
| 63 | ".bcbcbcbcb.aaaaa", | 
|---|
| 64 | ".cbcb...........", | 
|---|
| 65 | ".bcb.#########.a", | 
|---|
| 66 | ".cb.#########.aa", | 
|---|
| 67 | ".b.#########.aaa", | 
|---|
| 68 | "..#########.aaaa", | 
|---|
| 69 | "...........aaaaa" | 
|---|
| 70 | }; | 
|---|
| 71 |  | 
|---|
| 72 |  | 
|---|
| 73 | //! [0] | 
|---|
| 74 | class ActiveQtFactory : public QAxFactory | 
|---|
| 75 | { | 
|---|
| 76 | public: | 
|---|
| 77 | ActiveQtFactory( const QUuid &lib, const QUuid &app ) | 
|---|
| 78 | : QAxFactory( lib, app ) | 
|---|
| 79 | {} | 
|---|
| 80 | QStringList featureList() const | 
|---|
| 81 | { | 
|---|
| 82 | QStringList list; | 
|---|
| 83 | list << "QCheckBox"; | 
|---|
| 84 | list << "QRadioButton"; | 
|---|
| 85 | list << "QPushButton"; | 
|---|
| 86 | list << "QToolButton"; | 
|---|
| 87 | return list; | 
|---|
| 88 | } | 
|---|
| 89 | QObject *createObject(const QString &key) | 
|---|
| 90 | { | 
|---|
| 91 | if ( key == "QCheckBox" ) | 
|---|
| 92 | return new QCheckBox(0); | 
|---|
| 93 | if ( key == "QRadioButton" ) | 
|---|
| 94 | return new QRadioButton(0); | 
|---|
| 95 | if ( key == "QPushButton" ) | 
|---|
| 96 | return new QPushButton(0 ); | 
|---|
| 97 | if ( key == "QToolButton" ) { | 
|---|
| 98 | QToolButton *tb = new QToolButton(0); | 
|---|
| 99 | //          tb->setIcon( QPixmap(fileopen) ); | 
|---|
| 100 | return tb; | 
|---|
| 101 | } | 
|---|
| 102 |  | 
|---|
| 103 | return 0; | 
|---|
| 104 | } | 
|---|
| 105 | const QMetaObject *metaObject( const QString &key ) const | 
|---|
| 106 | { | 
|---|
| 107 | if ( key == "QCheckBox" ) | 
|---|
| 108 | return &QCheckBox::staticMetaObject; | 
|---|
| 109 | if ( key == "QRadioButton" ) | 
|---|
| 110 | return &QRadioButton::staticMetaObject; | 
|---|
| 111 | if ( key == "QPushButton" ) | 
|---|
| 112 | return &QPushButton::staticMetaObject; | 
|---|
| 113 | if ( key == "QToolButton" ) | 
|---|
| 114 | return &QToolButton::staticMetaObject; | 
|---|
| 115 |  | 
|---|
| 116 | return 0; | 
|---|
| 117 | } | 
|---|
| 118 | QUuid classID( const QString &key ) const | 
|---|
| 119 | { | 
|---|
| 120 | if ( key == "QCheckBox" ) | 
|---|
| 121 | return "{6E795DE9-872D-43CF-A831-496EF9D86C68}"; | 
|---|
| 122 | if ( key == "QRadioButton" ) | 
|---|
| 123 | return "{AFCF78C8-446C-409A-93B3-BA2959039189}"; | 
|---|
| 124 | if ( key == "QPushButton" ) | 
|---|
| 125 | return "{2B262458-A4B6-468B-B7D4-CF5FEE0A7092}"; | 
|---|
| 126 | if ( key == "QToolButton" ) | 
|---|
| 127 | return "{7c0ffe7a-60c3-4666-bde2-5cf2b54390a1}"; | 
|---|
| 128 |  | 
|---|
| 129 | return QUuid(); | 
|---|
| 130 | } | 
|---|
| 131 | QUuid interfaceID( const QString &key ) const | 
|---|
| 132 | { | 
|---|
| 133 | if ( key == "QCheckBox" ) | 
|---|
| 134 | return "{4FD39DD7-2DE0-43C1-A8C2-27C51A052810}"; | 
|---|
| 135 | if ( key == "QRadioButton" ) | 
|---|
| 136 | return "{7CC8AE30-206C-48A3-A009-B0A088026C2F}"; | 
|---|
| 137 | if ( key == "QPushButton" ) | 
|---|
| 138 | return "{06831CC9-59B6-436A-9578-6D53E5AD03D3}"; | 
|---|
| 139 | if ( key == "QToolButton" ) | 
|---|
| 140 | return "{6726080f-d63d-4950-a366-9bf33e5cdf84}"; | 
|---|
| 141 |  | 
|---|
| 142 | return QUuid(); | 
|---|
| 143 | } | 
|---|
| 144 | QUuid eventsID( const QString &key ) const | 
|---|
| 145 | { | 
|---|
| 146 | if ( key == "QCheckBox" ) | 
|---|
| 147 | return "{FDB6FFBE-56A3-4E90-8F4D-198488418B3A}"; | 
|---|
| 148 | if ( key == "QRadioButton" ) | 
|---|
| 149 | return "{73EE4860-684C-4A66-BF63-9B9EFFA0CBE5}"; | 
|---|
| 150 | if ( key == "QPushButton" ) | 
|---|
| 151 | return "{3CC3F17F-EA59-4B58-BBD3-842D467131DD}"; | 
|---|
| 152 | if ( key == "QToolButton" ) | 
|---|
| 153 | return "{f4d421fd-4ead-4fd9-8a25-440766939639}"; | 
|---|
| 154 |  | 
|---|
| 155 | return QUuid(); | 
|---|
| 156 | } | 
|---|
| 157 | }; | 
|---|
| 158 | //! [0] //! [1] | 
|---|
| 159 |  | 
|---|
| 160 | QAXFACTORY_EXPORT( ActiveQtFactory, "{3B756301-0075-4E40-8BE8-5A81DE2426B7}", "{AB068077-4924-406a-BBAF-42D91C8727DD}" ) | 
|---|
| 161 | //! [1] | 
|---|