2 * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies)
4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Library General Public
6 * License as published by the Free Software Foundation; either
7 * version 2 of the License, or (at your option) any later version.
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * Library General Public License for more details.
14 * You should have received a copy of the GNU Library General Public License
15 * along with this program; see the file COPYING.LIB. If not, write to
16 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
17 * Boston, MA 02110-1301, USA.
24 #include "DrawingAreaProxy.h"
25 #include "PageClient.h"
27 #include "qgraphicswkview.h"
28 #include "WebPageProxy.h"
29 #include <wtf/PassOwnPtr.h>
30 #include <wtf/RefPtr.h>
31 #include <QBasicTimer>
32 #include <QGraphicsView>
35 class QGraphicsWKView;
38 class QWKPagePrivate : WebKit::PageClient {
40 QWKPagePrivate(QWKPage*, QWKContext*);
43 static QWKPagePrivate* get(QWKPage* page) { return page->d; }
45 void init(QGraphicsItem*, QGraphicsWKView::BackingStoreType);
48 virtual PassOwnPtr<WebKit::DrawingAreaProxy> createDrawingAreaProxy();
49 virtual void setViewNeedsDisplay(const WebCore::IntRect&);
50 virtual void displayView();
51 virtual void scrollView(const WebCore::IntRect& scrollRect, const WebCore::IntSize& scrollOffset);
53 virtual WebCore::IntSize viewSize();
54 virtual bool isViewWindowActive();
55 virtual bool isViewFocused();
56 virtual bool isViewVisible();
57 virtual bool isViewInWindow();
59 #if USE(ACCELERATED_COMPOSITING)
60 void pageDidEnterAcceleratedCompositing() { }
61 void pageDidLeaveAcceleratedCompositing() { }
62 #endif // USE(ACCELERATED_COMPOSITING)
63 virtual void pageDidRequestScroll(const WebCore::IntSize&);
64 virtual void processDidCrash() { }
65 virtual void didRelaunchProcess();
66 virtual void didChangeContentsSize(const WebCore::IntSize&);
67 virtual void didFindZoomableArea(const WebCore::IntRect&);
68 virtual void setCursor(const WebCore::Cursor&);
69 virtual void setViewportArguments(const WebCore::ViewportArguments&);
70 virtual void takeFocus(bool direction);
71 virtual void toolTipChanged(const WTF::String&, const WTF::String&);
72 virtual void registerEditCommand(PassRefPtr<WebKit::WebEditCommandProxy>, WebKit::WebPageProxy::UndoOrRedo);
73 virtual void clearAllEditCommands();
74 virtual WebCore::FloatRect convertToDeviceSpace(const WebCore::FloatRect&);
75 virtual WebCore::FloatRect convertToUserSpace(const WebCore::FloatRect&);
76 virtual void didNotHandleKeyEvent(const WebKit::NativeWebKeyboardEvent&);
77 virtual void selectionChanged(bool, bool, bool, bool);
78 virtual PassRefPtr<WebKit::WebPopupMenuProxy> createPopupMenuProxy(WebKit::WebPageProxy*);
79 virtual PassRefPtr<WebKit::WebContextMenuProxy> createContextMenuProxy(WebKit::WebPageProxy*);
81 virtual void setFindIndicator(PassRefPtr<WebKit::FindIndicator>, bool fadeOut);
83 virtual void didCommitLoadForMainFrame(bool useCustomRepresentation);
84 virtual void didFinishLoadingDataForCustomRepresentation(const CoreIPC::DataReference&);
85 virtual double customRepresentationZoomFactor() { return 1; }
86 virtual void setCustomRepresentationZoomFactor(double) { }
88 void paint(QPainter* painter, QRect);
90 void keyPressEvent(QKeyEvent*);
91 void keyReleaseEvent(QKeyEvent*);
92 void mouseMoveEvent(QGraphicsSceneMouseEvent*);
93 void mousePressEvent(QGraphicsSceneMouseEvent*);
94 void mouseReleaseEvent(QGraphicsSceneMouseEvent*);
95 void mouseDoubleClickEvent(QGraphicsSceneMouseEvent*);
96 void wheelEvent(QGraphicsSceneWheelEvent*);
98 void updateAction(QWKPage::WebAction action);
99 void updateNavigationActions();
100 void updateEditorActions();
101 void setEditCommandState(const WTF::String&, bool, int);
103 void _q_webActionTriggered(bool checked);
105 void touchEvent(QTouchEvent*);
113 QAction* actions[QWKPage::WebActionCount];
114 QWKPreferences* preferences;
116 RefPtr<WebKit::WebPageProxy> page;
118 WebCore::ViewportArguments viewportArguments;
120 QWKPage::CreateNewPageFn createNewPageFn;
123 QBasicTimer tripleClickTimer;
124 QGraphicsWKView::BackingStoreType backingStoreType;
127 class QtViewportAttributesPrivate : public QSharedData {
129 QtViewportAttributesPrivate(QWKPage::ViewportAttributes* qq)
133 QWKPage::ViewportAttributes* q;
137 #endif /* qkpage_p_h */