Qt 4.8
qaxwidget.h
Go to the documentation of this file.
1 /****************************************************************************
2 **
3 ** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
4 ** Contact: http://www.qt-project.org/legal
5 **
6 ** This file is part of the ActiveQt framework of the Qt Toolkit.
7 **
8 ** $QT_BEGIN_LICENSE:BSD$
9 ** You may use this file under the terms of the BSD license as follows:
10 **
11 ** "Redistribution and use in source and binary forms, with or without
12 ** modification, are permitted provided that the following conditions are
13 ** met:
14 ** * Redistributions of source code must retain the above copyright
15 ** notice, this list of conditions and the following disclaimer.
16 ** * Redistributions in binary form must reproduce the above copyright
17 ** notice, this list of conditions and the following disclaimer in
18 ** the documentation and/or other materials provided with the
19 ** distribution.
20 ** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names
21 ** of its contributors may be used to endorse or promote products derived
22 ** from this software without specific prior written permission.
23 **
24 **
25 ** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
26 ** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
27 ** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
28 ** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
29 ** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
30 ** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
31 ** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
32 ** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
33 ** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
34 ** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
35 ** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
36 **
37 ** $QT_END_LICENSE$
38 **
39 ****************************************************************************/
40 
41 #ifndef QAXWIDGET_H
42 #define QAXWIDGET_H
43 
44 #include <ActiveQt/qaxbase.h>
45 #include <QtGui/qwidget.h>
46 
48 
50 
51 QT_MODULE(ActiveQt)
52 
53 #ifndef QT_NO_WIN_ACTIVEQT
54 
55 class QAxHostWindow;
56 class QAxAggregated;
57 
58 class QAxClientSite;
59 
60 class QAxWidget : public QWidget, public QAxBase
61 {
62 public:
63  const QMetaObject *metaObject() const;
64  void* qt_metacast(const char*);
65  int qt_metacall(QMetaObject::Call, int, void **);
66  QObject* qObject() const { return (QWidget*)this; }
67  const char *className() const;
68 
69  QAxWidget(QWidget* parent = 0, Qt::WindowFlags f = 0);
70  QAxWidget(const QString &c, QWidget *parent = 0, Qt::WindowFlags f = 0);
71  QAxWidget(IUnknown *iface, QWidget *parent = 0, Qt::WindowFlags f = 0);
72  ~QAxWidget();
73 
74  void clear();
75  bool doVerb(const QString &verb);
76 
77  QSize sizeHint() const;
78  QSize minimumSizeHint() const;
79 
80  virtual QAxAggregated *createAggregate();
81 
82 protected:
83  bool initialize(IUnknown**);
84  virtual bool createHostWindow(bool);
85  bool createHostWindow(bool, const QByteArray&);
86 
87  void changeEvent(QEvent *e);
88  void resizeEvent(QResizeEvent *);
89 
90  virtual bool translateKeyEvent(int message, int keycode) const;
91 
92  void connectNotify(const char *signal);
93 private:
94  friend class QAxClientSite;
96 
97  const QMetaObject *parentMetaObject() const;
99 };
100 
101 #if defined Q_CC_MSVC && _MSC_VER < 1300
102 template <> inline QAxWidget *qobject_cast_helper<QAxWidget*>(const QObject *o, QAxWidget *)
103 #else
104 template <> inline QAxWidget *qobject_cast<QAxWidget*>(const QObject *o)
105 #endif
106 {
107  void *result = o ? const_cast<QObject *>(o)->qt_metacast("QAxWidget") : 0;
108  return (QAxWidget*)(result);
109 }
110 
111 #if defined Q_CC_MSVC && _MSC_VER < 1300
112 template <> inline QAxWidget *qobject_cast_helper<QAxWidget*>(QObject *o, QAxWidget *)
113 #else
114 template <> inline QAxWidget *qobject_cast<QAxWidget*>(QObject *o)
115 #endif
116 {
117  void *result = o ? o->qt_metacast("QAxWidget") : 0;
118  return (QAxWidget*)(result);
119 }
120 
122 #endif // QT_NO_WIN_ACTIVEQT
123 
125 
126 #endif // QAXWIDGET_H
The QMetaObject class contains meta-information about Qt objects.
Definition: qobjectdefs.h:304
unsigned char c[8]
Definition: qnumeric_p.h:62
#define QT_END_NAMESPACE
This macro expands to.
Definition: qglobal.h:90
#define QT_MODULE(x)
Definition: qglobal.h:2783
int keycode
void signal(const QString &, int, void *)
This generic signal gets emitted when the COM object issues the event name.
#define QT_BEGIN_HEADER
Definition: qglobal.h:136
The QByteArray class provides an array of bytes.
Definition: qbytearray.h:135
The QWidget class is the base class of all user interface objects.
Definition: qwidget.h:150
QSize sizeHint() const
Reimplemented Function
Definition: qaxwidget.cpp:2136
const QMetaObject * parentMetaObject() const
Definition: qaxwidget.cpp:2099
The QString class provides a Unicode character string.
Definition: qstring.h:83
The QObject class is the base class of all Qt objects.
Definition: qobject.h:111
void clear()
Shuts down the ActiveX control.
Definition: qaxwidget.cpp:2030
int qt_metacall(QMetaObject::Call, int, void **)
Definition: qaxwidget.cpp:2125
QObject * qObject() const
Definition: qaxwidget.h:66
The QAxAggregated class is an abstract base class for implementations of additional COM interfaces...
Definition: qaxaggregated.h:58
QSize minimumSizeHint() const
Reimplemented Function
Definition: qaxwidget.cpp:2150
#define QT_BEGIN_NAMESPACE
This macro expands to.
Definition: qglobal.h:89
bool initialize(IUnknown **)
Calls QAxBase::initialize(ptr), and embeds the control in this widget by calling createHostWindow(fal...
Definition: qaxwidget.cpp:1943
virtual bool translateKeyEvent(int message, int keycode) const
Reimplement this function to pass certain key events to the ActiveX control.
Definition: qaxwidget.cpp:2238
const QMetaObject * metaObject() const
Definition: qaxwidget.cpp:2091
The QResizeEvent class contains event parameters for resize events.
Definition: qevent.h:349
static QMetaObject staticMetaObject
Definition: qaxwidget.h:98
void connectNotify()
Connects to all event interfaces of the object.
Definition: qaxbase.cpp:3282
The QAxWidget class is a QWidget that wraps an ActiveX control.
Definition: qaxwidget.h:60
void resizeEvent(QResizeEvent *)
Reimplemented Function
Definition: qaxwidget.cpp:2191
bool doVerb(const QString &verb)
Requests the ActiveX control to perform the action verb.
Definition: qaxwidget.cpp:2073
const char * className() const
Definition: qaxwidget.cpp:2117
QAxWidget(QWidget *parent=0, Qt::WindowFlags f=0)
Creates an empty QAxWidget widget and propagates parent and f to the QWidget constructor.
Definition: qaxwidget.cpp:1891
QObject * parent() const
Returns a pointer to the parent object.
Definition: qobject.h:273
void * qt_metacast(const char *)
Definition: qaxwidget.cpp:2107
~QAxWidget()
Shuts down the ActiveX control and destroys the QAxWidget widget, cleaning up all allocated resources...
Definition: qaxwidget.cpp:1923
The QSize class defines the size of a two-dimensional object using integer point precision.
Definition: qsize.h:53
QAxClientSite * container
Definition: qaxwidget.h:95
virtual QAxAggregated * createAggregate()
Reimplement this function when you want to implement additional COM interfaces for the client site of...
Definition: qaxwidget.cpp:2017
The QEvent class is the base class of all event classes.
Definition: qcoreevent.h:56
#define QT_END_HEADER
Definition: qglobal.h:137
The QAxBase class is an abstract class that provides an API to initialize and access a COM object...
Definition: qaxbase.h:66
void changeEvent(QEvent *e)
Reimplemented Function
Definition: qaxwidget.cpp:2164
virtual bool createHostWindow(bool)
Creates the client site for the ActiveX control, and returns true if the control could be embedded su...
Definition: qaxwidget.cpp:1962