|
1 /* |
|
2 * Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). |
|
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 * |
|
9 * Initial Contributors: |
|
10 * Nokia Corporation - initial contribution. |
|
11 * |
|
12 * Contributors: |
|
13 * |
|
14 * Description: |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #ifndef __GINEBRA_WEBCHROMEITEM_H__ |
|
20 #define __GINEBRA_WEBCHROMEITEM_H__ |
|
21 |
|
22 #include <QtGui> |
|
23 #include <QWebElement> |
|
24 #include "CachedHandler.h" |
|
25 |
|
26 namespace GVA { |
|
27 |
|
28 class ChromeWidget; |
|
29 class ChromeRenderer; |
|
30 class WebChromeSnippet; |
|
31 |
|
32 class WebChromeItem : public QGraphicsWidget |
|
33 { |
|
34 Q_OBJECT |
|
35 public: |
|
36 WebChromeItem(const QRectF& ownerArea, ChromeWidget* chrome, const QWebElement & element, QGraphicsItem* parent=0); |
|
37 virtual ~WebChromeItem(); |
|
38 virtual void init(WebChromeSnippet * snippet); |
|
39 void paint(QPainter* painter, const QStyleOptionGraphicsItem* opt, QWidget* widget); |
|
40 QRectF ownerArea() {return m_ownerArea;}\ |
|
41 void setOwnerArea(const QRectF& ownerArea); |
|
42 void setCachedHandlers(QList<CachedHandler> handlers) {m_handlers = handlers;} |
|
43 QGraphicsScene * scene(); |
|
44 ChromeRenderer * renderer(); |
|
45 void grabFocus(); |
|
46 bool event(QEvent* event); |
|
47 ChromeWidget * chrome() { return m_chrome; } |
|
48 QWebElement element() { return m_element; } |
|
49 inline bool isPainting() { return m_painting; } |
|
50 public slots: |
|
51 void repaintFromChrome(const QRectF& rect = QRectF()); |
|
52 //inline void setCacheMode(bool mode) {m_cacheMode = mode;}; |
|
53 signals: |
|
54 void contextMenu(QGraphicsSceneContextMenuEvent * ev); |
|
55 void mouseEvent(QEvent::Type type); |
|
56 protected: |
|
57 void contextMenuEvent(QGraphicsSceneContextMenuEvent * ev); |
|
58 void mousePressEvent(QGraphicsSceneMouseEvent * ev); |
|
59 void mouseReleaseEvent(QGraphicsSceneMouseEvent * ev); |
|
60 void mouseDoubleClickEvent(QGraphicsSceneMouseEvent *ev); |
|
61 void mouseMoveEvent(QGraphicsSceneMouseEvent *ev); |
|
62 //void keyPressEvent ( QKeyEvent * event ); |
|
63 //void keyReleaseEvent ( QKeyEvent * event ); |
|
64 void hoverMoveEvent(QGraphicsSceneHoverEvent *event); |
|
65 void forwardMouseEvent(QEvent::Type type, QGraphicsSceneMouseEvent *ev); |
|
66 |
|
67 //virtual bool event(QEvent * ev); |
|
68 private: |
|
69 void cachedHandlerEvent(QGraphicsSceneMouseEvent * ev); |
|
70 QRectF m_ownerArea; |
|
71 QPixmap * m_pageBits; |
|
72 ChromeWidget* m_chrome; |
|
73 QWebElement m_element; |
|
74 //ChromeRenderer * m_renderer; |
|
75 QList<CachedHandler> m_handlers; |
|
76 //bool m_cacheMode; |
|
77 bool m_painting; |
|
78 }; |
|
79 |
|
80 } // end of namespace GVA |
|
81 |
|
82 #endif // __GINEBRA_REDCHROMESNIPPET_H__ |