src/activeqt/container/qaxwidget.h
changeset 0 1918ee327afb
child 4 3b1da2848fc7
equal deleted inserted replaced
-1:000000000000 0:1918ee327afb
       
     1 /****************************************************************************
       
     2 **
       
     3 ** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
       
     4 ** All rights reserved.
       
     5 ** Contact: Nokia Corporation (qt-info@nokia.com)
       
     6 **
       
     7 ** This file is part of the ActiveQt framework of the Qt Toolkit.
       
     8 **
       
     9 ** $QT_BEGIN_LICENSE:BSD$
       
    10 ** You may use this file under the terms of the BSD license as follows:
       
    11 **
       
    12 ** "Redistribution and use in source and binary forms, with or without
       
    13 ** modification, are permitted provided that the following conditions are
       
    14 ** met:
       
    15 **   * Redistributions of source code must retain the above copyright
       
    16 **     notice, this list of conditions and the following disclaimer.
       
    17 **   * Redistributions in binary form must reproduce the above copyright
       
    18 **     notice, this list of conditions and the following disclaimer in
       
    19 **     the documentation and/or other materials provided with the
       
    20 **     distribution.
       
    21 **   * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
       
    22 **     the names of its contributors may be used to endorse or promote
       
    23 **     products derived from this software without specific prior written
       
    24 **     permission.
       
    25 **
       
    26 ** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
       
    27 ** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
       
    28 ** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
       
    29 ** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
       
    30 ** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
       
    31 ** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
       
    32 ** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
       
    33 ** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
       
    34 ** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
       
    35 ** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
       
    36 ** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
       
    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 
       
    47 QT_BEGIN_HEADER
       
    48 
       
    49 QT_BEGIN_NAMESPACE
       
    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;
       
    95     QAxClientSite *container;
       
    96     
       
    97     const QMetaObject *parentMetaObject() const;
       
    98     static QMetaObject staticMetaObject;
       
    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 
       
   121 QT_END_NAMESPACE
       
   122 #endif // QT_NO_WIN_ACTIVEQT
       
   123 
       
   124 QT_END_HEADER
       
   125 
       
   126 #endif // QAXWIDGET_H