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 "WebPageProxy.h"
28 #include <wtf/PassOwnPtr.h>
29 #include <wtf/RefPtr.h>
30 #include <QBasicTimer>
31 #include <QGraphicsView>
34 class QGraphicsWKView;
37 class QWKPagePrivate : WebKit::PageClient {
39 QWKPagePrivate(QWKPage*, QWKContext*);
42 static QWKPagePrivate* get(QWKPage* page) { return page->d; }
44 void init(QGraphicsItem*, WTF::PassOwnPtr<WebKit::DrawingAreaProxy>);
47 virtual PassOwnPtr<WebKit::DrawingAreaProxy> createDrawingAreaProxy();
48 virtual void setViewNeedsDisplay(const WebCore::IntRect&);
49 virtual void displayView();
50 virtual void scrollView(const WebCore::IntRect& scrollRect, const WebCore::IntSize& scrollOffset);
52 virtual WebCore::IntSize viewSize();
53 virtual bool isViewWindowActive();
54 virtual bool isViewFocused();
55 virtual bool isViewVisible();
56 virtual bool isViewInWindow();
58 #if USE(ACCELERATED_COMPOSITING)
59 void pageDidEnterAcceleratedCompositing() { }
60 void pageDidLeaveAcceleratedCompositing() { }
61 #endif // USE(ACCELERATED_COMPOSITING)
62 virtual void pageDidRequestScroll(const WebCore::IntSize&);
63 virtual void processDidCrash() { }
64 virtual void didRelaunchProcess() { }
65 virtual void didChangeContentsSize(const WebCore::IntSize&);
66 virtual void didFindZoomableArea(const WebCore::IntRect&);
67 virtual void setCursor(const WebCore::Cursor&);
68 virtual void setViewportArguments(const WebCore::ViewportArguments&);
69 virtual void takeFocus(bool direction);
70 virtual void toolTipChanged(const WTF::String&, const WTF::String&);
71 virtual void registerEditCommand(PassRefPtr<WebKit::WebEditCommandProxy>, WebKit::WebPageProxy::UndoOrRedo);
72 virtual void clearAllEditCommands();
73 virtual WebCore::FloatRect convertToDeviceSpace(const WebCore::FloatRect&);
74 virtual WebCore::FloatRect convertToUserSpace(const WebCore::FloatRect&);
75 virtual void didNotHandleKeyEvent(const WebKit::NativeWebKeyboardEvent&);
76 virtual void selectionChanged(bool, bool, bool, bool);
77 virtual PassRefPtr<WebKit::WebPopupMenuProxy> createPopupMenuProxy(WebKit::WebPageProxy*);
78 virtual PassRefPtr<WebKit::WebContextMenuProxy> createContextMenuProxy(WebKit::WebPageProxy*);
80 virtual void setFindIndicator(PassRefPtr<WebKit::FindIndicator>, bool fadeOut);
82 virtual void didCommitLoadForMainFrame(bool useCustomRepresentation);
83 virtual void didFinishLoadingDataForCustomRepresentation(const CoreIPC::DataReference&);
84 virtual double customRepresentationZoomFactor() { return 1; }
85 virtual void setCustomRepresentationZoomFactor(double) { }
87 void paint(QPainter* painter, QRect);
89 void keyPressEvent(QKeyEvent*);
90 void keyReleaseEvent(QKeyEvent*);
91 void mouseMoveEvent(QGraphicsSceneMouseEvent*);
92 void mousePressEvent(QGraphicsSceneMouseEvent*);
93 void mouseReleaseEvent(QGraphicsSceneMouseEvent*);
94 void mouseDoubleClickEvent(QGraphicsSceneMouseEvent*);
95 void wheelEvent(QGraphicsSceneWheelEvent*);
97 void updateAction(QWKPage::WebAction action);
98 void updateNavigationActions();
99 void updateEditorActions();
100 void setEditCommandState(const WTF::String&, bool, int);
102 void _q_webActionTriggered(bool checked);
104 void touchEvent(QTouchEvent*);
112 QAction* actions[QWKPage::WebActionCount];
113 QWKPreferences* preferences;
115 RefPtr<WebKit::WebPageProxy> page;
117 WebCore::ViewportArguments viewportArguments;
119 QWKPage::CreateNewPageFn createNewPageFn;
122 QBasicTimer tripleClickTimer;
125 class QtViewportAttributesPrivate : public QSharedData {
127 QtViewportAttributesPrivate(QWKPage::ViewportAttributes* qq)
131 QWKPage::ViewportAttributes* q;
135 #endif /* qkpage_p_h */