widget/qt/mozqwidget.h

Thu, 22 Jan 2015 13:21:57 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Thu, 22 Jan 2015 13:21:57 +0100
branch
TOR_BUG_9701
changeset 15
b8a032363ba2
permissions
-rw-r--r--

Incorporate requested changes from Mozilla in review:
https://bugzilla.mozilla.org/show_bug.cgi?id=1123480#c6

     1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
     2 /* vim: set ts=4 et sw=4 tw=80: */
     3 /* This Source Code Form is subject to the terms of the Mozilla Public
     4  * License, v. 2.0. If a copy of the MPL was not distributed with this
     5  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
     7 #ifndef MOZQWIDGET_H
     8 #define MOZQWIDGET_H
    10 #include "nsIWidget.h"
    12 #include <QtGui/QWindow>
    14 QT_BEGIN_NAMESPACE
    15 class QPainter;
    16 class QExposeEvent;
    17 class QResizeEvent;
    18 QT_END_NAMESPACE
    20 namespace mozilla {
    21 namespace widget {
    23 class nsWindow;
    25 class MozQWidget : public QWindow
    26 {
    27     Q_OBJECT
    28 public:
    29     explicit MozQWidget(nsWindow* aReceiver, QWindow* aParent = 0);
    30     ~MozQWidget();
    32     virtual void render(QPainter* painter);
    34     virtual nsWindow* getReceiver() { return mReceiver; };
    35     virtual void dropReceiver() { mReceiver = nullptr; };
    36     virtual void SetCursor(nsCursor aCursor);
    38 public Q_SLOTS:
    39     void renderLater();
    40     void renderNow();
    42 protected:
    43     virtual bool event(QEvent* event);
    44     virtual void exposeEvent(QExposeEvent* event);
    45     virtual void focusInEvent(QFocusEvent* event);
    46     virtual void focusOutEvent(QFocusEvent* event);
    47     virtual void hideEvent(QHideEvent* event);
    48     virtual void keyPressEvent(QKeyEvent* event);
    49     virtual void keyReleaseEvent(QKeyEvent* event);
    50     virtual void mouseDoubleClickEvent(QMouseEvent* event);
    51     virtual void mouseMoveEvent(QMouseEvent* event);
    52     virtual void mousePressEvent(QMouseEvent* event);
    53     virtual void mouseReleaseEvent(QMouseEvent* event);
    54     virtual void moveEvent(QMoveEvent* event);
    55     virtual void resizeEvent(QResizeEvent* event);
    56     virtual void showEvent(QShowEvent* event);
    57     virtual void tabletEvent(QTabletEvent* event);
    58     virtual void touchEvent(QTouchEvent* event);
    59     virtual void wheelEvent(QWheelEvent* event);
    61 private:
    62     nsWindow* mReceiver;
    63     bool mUpdatePending;
    64     nsWindowType mWindowType;
    65 };
    67 } // namespace widget
    68 } // namespace mozilla
    70 #endif // MOZQWIDGET_H

mercurial