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();
51 virtual WebCore::IntSize viewSize();
52 virtual bool isViewWindowActive();
53 virtual bool isViewFocused();
54 virtual bool isViewVisible();
55 virtual bool isViewInWindow();
57 #if USE(ACCELERATED_COMPOSITING)
58 void pageDidEnterAcceleratedCompositing() { }
59 void pageDidLeaveAcceleratedCompositing() { }
60 #endif // USE(ACCELERATED_COMPOSITING)
61 virtual void pageDidRequestScroll(const WebCore::IntSize&);
62 virtual void processDidCrash() { }
63 virtual void didRelaunchProcess() { }
64 virtual void didChangeContentsSize(const WebCore::IntSize&);
65 virtual void didFindZoomableArea(const WebCore::IntRect&);
66 virtual void setCursor(const WebCore::Cursor&);
67 virtual void setViewportArguments(const WebCore::ViewportArguments&);
68 virtual void takeFocus(bool direction);
69 virtual void toolTipChanged(const WTF::String&, const WTF::String&);
70 virtual void registerEditCommand(PassRefPtr<WebKit::WebEditCommandProxy>, WebKit::WebPageProxy::UndoOrRedo);
71 virtual void clearAllEditCommands();
72 virtual WebCore::FloatRect convertToDeviceSpace(const WebCore::FloatRect&);
73 virtual WebCore::FloatRect convertToUserSpace(const WebCore::FloatRect&);
74 virtual void didNotHandleKeyEvent(const WebKit::NativeWebKeyboardEvent&);
75 virtual void selectionChanged(bool, bool, bool, bool);
76 virtual PassRefPtr<WebKit::WebPopupMenuProxy> createPopupMenuProxy(WebKit::WebPageProxy*);
77 virtual PassRefPtr<WebKit::WebContextMenuProxy> createContextMenuProxy(WebKit::WebPageProxy*);
79 virtual void setFindIndicator(PassRefPtr<WebKit::FindIndicator>, bool fadeOut);
81 virtual void didCommitLoadForMainFrame(bool useCustomRepresentation);
82 virtual void didFinishLoadingDataForCustomRepresentation(const CoreIPC::DataReference&);
83 virtual double customRepresentationZoomFactor() { return 1; }
84 virtual void setCustomRepresentationZoomFactor(double) { }
86 void paint(QPainter* painter, QRect);
88 void keyPressEvent(QKeyEvent*);
89 void keyReleaseEvent(QKeyEvent*);
90 void mouseMoveEvent(QGraphicsSceneMouseEvent*);
91 void mousePressEvent(QGraphicsSceneMouseEvent*);
92 void mouseReleaseEvent(QGraphicsSceneMouseEvent*);
93 void mouseDoubleClickEvent(QGraphicsSceneMouseEvent*);
94 void wheelEvent(QGraphicsSceneWheelEvent*);
96 void updateAction(QWKPage::WebAction action);
97 void updateNavigationActions();
98 void updateEditorActions();
99 void setEditCommandState(const WTF::String&, bool, int);
101 void _q_webActionTriggered(bool checked);
103 void touchEvent(QTouchEvent*);
111 QAction* actions[QWKPage::WebActionCount];
112 QWKPreferences* preferences;
114 RefPtr<WebKit::WebPageProxy> page;
116 WebCore::ViewportArguments viewportArguments;
118 QWKPage::CreateNewPageFn createNewPageFn;
121 QBasicTimer tripleClickTimer;
124 class QtViewportAttributesPrivate : public QSharedData {
126 QtViewportAttributesPrivate(QWKPage::ViewportAttributes* qq)
130 QWKPage::ViewportAttributes* q;
134 #endif /* qkpage_p_h */