70 } |
70 } |
71 |
71 |
72 signals: |
72 signals: |
73 /// Triggered by a QContextEvent such as a long-press or right mouse button click. |
73 /// Triggered by a QContextEvent such as a long-press or right mouse button click. |
74 void contextEvent(::WebViewEventContext *context); |
74 void contextEvent(::WebViewEventContext *context); |
75 |
75 #ifdef BEDROCK_TILED_BACKING_STORE |
|
76 public slots: |
|
77 #else |
76 protected slots: |
78 protected slots: |
|
79 #endif |
77 void onContextEvent(::WebViewEventContext *context) { emit contextEvent(context); } |
80 void onContextEvent(::WebViewEventContext *context) { emit contextEvent(context); } |
78 |
81 |
79 protected: |
82 protected: |
80 QWebPage *m_page; // owned |
83 QWebPage *m_page; // owned |
81 |
84 |
82 friend class GWebContentViewWidget; |
85 friend class GWebContentViewWidget; |
83 }; |
86 }; |
84 |
87 |
85 // ------------------------------ |
|
86 /*! \ingroup JavascriptAPI |
|
87 * \brief A content view that has full access to the Javascript APIs. |
|
88 * |
|
89 * Example code to load an HTML file into a super page: |
|
90 * \code |
|
91 * window.views.WebView.createSuperPage("BookmarkView", true); |
|
92 * window.views.WebView.BookmarkView.load("./chrome/BookmarkView.html"); |
|
93 * \endcode |
|
94 */ |
|
95 class GSuperWebPage : public GWebPage { |
|
96 Q_OBJECT |
|
97 public: |
|
98 GSuperWebPage(WebPageWrapper *page, ChromeWidget *chromeWidget); |
|
99 |
|
100 public slots: |
|
101 void load(const QString &url); |
|
102 |
|
103 signals: |
|
104 /*! |
|
105 * Triggered by the javascript code within the superpage when it wants a context menu to be displayed by |
|
106 * the chrome's javascript. |
|
107 * |
|
108 * The normal chain of events is: |
|
109 * \li User executes a long-press (or RMB click). |
|
110 * \li Qt sends QContextMenuEvent from QWebView. |
|
111 * \li GWebContentViewWidget::contextMenuEvent is called, which passes the event to the superpage |
|
112 * (if one is currently displayed). |
|
113 * \li The superpage emits \c contextEvent(). |
|
114 * \li The context event handler in the superpage's javascript determines what was clicked on |
|
115 * and emits \c showContextMenu() from the superpage. |
|
116 * \li Javascript \c showContextMenu signal handler in the chrome is called which then displays the context menu. |
|
117 */ |
|
118 void showContextMenu(QVariant obj); |
|
119 |
|
120 private slots: |
|
121 void onJavaScriptWindowObjectCleared(); |
|
122 |
|
123 private: |
|
124 ChromeWidget *m_chromeWidget; // not owned |
|
125 }; |
|
126 |
|
127 } |
88 } |
128 |
89 |
129 #endif // __GINEBRA_GWEBPAGE_H__ |
90 #endif // __GINEBRA_GWEBPAGE_H__ |