1 /* |
1 /* |
2 * Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). |
2 * Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). |
3 * All rights reserved. |
3 * All rights reserved. |
4 * This component and the accompanying materials are made available |
|
5 * under the terms of "Eclipse Public License v1.0" |
|
6 * which accompanies this distribution, and is available |
|
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
8 * |
4 * |
9 * Initial Contributors: |
5 * This program is free software: you can redistribute it and/or modify |
10 * Nokia Corporation - initial contribution. |
6 * it under the terms of the GNU Lesser General Public License as published by |
|
7 * the Free Software Foundation, version 2.1 of the License. |
11 * |
8 * |
12 * Contributors: |
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 |
|
12 * GNU Lesser General Public License for more details. |
13 * |
13 * |
14 * Description: |
14 * You should have received a copy of the GNU Lesser General Public License |
|
15 * along with this program. If not, |
|
16 * see "http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html/". |
|
17 * |
|
18 * Description: |
15 * |
19 * |
16 */ |
20 */ |
17 |
|
18 |
21 |
19 #ifndef __GINEBRA_CHROMERENDERER_H__ |
22 #ifndef __GINEBRA_CHROMERENDERER_H__ |
20 #define __GINEBRA_CHROMERENDERER_H__ |
23 #define __GINEBRA_CHROMERENDERER_H__ |
21 |
24 |
22 #include <QtGui> |
25 #include <QObject> |
23 #include <QGraphicsWebView> |
26 #include <QWebPage> |
24 class QFocusEvent; |
27 #include <QWebFrame> |
|
28 |
25 namespace GVA { |
29 namespace GVA { |
26 |
30 |
27 class WebChromeItem; |
31 class WebChromeItem; |
28 |
32 |
29 class ChromeRenderer : public QGraphicsWebView |
33 class ChromeRenderer : public QObject |
30 { |
34 { |
31 Q_OBJECT |
35 Q_OBJECT |
32 public: |
36 public: |
33 ChromeRenderer(QWebPage * chromePage, QGraphicsItem * parent = 0); |
37 ChromeRenderer(QWebPage * chromePage, QObject * parent = 0); |
34 virtual ~ChromeRenderer(); |
38 virtual ~ChromeRenderer(); |
35 //QPixmap * pageBits() {return m_pageBits;} |
39 QWebPage * page() { return m_page; } |
|
40 void setPage(QWebPage * page) {m_page = page;} |
|
41 QWebFrame * frame() { if (m_page) return m_page->mainFrame(); return 0;} |
|
42 void resize(QSizeF newSize); |
36 void addRenderItem(WebChromeItem * item) {m_renderList.append(item);} |
43 void addRenderItem(WebChromeItem * item) {m_renderList.append(item);} |
37 void clearRenderList() {m_renderList.clear();} |
44 void clearRenderList() {if(!m_renderList.isEmpty()) m_renderList.clear();} |
|
45 void updateChromeLayout() { emit chromeResized(); } |
38 public slots: |
46 public slots: |
39 void repaintRequested(const QRect& dirtyRect); |
47 void repaintRequested(const QRect& dirtyRect); |
40 void onContentsSizeChanged(const QSize & size); |
|
41 void onInitialLayoutCompleted(); |
|
42 signals: |
48 signals: |
43 void chromeRepainted(const QRectF& rect = QRectF()); |
49 void chromeRepainted(const QRectF& rect = QRectF()); |
44 void chromeResized(); |
50 void chromeResized(); |
45 #ifdef Q_OS_SYMBIAN //Ginebra 1 hack for symbian fep key handler |
|
46 void symbianCarriageReturn(); |
|
47 #endif |
|
48 protected: |
|
49 virtual void paint(QPainter * painter, const QStyleOptionGraphicsItem * option, QWidget * widget = 0); |
|
50 virtual void resizeEvent(QGraphicsSceneResizeEvent * ev); |
|
51 virtual void keyPressEvent( QKeyEvent * ev ); |
|
52 void focusInEvent(QFocusEvent* event); |
|
53 private: |
51 private: |
|
52 QWebPage * m_page; |
54 QList<WebChromeItem*> m_renderList; |
53 QList<WebChromeItem*> m_renderList; |
55 }; |
54 }; |
56 |
55 |
57 } // end of namespace GVA |
56 } // end of namespace GVA |
58 |
57 |