|
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_POPUPWEBCHROMEITEM_H__ |
|
20 #define __GINEBRA_POPUPWEBCHROMEITEM_H__ |
|
21 |
|
22 #include "WebChromeItem.h" |
|
23 |
|
24 namespace GVA { |
|
25 |
|
26 // To use PopupWebChromeItem: |
|
27 // |
|
28 // 1. Add data-GinebraItemType="popup" to the DIV element defining your |
|
29 // snippet in chrome.html |
|
30 // |
|
31 // 2. Connect to the externalMouseEvent signal AFTER chromeLoadComplete |
|
32 // has been emitted: |
|
33 // |
|
34 // window.chrome.chromeComplete.connect(chromeLoadComplete); |
|
35 // |
|
36 // function chromeLoadComplete() { |
|
37 // window.snippets.ContextMenuId.externalMouseEvent.connect( |
|
38 // function(type, name, description) { |
|
39 // if (name == "QGraphicsSceneMouseReleaseEvent") { |
|
40 // window.snippets.ContextMenuId.hide(); |
|
41 // } |
|
42 // } |
|
43 // ); |
|
44 // } |
|
45 |
|
46 class PopupWebChromeItem : public WebChromeItem |
|
47 { |
|
48 Q_OBJECT |
|
49 |
|
50 public: |
|
51 PopupWebChromeItem( |
|
52 const QRectF & ownerArea, |
|
53 ChromeWidget * chrome, |
|
54 const QWebElement & element, |
|
55 QGraphicsItem * parent = 0); |
|
56 |
|
57 virtual ~PopupWebChromeItem(); |
|
58 |
|
59 virtual void init(WebChromeSnippet * snippet); |
|
60 |
|
61 signals: |
|
62 void externalMouseEvent( |
|
63 int type, |
|
64 const QString & name, |
|
65 const QString & description); |
|
66 |
|
67 protected: |
|
68 virtual bool event(QEvent * event); |
|
69 virtual bool eventFilter(QObject * object, QEvent * event); |
|
70 |
|
71 private: |
|
72 void checkForExternalEvent(QObject * object, QEvent * event); |
|
73 void emitExternalEvent(QEvent * event); |
|
74 }; |
|
75 |
|
76 } // end of namespace GVA |
|
77 |
|
78 #endif // __GINEBRA_POPUPWEBCHROMEITEM_H__ |