1231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block/*
2231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block * Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies)
3231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block *
4231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block * Redistribution and use in source and binary forms, with or without
5231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block * modification, are permitted provided that the following conditions
6231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block * are met:
7231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block * 1. Redistributions of source code must retain the above copyright
8231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block *    notice, this list of conditions and the following disclaimer.
9231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block * 2. Redistributions in binary form must reproduce the above copyright
10231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block *    notice, this list of conditions and the following disclaimer in the
11231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block *    documentation and/or other materials provided with the distribution.
12231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block *
13231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
14231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
15231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
16231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL APPLE COMPUTER, INC. OR
17231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
18231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
19231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
20231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
21231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
22231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
23231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
24231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block */
25231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block
26231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block#ifndef QWebPageClient_h
27231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block#define QWebPageClient_h
28231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block
29643ca7872b450ea4efacab6188849e5aac2ba161Steve Block#ifndef QT_NO_CURSOR
30643ca7872b450ea4efacab6188849e5aac2ba161Steve Block#include <QCursor>
31643ca7872b450ea4efacab6188849e5aac2ba161Steve Block#endif
32d0825bca7fe65beaee391d30da42e937db621564Steve Block
33e14391e94c850b8bd03680c23b38978db68687a8John Reck#if USE(ACCELERATED_COMPOSITING)
34e14391e94c850b8bd03680c23b38978db68687a8John Reck#include <GraphicsLayer.h>
35e14391e94c850b8bd03680c23b38978db68687a8John Reck#endif
36e14391e94c850b8bd03680c23b38978db68687a8John Reck
37a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch#include <QPalette>
38231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block#include <QRect>
39231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block
40d0825bca7fe65beaee391d30da42e937db621564Steve BlockQT_BEGIN_NAMESPACE
41d0825bca7fe65beaee391d30da42e937db621564Steve Blockclass QStyle;
42d0825bca7fe65beaee391d30da42e937db621564Steve BlockQT_END_NAMESPACE
43d0825bca7fe65beaee391d30da42e937db621564Steve Block
44231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Blockclass QWebPageClient {
45231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Blockpublic:
46643ca7872b450ea4efacab6188849e5aac2ba161Steve Block    virtual ~QWebPageClient() { }
47dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block
48dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block    virtual bool isQWidgetClient() const { return false; }
49dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block
50231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block    virtual void scroll(int dx, int dy, const QRect&) = 0;
51231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block    virtual void update(const QRect&) = 0;
52cac0f67c402d107cdb10971b95719e2ff9c7c76bSteve Block    virtual void setInputMethodEnabled(bool enable) = 0;
53643ca7872b450ea4efacab6188849e5aac2ba161Steve Block    virtual bool inputMethodEnabled() const = 0;
54d0825bca7fe65beaee391d30da42e937db621564Steve Block#if USE(ACCELERATED_COMPOSITING)
55e14391e94c850b8bd03680c23b38978db68687a8John Reck    virtual void setRootGraphicsLayer(WebCore::PlatformLayer* layer) { }
56d0825bca7fe65beaee391d30da42e937db621564Steve Block
57d0825bca7fe65beaee391d30da42e937db621564Steve Block    // this gets called when the compositor wants us to sync the layers
58d0825bca7fe65beaee391d30da42e937db621564Steve Block    // if scheduleSync is true, we schedule a sync ourselves. otherwise,
59d0825bca7fe65beaee391d30da42e937db621564Steve Block    // we wait for the next update and sync the layers then.
60d0825bca7fe65beaee391d30da42e937db621564Steve Block    virtual void markForSync(bool scheduleSync = false) {}
61dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block    virtual bool allowsAcceleratedCompositing() const { return false; }
62d0825bca7fe65beaee391d30da42e937db621564Steve Block#endif
63d0825bca7fe65beaee391d30da42e937db621564Steve Block
64dd8bb3de4f353a81954234999f1fea748aee2ea9Ben Murdoch    virtual void setInputMethodHints(Qt::InputMethodHints hint) = 0;
6521939df44de1705786c545cd1bf519d47250322dBen Murdoch
6621939df44de1705786c545cd1bf519d47250322dBen Murdoch#ifndef QT_NO_CURSOR
67231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block    inline void resetCursor()
68231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block    {
69231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block        if (!cursor().bitmap() && cursor().shape() == m_lastCursor.shape())
70231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block            return;
71231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block        updateCursor(m_lastCursor);
72231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block    }
73231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block
74231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block    inline void setCursor(const QCursor& cursor)
75231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block    {
76231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block        m_lastCursor = cursor;
77231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block        if (!cursor.bitmap() && cursor.shape() == this->cursor().shape())
78231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block            return;
79231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block        updateCursor(cursor);
80231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block    }
8121939df44de1705786c545cd1bf519d47250322dBen Murdoch#endif
82231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block
83cac0f67c402d107cdb10971b95719e2ff9c7c76bSteve Block    virtual QPalette palette() const = 0;
84231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block    virtual int screenNumber() const = 0;
85cac0f67c402d107cdb10971b95719e2ff9c7c76bSteve Block    virtual QWidget* ownerWidget() const = 0;
86dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block    virtual QRect geometryRelativeToOwnerWidget() const = 0;
87231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block
88231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block    virtual QObject* pluginParent() const = 0;
89231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block
90d0825bca7fe65beaee391d30da42e937db621564Steve Block    virtual QStyle* style() const = 0;
9106ea8e899e48f1f2f396b70e63fae369f2f23232Kristian Monsen
926c2af9490927c3c5959b5cb07461b646f8b32f6cKristian Monsen    virtual QRectF graphicsItemVisibleRect() const { return QRectF(); }
9306ea8e899e48f1f2f396b70e63fae369f2f23232Kristian Monsen
94e78cbe89e6f337f2f1fe40315be88f742b547151Steve Block    virtual bool viewResizesToContentsEnabled() const = 0;
95d0825bca7fe65beaee391d30da42e937db621564Steve Block
9606ea8e899e48f1f2f396b70e63fae369f2f23232Kristian Monsen    virtual QRectF windowRect() const = 0;
9706ea8e899e48f1f2f396b70e63fae369f2f23232Kristian Monsen
98231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Blockprotected:
99231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block#ifndef QT_NO_CURSOR
100231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block    virtual QCursor cursor() const = 0;
101231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block    virtual void updateCursor(const QCursor& cursor) = 0;
102231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block#endif
103231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block
104231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Blockprivate:
105231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block#ifndef QT_NO_CURSOR
106231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block    QCursor m_lastCursor;
107231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block#endif
108231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block};
109231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block
110231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block#endif
111