• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (C) 2007 Kevin Ollivier <kevino@theolliviers.com>
3  *
4  * All rights reserved.
5  *
6  * Redistribution and use in source and binary forms, with or without
7  * modification, are permitted provided that the following conditions
8  * are met:
9  * 1. Redistributions of source code must retain the above copyright
10  *    notice, this list of conditions and the following disclaimer.
11  * 2. Redistributions in binary form must reproduce the above copyright
12  *    notice, this list of conditions and the following disclaimer in the
13  *    documentation and/or other materials provided with the distribution.
14  *
15  * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
16  * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
17  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
18  * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL APPLE COMPUTER, INC. OR
19  * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
20  * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
21  * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
22  * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
23  * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
25  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26  */
27 
28 #ifndef WXWEBVIEW_H
29 #define WXWEBVIEW_H
30 
31 #include "wx/wxprec.h"
32 #ifndef WX_PRECOMP
33     #include "wx/wx.h"
34 #endif
35 
36 #include "WebKitDefines.h"
37 #include "WebDOMSelection.h"
38 #include "WebFrame.h"
39 #include "WebSettings.h"
40 
41 class WebViewPrivate;
42 class WebViewFrameData;
43 class wxWebFrame;
44 
45 typedef struct OpaqueJSContext* JSGlobalContextRef;
46 typedef struct OpaqueJSValue* JSObjectRef;
47 
48 namespace WebCore {
49     class ChromeClientWx;
50     class FrameLoaderClientWx;
51 }
52 
53 #ifndef SWIG
54 extern WXDLLIMPEXP_WEBKIT const wxChar* wxWebViewNameStr;
55 #endif
56 
57 static const int defaultCacheCapacity = 8192 * 1024; // mirrors MemoryCache.cpp
58 
59 class WXDLLIMPEXP_WEBKIT wxWebViewCachePolicy
60 {
61 public:
62     wxWebViewCachePolicy(unsigned minDead = 0, unsigned maxDead = defaultCacheCapacity, unsigned totalCapacity = defaultCacheCapacity)
m_minDeadCapacity(minDead)63         : m_minDeadCapacity(minDead)
64         , m_maxDeadCapacity(maxDead)
65         , m_capacity(totalCapacity)
66     {}
67 
~wxWebViewCachePolicy()68     ~wxWebViewCachePolicy() {}
69 
GetCapacity()70     unsigned GetCapacity() const { return m_capacity; }
SetCapacity(int capacity)71     void SetCapacity(int capacity) { m_capacity = capacity; }
72 
GetMinDeadCapacity()73     unsigned GetMinDeadCapacity() const { return m_minDeadCapacity; }
SetMinDeadCapacity(unsigned minDeadCapacity)74     void SetMinDeadCapacity(unsigned minDeadCapacity) { m_minDeadCapacity = minDeadCapacity; }
75 
GetMaxDeadCapacity()76     unsigned GetMaxDeadCapacity() const { return m_maxDeadCapacity; }
SetMaxDeadCapacity(unsigned maxDeadCapacity)77     void SetMaxDeadCapacity(unsigned maxDeadCapacity) { m_maxDeadCapacity = maxDeadCapacity; }
78 
79 protected:
80     unsigned m_capacity;
81     unsigned m_minDeadCapacity;
82     unsigned m_maxDeadCapacity;
83 };
84 
85 
86 // copied from WebKit/mac/Misc/WebKitErrors[Private].h
87 enum {
88     WebKitErrorCannotShowMIMEType =                             100,
89     WebKitErrorCannotShowURL =                                  101,
90     WebKitErrorFrameLoadInterruptedByPolicyChange =             102,
91     WebKitErrorCannotUseRestrictedPort = 103,
92     WebKitErrorCannotFindPlugIn =                               200,
93     WebKitErrorCannotLoadPlugIn =                               201,
94     WebKitErrorJavaUnavailable =                                202,
95 };
96 
97 enum wxProxyType {
98     HTTP,
99     Socks4,
100     Socks4A,
101     Socks5,
102     Socks5Hostname
103 };
104 
105 class WXDLLIMPEXP_WEBKIT wxWebView : public wxWindow
106 {
107     // ChromeClientWx needs to get the Page* stored by the wxWebView
108     // for the createWindow function.
109     friend class WebCore::ChromeClientWx;
110     friend class WebCore::FrameLoaderClientWx;
111 
112 public:
113     // ctor(s)
114 #if SWIG
115     %pythonAppend wxWebView    "self._setOORInfo(self)"
116     %pythonAppend wxWebView()  ""
117 #endif
118 
119     wxWebView(wxWindow* parent, int id = wxID_ANY,
120               const wxPoint& point = wxDefaultPosition,
121               const wxSize& size = wxDefaultSize,
122               long style = 0,
123               const wxString& name = wxWebViewNameStr); // For wxWebView internal data passing
124 #if SWIG
125     %rename(PreWebView) wxWebView();
126 #else
127     wxWebView();
128 #endif
129 
130     bool Create(wxWindow* parent, int id = wxID_ANY,
131                 const wxPoint& point = wxDefaultPosition,
132                 const wxSize& size = wxDefaultSize,
133                 long style = 0,
134                 const wxString& name = wxWebViewNameStr); // For wxWebView internal data passing
135 
136 #ifndef SWIG
137     virtual ~wxWebView();
138 #endif
139 
140     void LoadURL(const wxString& url);
141     bool GoBack();
142     bool GoForward();
143     void Stop();
144     void Reload();
145 
146     bool CanGoBack();
147     bool CanGoForward();
148 
149     bool CanCut();
150     bool CanCopy();
151     bool CanPaste();
152 
153     void Cut();
154     void Copy();
155     void Paste();
156 
157     //bool CanGetPageSource();
158     wxString GetPageSource();
159     void SetPageSource(const wxString& source, const wxString& baseUrl = wxEmptyString, const wxString& mimetype = wxT("text/html"));
160 
161     wxString GetInnerText();
162     wxString GetAsMarkup();
163     wxString GetExternalRepresentation();
164 
165     wxWebKitSelection GetSelection();
166     wxString GetSelectionAsHTML();
167     wxString GetSelectionAsText();
168 
169     void SetTransparent(bool transparent);
170     bool IsTransparent() const;
171 
172     wxString RunScript(const wxString& javascript);
173     bool ExecuteEditCommand(const wxString& command, const wxString& parameter = wxEmptyString);
174     EditState GetEditCommandState(const wxString& command) const;
175     wxString GetEditCommandValue(const wxString& command) const;
176 
177     bool FindString(const wxString& string, bool forward = true,
178         bool caseSensitive = false, bool wrapSelection = true,
179         bool startInSelection = true);
180 
181     bool CanIncreaseTextSize() const;
182     void IncreaseTextSize();
183     bool CanDecreaseTextSize() const;
184     void DecreaseTextSize();
185     void ResetTextSize();
186     void MakeEditable(bool enable);
187     bool IsEditable() const;
188 
GetPageTitle()189     wxString GetPageTitle() const { return m_title; }
SetPageTitle(const wxString & title)190     void SetPageTitle(const wxString& title) { m_title = title; }
191 
GetMainFrame()192     wxWebFrame* GetMainFrame() { return m_mainFrame; }
193 
194     wxWebViewDOMElementInfo HitTest(const wxPoint& pos) const;
195 
196     bool ShouldClose() const;
197 
198     static void SetCachePolicy(const wxWebViewCachePolicy& cachePolicy);
199     static wxWebViewCachePolicy GetCachePolicy();
200 
SetMouseWheelZooms(bool mouseWheelZooms)201     void SetMouseWheelZooms(bool mouseWheelZooms) { m_mouseWheelZooms = mouseWheelZooms; }
GetMouseWheelZooms()202     bool GetMouseWheelZooms() const { return m_mouseWheelZooms; }
203 
204     static void SetDatabaseDirectory(const wxString& databaseDirectory);
205     static wxString GetDatabaseDirectory();
206 
207     /**
208         Sets whether or not web pages can create databases.
209     */
210     static void SetDatabasesEnabled(bool enabled);
211 
212     /**
213         Returns whether or not the WebView runs JavaScript code.
214     */
215     static bool AreDatabasesEnabled();
216 
217     static void SetProxyInfo(const wxString& host = wxEmptyString,
218                              unsigned long port = 0,
219                              wxProxyType type = HTTP,
220                              const wxString& username = wxEmptyString,
221                              const wxString& password = wxEmptyString);
222 
223     wxWebSettings GetWebSettings();
224     wxWebKitCompatibilityMode GetCompatibilityMode() const;
225 
226     /*
227         This method allows cross site-scripting (XSS) in the WebView.
228         Use with caution!
229     */
230     void GrantUniversalAccess();
231 
232 protected:
233 
234     // event handlers (these functions should _not_ be virtual)
235     void OnPaint(wxPaintEvent& event);
236     void OnSize(wxSizeEvent& event);
237     void OnMouseEvents(wxMouseEvent& event);
238     void OnContextMenuEvents(wxContextMenuEvent& event);
239     void OnMenuSelectEvents(wxCommandEvent& event);
240     void OnKeyEvents(wxKeyEvent& event);
241     void OnSetFocus(wxFocusEvent& event);
242     void OnKillFocus(wxFocusEvent& event);
243     void OnTLWActivated(wxActivateEvent& event);
244 
245 private:
246     // any class wishing to process wxWindows events must use this macro
247 #ifndef SWIG
248     DECLARE_EVENT_TABLE()
249     DECLARE_DYNAMIC_CLASS(wxWebView)
250 #endif
251     float m_textMagnifier;
252     bool m_isInitialized;
253     bool m_beingDestroyed;
254     bool m_mouseWheelZooms;
255     WebViewPrivate* m_impl;
256     wxWebFrame* m_mainFrame;
257     wxString m_title;
258 
259 };
260 
261 // ----------------------------------------------------------------------------
262 // Web Kit Events
263 // ----------------------------------------------------------------------------
264 
265 enum {
266     wxWEBVIEW_LOAD_STARTED = 1,
267     wxWEBVIEW_LOAD_NEGOTIATING = 2,
268     wxWEBVIEW_LOAD_REDIRECTING = 4,
269     wxWEBVIEW_LOAD_TRANSFERRING = 8,
270     wxWEBVIEW_LOAD_STOPPED = 16,
271     wxWEBVIEW_LOAD_FAILED = 32,
272     wxWEBVIEW_LOAD_DL_COMPLETED = 64,
273     wxWEBVIEW_LOAD_DOC_COMPLETED = 128,
274     wxWEBVIEW_LOAD_ONLOAD_HANDLED = 256,
275     wxWEBVIEW_LOAD_WINDOW_OBJECT_CLEARED = 512
276 };
277 
278 enum {
279     wxWEBVIEW_NAV_LINK_CLICKED = 1,
280     wxWEBVIEW_NAV_BACK_NEXT = 2,
281     wxWEBVIEW_NAV_FORM_SUBMITTED = 4,
282     wxWEBVIEW_NAV_RELOAD = 8,
283     wxWEBVIEW_NAV_FORM_RESUBMITTED = 16,
284     wxWEBVIEW_NAV_OTHER = 32
285 };
286 
287 class WXDLLIMPEXP_WEBKIT wxWebViewBeforeLoadEvent : public wxCommandEvent
288 {
289 #ifndef SWIG
DECLARE_DYNAMIC_CLASS(wxWebViewBeforeLoadEvent)290     DECLARE_DYNAMIC_CLASS( wxWebViewBeforeLoadEvent )
291 #endif
292 
293 public:
294     bool IsCancelled() const { return m_cancelled; }
295     void Cancel(bool cancel = true) { m_cancelled = cancel; }
GetURL()296     wxString GetURL() const { return m_url; }
SetURL(const wxString & url)297     void SetURL(const wxString& url) { m_url = url; }
SetNavigationType(int navType)298     void SetNavigationType(int navType) { m_navType = navType; }
GetNavigationType()299     int GetNavigationType() const { return m_navType; }
300 
301     wxWebViewBeforeLoadEvent( wxWindow* win = (wxWindow*) NULL );
Clone(void)302     wxEvent *Clone(void) const { return new wxWebViewBeforeLoadEvent(*this); }
303 
304 private:
305     bool m_cancelled;
306     wxString m_url;
307     int m_navType;
308 };
309 
310 class WXDLLIMPEXP_WEBKIT wxWebViewLoadEvent : public wxCommandEvent
311 {
312 #ifndef SWIG
DECLARE_DYNAMIC_CLASS(wxWebViewLoadEvent)313     DECLARE_DYNAMIC_CLASS( wxWebViewLoadEvent )
314 #endif
315 
316 public:
317     int GetState() const { return m_state; }
SetState(const int state)318     void SetState(const int state) { m_state = state; }
GetURL()319     wxString GetURL() const { return m_url; }
SetURL(const wxString & url)320     void SetURL(const wxString& url) { m_url = url; }
321 
322     wxWebViewLoadEvent( wxWindow* win = (wxWindow*) NULL );
Clone(void)323     wxEvent *Clone(void) const { return new wxWebViewLoadEvent(*this); }
324 
325 private:
326     int m_state;
327     wxString m_url;
328 };
329 
330 class WXDLLIMPEXP_WEBKIT wxWebKitWindowFeatures
331 {
332 public:
wxWebKitWindowFeatures()333     wxWebKitWindowFeatures()
334         : menuBarVisible(true)
335         , statusBarVisible(true)
336         , toolBarVisible(true)
337         , locationBarVisible(true)
338         , scrollbarsVisible(true)
339         , resizable(true)
340         , fullscreen(false)
341         , dialog(false)
342     { }
343 
344     bool menuBarVisible;
345     bool statusBarVisible;
346     bool toolBarVisible;
347     bool locationBarVisible;
348     bool scrollbarsVisible;
349     bool resizable;
350     bool fullscreen;
351     bool dialog;
352 };
353 
354 class WXDLLIMPEXP_WEBKIT wxWebViewNewWindowEvent : public wxCommandEvent
355 {
356 #ifndef SWIG
DECLARE_DYNAMIC_CLASS(wxWebViewNewWindowEvent)357     DECLARE_DYNAMIC_CLASS( wxWebViewNewWindowEvent )
358 #endif
359 
360 public:
361     wxString GetURL() const { return m_url; }
SetURL(const wxString & url)362     void SetURL(const wxString& url) { m_url = url; }
GetTargetName()363     wxString GetTargetName() const { return m_targetName; }
SetTargetName(const wxString & name)364     void SetTargetName(const wxString& name) { m_targetName = name; }
GetWebView()365     wxWebView* GetWebView() { return m_webView; }
SetWebView(wxWebView * webView)366     void SetWebView(wxWebView* webView) { m_webView = webView; }
GetWindowFeatures()367     wxWebKitWindowFeatures GetWindowFeatures() { return m_features; }
SetWindowFeatures(wxWebKitWindowFeatures features)368     void SetWindowFeatures(wxWebKitWindowFeatures features) { m_features = features; }
369 
370     wxWebViewNewWindowEvent( wxWindow* win = static_cast<wxWindow*>(NULL));
Clone(void)371     wxEvent *Clone(void) const { return new wxWebViewNewWindowEvent(*this); }
372 
373 private:
374     wxWebView* m_webView;
375     wxWebKitWindowFeatures m_features;
376     wxString m_url;
377     wxString m_targetName;
378 };
379 
380 class WXDLLIMPEXP_WEBKIT wxWebViewRightClickEvent : public wxCommandEvent
381 {
382 #ifndef SWIG
383     DECLARE_DYNAMIC_CLASS( wxWebViewRightClickEvent )
384 #endif
385 
386 public:
387     wxWebViewRightClickEvent( wxWindow* win = static_cast<wxWindow*>(NULL));
Clone(void)388     wxEvent *Clone(void) const { return new wxWebViewRightClickEvent(*this); }
389 
GetInfo()390     wxWebViewDOMElementInfo GetInfo() const { return m_info; }
SetInfo(wxWebViewDOMElementInfo info)391     void SetInfo(wxWebViewDOMElementInfo info) { m_info = info; }
392 
GetPosition()393     wxPoint GetPosition() const { return m_position; }
SetPosition(wxPoint pos)394     void SetPosition(wxPoint pos) { m_position = pos; }
395 
396 private:
397     wxWebViewDOMElementInfo m_info;
398     wxPoint m_position;
399 };
400 
401 // copied from page/Console.h
402 enum wxWebViewConsoleMessageLevel {
403     TipMessageLevel,
404     LogMessageLevel,
405     WarningMessageLevel,
406     ErrorMessageLevel
407 };
408 
409 class WXDLLIMPEXP_WEBKIT wxWebViewConsoleMessageEvent : public wxCommandEvent
410 {
411 #ifndef SWIG
DECLARE_DYNAMIC_CLASS(wxWebViewConsoleMessageEvent)412     DECLARE_DYNAMIC_CLASS( wxWebViewConsoleMessageEvent )
413 #endif
414 
415 public:
416     wxString GetMessage() const { return m_message; }
SetMessage(const wxString & message)417     void SetMessage(const wxString& message) { m_message = message; }
418 
GetLineNumber()419     unsigned int GetLineNumber() const { return m_lineNumber; }
SetLineNumber(unsigned int lineNumber)420     void SetLineNumber(unsigned int lineNumber) { m_lineNumber = lineNumber; }
421 
GetSourceID()422     wxString GetSourceID() const { return m_sourceID; }
SetSourceID(const wxString & sourceID)423     void SetSourceID(const wxString& sourceID) { m_sourceID = sourceID; }
424 
425     wxWebViewConsoleMessageEvent( wxWindow* win = (wxWindow*) NULL );
Clone(void)426     wxEvent *Clone(void) const { return new wxWebViewConsoleMessageEvent(*this); }
427 
GetLevel()428     wxWebViewConsoleMessageLevel GetLevel() const { return m_level; }
SetLevel(wxWebViewConsoleMessageLevel level)429     void SetLevel(wxWebViewConsoleMessageLevel level) { m_level = level; }
430 
431 private:
432     unsigned int m_lineNumber;
433     wxString m_message;
434     wxString m_sourceID;
435     wxWebViewConsoleMessageLevel m_level;
436 };
437 
438 class WXDLLIMPEXP_WEBKIT wxWebViewAlertEvent : public wxCommandEvent
439 {
440 #ifndef SWIG
DECLARE_DYNAMIC_CLASS(wxWebViewAlertEvent)441     DECLARE_DYNAMIC_CLASS( wxWebViewAlertEvent )
442 #endif
443 
444 public:
445     wxString GetMessage() const { return m_message; }
SetMessage(const wxString & message)446     void SetMessage(const wxString& message) { m_message = message; }
447 
448     wxWebViewAlertEvent( wxWindow* win = (wxWindow*) NULL );
Clone(void)449     wxEvent *Clone(void) const { return new wxWebViewAlertEvent(*this); }
450 
451 private:
452     wxString m_message;
453 };
454 
455 class WXDLLIMPEXP_WEBKIT wxWebViewConfirmEvent : public wxWebViewAlertEvent
456 {
457 #ifndef SWIG
DECLARE_DYNAMIC_CLASS(wxWebViewConfirmEvent)458     DECLARE_DYNAMIC_CLASS( wxWebViewConfirmEvent )
459 #endif
460 
461 public:
462     int GetReturnCode() const { return m_returnCode; }
SetReturnCode(int code)463     void SetReturnCode(int code) { m_returnCode = code; }
464 
465     wxWebViewConfirmEvent( wxWindow* win = (wxWindow*) NULL );
Clone(void)466     wxEvent *Clone(void) const { return new wxWebViewConfirmEvent(*this); }
467 
468 private:
469     int m_returnCode;
470 };
471 
472 class WXDLLIMPEXP_WEBKIT wxWebViewPromptEvent : public wxWebViewConfirmEvent
473 {
474 #ifndef SWIG
DECLARE_DYNAMIC_CLASS(wxWebViewPromptEvent)475     DECLARE_DYNAMIC_CLASS( wxWebViewPromptEvent )
476 #endif
477 
478 public:
479     wxString GetResponse() const { return m_response; }
SetResponse(const wxString & response)480     void SetResponse(const wxString& response) { m_response = response; }
481 
482     wxWebViewPromptEvent( wxWindow* win = (wxWindow*) NULL );
Clone(void)483     wxEvent *Clone(void) const { return new wxWebViewPromptEvent(*this); }
484 
485 private:
486     wxString m_response;
487 };
488 
489 class WXDLLIMPEXP_WEBKIT wxWebViewReceivedTitleEvent : public wxCommandEvent
490 {
491 #ifndef SWIG
DECLARE_DYNAMIC_CLASS(wxWebViewReceivedTitleEvent)492     DECLARE_DYNAMIC_CLASS( wxWebViewReceivedTitleEvent )
493 #endif
494 
495 public:
496     wxString GetTitle() const { return m_title; }
SetTitle(const wxString & title)497     void SetTitle(const wxString& title) { m_title = title; }
498 
499     wxWebViewReceivedTitleEvent( wxWindow* win = static_cast<wxWindow*>(NULL));
Clone(void)500     wxEvent *Clone(void) const { return new wxWebViewReceivedTitleEvent(*this); }
501 
502 private:
503     wxString m_title;
504 };
505 
506 class WXDLLIMPEXP_WEBKIT wxWebViewWindowObjectClearedEvent : public wxCommandEvent
507 {
508 #ifndef SWIG
DECLARE_DYNAMIC_CLASS(wxWebViewWindowObjectClearedEvent)509     DECLARE_DYNAMIC_CLASS( wxWebViewWindowObjectClearedEvent )
510 #endif
511 
512 public:
513     JSGlobalContextRef GetJSContext() const { return m_jsContext; }
SetJSContext(JSGlobalContextRef context)514     void SetJSContext(JSGlobalContextRef context) { m_jsContext = context; }
515 
GetWindowObject()516     JSObjectRef GetWindowObject() const { return m_windowObject; }
SetWindowObject(JSObjectRef object)517     void SetWindowObject(JSObjectRef object) { m_windowObject = object; }
518 
519     wxWebViewWindowObjectClearedEvent( wxWindow* win = static_cast<wxWindow*>(NULL));
Clone(void)520     wxEvent *Clone(void) const { return new wxWebViewWindowObjectClearedEvent(*this); }
521 
522 private:
523     JSGlobalContextRef m_jsContext;
524     JSObjectRef m_windowObject;
525 };
526 
527 class WXDLLIMPEXP_WEBKIT wxWebViewContentsChangedEvent : public wxCommandEvent {
528 #ifndef SWIG
529     DECLARE_DYNAMIC_CLASS(wxWebViewContentsChangedEvent)
530 #endif
531 
532 public:
533     wxWebViewContentsChangedEvent(wxWindow* win = static_cast<wxWindow*>(0));
Clone(void)534     wxEvent *Clone(void) const { return new wxWebViewContentsChangedEvent(*this); }
535 };
536 
537 class WXDLLIMPEXP_WEBKIT wxWebViewSelectionChangedEvent : public wxCommandEvent {
538 #ifndef SWIG
539     DECLARE_DYNAMIC_CLASS(wxWebViewSelectionChangedEvent)
540 #endif
541 
542 public:
543     wxWebViewSelectionChangedEvent(wxWindow* win = static_cast<wxWindow*>(0));
Clone(void)544     wxEvent *Clone(void) const { return new wxWebViewSelectionChangedEvent(*this); }
545 };
546 
547 typedef void (wxEvtHandler::*wxWebViewLoadEventFunction)(wxWebViewLoadEvent&);
548 typedef void (wxEvtHandler::*wxWebViewBeforeLoadEventFunction)(wxWebViewBeforeLoadEvent&);
549 typedef void (wxEvtHandler::*wxWebViewNewWindowEventFunction)(wxWebViewNewWindowEvent&);
550 typedef void (wxEvtHandler::*wxWebViewRightClickEventFunction)(wxWebViewRightClickEvent&);
551 typedef void (wxEvtHandler::*wxWebViewConsoleMessageEventFunction)(wxWebViewConsoleMessageEvent&);
552 typedef void (wxEvtHandler::*wxWebViewAlertEventFunction)(wxWebViewAlertEvent&);
553 typedef void (wxEvtHandler::*wxWebViewConfirmEventFunction)(wxWebViewConfirmEvent&);
554 typedef void (wxEvtHandler::*wxWebViewPromptEventFunction)(wxWebViewPromptEvent&);
555 typedef void (wxEvtHandler::*wxWebViewReceivedTitleEventFunction)(wxWebViewReceivedTitleEvent&);
556 typedef void (wxEvtHandler::*wxWebViewWindowObjectClearedFunction)(wxWebViewWindowObjectClearedEvent&);
557 typedef void (wxEvtHandler::*wxWebViewContentsChangedFunction)(wxWebViewContentsChangedEvent&);
558 typedef void (wxEvtHandler::*wxWebViewSelectionChangedFunction)(wxWebViewSelectionChangedEvent&);
559 
560 #define wxWebViewLoadEventHandler(func) \
561     (wxObjectEventFunction)(wxEventFunction)wxStaticCastEvent(wxWebViewLoadEventFunction, &func)
562 #define wxWebViewBeforeLoadEventHandler(func) \
563     (wxObjectEventFunction)(wxEventFunction)wxStaticCastEvent(wxWebViewBeforeLoadEventFunction, &func)
564 #define wxWebViewNewWindowEventHandler(func) \
565     (wxObjectEventFunction)(wxEventFunction)wxStaticCastEvent(wxWebViewNewWindowEventFunction, &func)
566 #define wxWebViewRightClickEventHandler(func) \
567     (wxObjectEventFunction)(wxEventFunction)wxStaticCastEvent(wxWebViewRightClickEventFunction, &func)
568 #define wxWebViewConsoleMessageEventHandler(func) \
569     (wxObjectEventFunction)(wxEventFunction)wxStaticCastEvent(wxWebViewConsoleMessageEventFunction, &func)
570 #define wxWebViewAlertEventHandler(func) \
571     (wxObjectEventFunction)(wxEventFunction)wxStaticCastEvent(wxWebViewAlertEventFunction, &func)
572 #define wxWebViewConfirmEventHandler(func) \
573     (wxObjectEventFunction)(wxEventFunction)wxStaticCastEvent(wxWebViewConfirmEventFunction, &func)
574 #define wxWebViewPromptEventHandler(func) \
575     (wxObjectEventFunction)(wxEventFunction)wxStaticCastEvent(wxWebViewPromptEventFunction, &func)
576 #define wxWebViewReceivedTitleEventHandler(func) \
577     (wxObjectEventFunction)(wxEventFunction)wxStaticCastEvent(wxWebViewReceivedTitleEventFunction, &func)
578 #define wxWebViewWindowObjectClearedEventHandler(func) \
579     (wxObjectEventFunction)(wxEventFunction)wxStaticCastEvent(wxWebViewWindowObjectClearedFunction, &func)
580 #define wxWebViewContentsChangedEventHandler(func) \
581     (wxObjectEventFunction)(wxEventFunction)wxStaticCastEvent(wxWebViewContentsChangedEventFunction, &func)
582 #define wxWebViewSelectionChangedEventHandler(func) \
583     (wxObjectEventFunction)(wxEventFunction)wxStaticCastEvent(wxWebViewSelectionChangedEventFunction, &func)
584 
585 #ifndef SWIG
586 BEGIN_DECLARE_EVENT_TYPES()
587     DECLARE_EXPORTED_EVENT_TYPE(WXDLLIMPEXP_WEBKIT, wxEVT_WEBVIEW_BEFORE_LOAD, wxID_ANY)
588     DECLARE_EXPORTED_EVENT_TYPE(WXDLLIMPEXP_WEBKIT, wxEVT_WEBVIEW_LOAD, wxID_ANY)
589     DECLARE_EXPORTED_EVENT_TYPE(WXDLLIMPEXP_WEBKIT, wxEVT_WEBVIEW_NEW_WINDOW, wxID_ANY)
590     DECLARE_EXPORTED_EVENT_TYPE(WXDLLIMPEXP_WEBKIT, wxEVT_WEBVIEW_RIGHT_CLICK, wxID_ANY)
591     DECLARE_EXPORTED_EVENT_TYPE(WXDLLIMPEXP_WEBKIT, wxEVT_WEBVIEW_CONSOLE_MESSAGE, wxID_ANY)
592     DECLARE_EXPORTED_EVENT_TYPE(WXDLLIMPEXP_WEBKIT, wxEVT_WEBVIEW_JS_ALERT, wxID_ANY)
593     DECLARE_EXPORTED_EVENT_TYPE(WXDLLIMPEXP_WEBKIT, wxEVT_WEBVIEW_JS_CONFIRM, wxID_ANY)
594     DECLARE_EXPORTED_EVENT_TYPE(WXDLLIMPEXP_WEBKIT, wxEVT_WEBVIEW_JS_PROMPT, wxID_ANY)
595     DECLARE_EXPORTED_EVENT_TYPE(WXDLLIMPEXP_WEBKIT, wxEVT_WEBVIEW_RECEIVED_TITLE, wxID_ANY)
596     DECLARE_EXPORTED_EVENT_TYPE(WXDLLIMPEXP_WEBKIT, wxEVT_WEBVIEW_WINDOW_OBJECT_CLEARED, wxID_ANY)
597     DECLARE_EXPORTED_EVENT_TYPE(WXDLLIMPEXP_WEBKIT, wxEVT_WEBVIEW_CONTENTS_CHANGED, wxID_ANY)
598     DECLARE_EXPORTED_EVENT_TYPE(WXDLLIMPEXP_WEBKIT, wxEVT_WEBVIEW_SELECTION_CHANGED, wxID_ANY)
599 END_DECLARE_EVENT_TYPES()
600 #endif
601 
602 #define EVT_WEBVIEW_LOAD(winid, func)                       \
603             DECLARE_EVENT_TABLE_ENTRY( wxEVT_WEBVIEW_LOAD, \
604                             winid, \
605                             wxID_ANY, \
606                             (wxObjectEventFunction)   \
607                             (wxWebViewLoadEventFunction) & func, \
608                             static_cast<wxObject*>(NULL)),
609 
610 #define EVT_WEBVIEW_BEFORE_LOAD(winid, func)                       \
611             DECLARE_EVENT_TABLE_ENTRY( wxEVT_WEBVIEW_BEFORE_LOAD, \
612                             winid, \
613                             wxID_ANY, \
614                             (wxObjectEventFunction)   \
615                             (wxWebViewBeforeLoadEventFunction) & func, \
616                             static_cast<wxObject*>(NULL)),
617 
618 #define EVT_WEBVIEW_NEW_WINDOW(winid, func)                       \
619             DECLARE_EVENT_TABLE_ENTRY( wxEVT_WEBVIEW_NEW_WINDOW, \
620                             winid, \
621                             wxID_ANY, \
622                             (wxObjectEventFunction)   \
623                             (wxWebViewNewWindowEventFunction) & func, \
624                             static_cast<wxObject*>(NULL)),
625 
626 #define EVT_WEBVIEW_RIGHT_CLICK(winid, func)                       \
627             DECLARE_EVENT_TABLE_ENTRY( wxEVT_WEBVIEW_RIGHT_CLICK, \
628                             winid, \
629                             wxID_ANY, \
630                             (wxObjectEventFunction)   \
631                             (wxWebViewRightClickEventFunction) & func, \
632                             static_cast<wxObject*>(NULL)),
633 
634 #define EVT_WEBVIEW_CONSOLE_MESSAGE(winid, func)                       \
635             DECLARE_EVENT_TABLE_ENTRY( wxEVT_WEBVIEW_CONSOLE_MESSAGE, \
636                             winid, \
637                             wxID_ANY, \
638                             (wxObjectEventFunction)   \
639                             (wxWebViewConsoleMessageEventFunction) & func, \
640                             static_cast<wxObject*>(NULL)),
641 
642 #define EVT_WEBVIEW_JS_ALERT(winid, func)                       \
643             DECLARE_EVENT_TABLE_ENTRY( wxEVT_WEBVIEW_JS_ALERT, \
644                             winid, \
645                             wxID_ANY, \
646                             (wxObjectEventFunction)   \
647                             (wxWebViewAlertEventFunction) & func, \
648                             static_cast<wxObject*>(NULL)),
649 
650 #define EVT_WEBVIEW_JS_CONFIRM(winid, func)                       \
651             DECLARE_EVENT_TABLE_ENTRY( wxEVT_WEBVIEW_JS_CONFIRM, \
652                             winid, \
653                             wxID_ANY, \
654                             (wxObjectEventFunction)   \
655                             (wxWebViewConfirmEventFunction) & func, \
656                             static_cast<wxObject*>(NULL)),
657 
658 #define EVT_WEBVIEW_JS_PROMPT(winid, func)                       \
659             DECLARE_EVENT_TABLE_ENTRY( wxEVT_WEBVIEW_JS_PROMPT, \
660                             winid, \
661                             wxID_ANY, \
662                             (wxObjectEventFunction)   \
663                             (wxWebViewPromptEventFunction) & func, \
664                             static_cast<wxObject*>(NULL)),
665 
666 #define EVT_WEBVIEW_RECEIVED_TITLE(winid, func)                       \
667             DECLARE_EVENT_TABLE_ENTRY( wxEVT_WEBVIEW_RECEIVED_TITLE, \
668                             winid, \
669                             wxID_ANY, \
670                             (wxObjectEventFunction)   \
671                             (wxWebViewReceivedTitleEventFunction) & func, \
672                             static_cast<wxObject*>(NULL)),
673 
674 #define EVT_WEBVIEW_WINDOW_OBJECT_CLEARED(winid, func)                       \
675             DECLARE_EVENT_TABLE_ENTRY( wxEVT_WEBVIEW_WINDOW_OBJECT_CLEARED, \
676                             winid, \
677                             wxID_ANY, \
678                             (wxObjectEventFunction)   \
679                             (wxWebViewWindowObjectClearedFunction) & func, \
680                             static_cast<wxObject*>(NULL)),
681 
682 #define EVT_WEBVIEW_CONTENTS_CHANGED(winid, func)                       \
683             DECLARE_EVENT_TABLE_ENTRY(wxEVT_WEBVIEW_CONTENTS_CHANGED, \
684                             winid, \
685                             wxID_ANY, \
686                             (wxObjectEventFunction)   \
687                             (wxWebViewContentsChangedEventFunction) & func, \
688                             static_cast<wxObject*>(0)),
689 
690 #define EVT_WEBVIEW_SELECTION_CHANGED(winid, func)                       \
691             DECLARE_EVENT_TABLE_ENTRY(wxEVT_WEBVIEW_SELECTION_CHANGED, \
692                             winid, \
693                             wxID_ANY, \
694                             (wxObjectEventFunction)   \
695                             (wxWebViewSelectionChangedEventFunction) & func, \
696                             static_cast<wxObject*>(0)),
697 
698 
699 #endif // ifndef WXWEBVIEW_H
700