1/*
2 * Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies)
3 *
4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions
6 * are met:
7 * 1. Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer.
9 * 2. Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the
11 * documentation and/or other materials provided with the distribution.
12 *
13 * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
14 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
15 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
16 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
17 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
18 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
19 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
20 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
21 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
22 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
23 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
24 */
25
26#ifndef QWEBPAGECLIENT_H
27#define QWEBPAGECLIENT_H
28
29#include <QCursor>
30#include <QObject>
31#include <QPalette>
32#include <QRect>
33
34class QWebPageClient : public QObject {
35Q_OBJECT
36public:
37 virtual void scroll(int dx, int dy, const QRect&) = 0;
38 virtual void update(const QRect&) = 0;
39 virtual void setInputMethodEnabled(bool enable) = 0;
40#if QT_VERSION >= 0x040600
41 virtual void setInputMethodHint(Qt::InputMethodHint hint, bool enable) = 0;
42#endif
43 inline void resetCursor()
44 {
45#ifndef QT_NO_CURSOR
46 if (!cursor().bitmap() && cursor().shape() == m_lastCursor.shape())
47 return;
48 updateCursor(m_lastCursor);
49#endif
50 }
51
52 inline void setCursor(const QCursor& cursor)
53 {
54#ifndef QT_NO_CURSOR
55 m_lastCursor = cursor;
56 if (!cursor.bitmap() && cursor.shape() == this->cursor().shape())
57 return;
58 updateCursor(cursor);
59#endif
60 }
61
62 virtual QPalette palette() const = 0;
63 virtual int screenNumber() const = 0;
64 virtual QWidget* ownerWidget() const = 0;
65
66 virtual QObject* pluginParent() const = 0;
67
68protected:
69#ifndef QT_NO_CURSOR
70 virtual QCursor cursor() const = 0;
71 virtual void updateCursor(const QCursor& cursor) = 0;
72#endif
73
74private:
75#ifndef QT_NO_CURSOR
76 QCursor m_lastCursor;
77#endif
78};
79
80#endif