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 "WebFrame.h" 37 #include "WebKitDefines.h" 38 #include "WebSettings.h" 39 40 class WebViewPrivate; 41 class WebViewFrameData; 42 class wxWebFrame; 43 44 typedef struct OpaqueJSContext* JSGlobalContextRef; 45 typedef struct OpaqueJSValue* JSObjectRef; 46 47 namespace WebCore { 48 class ChromeClientWx; 49 class FrameLoaderClientWx; 50 } 51 52 #ifndef SWIG 53 extern WXDLLIMPEXP_WEBKIT const wxChar* wxWebViewNameStr; 54 #endif 55 56 static const int defaultCacheCapacity = 8192 * 1024; // mirrors Cache.cpp 57 58 class WXDLLIMPEXP_WEBKIT wxWebViewCachePolicy 59 { 60 public: 61 wxWebViewCachePolicy(unsigned minDead = 0, unsigned maxDead = defaultCacheCapacity, unsigned totalCapacity = defaultCacheCapacity) m_minDeadCapacity(minDead)62 : m_minDeadCapacity(minDead) 63 , m_maxDeadCapacity(maxDead) 64 , m_capacity(totalCapacity) 65 {} 66 ~wxWebViewCachePolicy()67 ~wxWebViewCachePolicy() {} 68 GetCapacity()69 unsigned GetCapacity() const { return m_capacity; } SetCapacity(int capacity)70 void SetCapacity(int capacity) { m_capacity = capacity; } 71 GetMinDeadCapacity()72 unsigned GetMinDeadCapacity() const { return m_minDeadCapacity; } SetMinDeadCapacity(unsigned minDeadCapacity)73 void SetMinDeadCapacity(unsigned minDeadCapacity) { m_minDeadCapacity = minDeadCapacity; } 74 GetMaxDeadCapacity()75 unsigned GetMaxDeadCapacity() const { return m_maxDeadCapacity; } SetMaxDeadCapacity(unsigned maxDeadCapacity)76 void SetMaxDeadCapacity(unsigned maxDeadCapacity) { m_maxDeadCapacity = maxDeadCapacity; } 77 78 protected: 79 unsigned m_capacity; 80 unsigned m_minDeadCapacity; 81 unsigned m_maxDeadCapacity; 82 }; 83 84 85 // copied from WebKit/mac/Misc/WebKitErrors[Private].h 86 enum { 87 WebKitErrorCannotShowMIMEType = 100, 88 WebKitErrorCannotShowURL = 101, 89 WebKitErrorFrameLoadInterruptedByPolicyChange = 102, 90 WebKitErrorCannotUseRestrictedPort = 103, 91 WebKitErrorCannotFindPlugIn = 200, 92 WebKitErrorCannotLoadPlugIn = 201, 93 WebKitErrorJavaUnavailable = 202, 94 }; 95 96 enum wxProxyType { 97 HTTP, 98 Socks4, 99 Socks4A, 100 Socks5, 101 Socks5Hostname 102 }; 103 104 class WXDLLIMPEXP_WEBKIT wxWebView : public wxWindow 105 { 106 // ChromeClientWx needs to get the Page* stored by the wxWebView 107 // for the createWindow function. 108 friend class WebCore::ChromeClientWx; 109 friend class WebCore::FrameLoaderClientWx; 110 111 public: 112 // ctor(s) 113 #if SWIG 114 %pythonAppend wxWebView "self._setOORInfo(self)" 115 %pythonAppend wxWebView() "" 116 #endif 117 118 wxWebView(wxWindow* parent, int id = wxID_ANY, 119 const wxPoint& point = wxDefaultPosition, 120 const wxSize& size = wxDefaultSize, 121 long style = 0, 122 const wxString& name = wxWebViewNameStr); // For wxWebView internal data passing 123 #if SWIG 124 %rename(PreWebView) wxWebView(); 125 #else 126 wxWebView(); 127 #endif 128 129 bool Create(wxWindow* parent, int id = wxID_ANY, 130 const wxPoint& point = wxDefaultPosition, 131 const wxSize& size = wxDefaultSize, 132 long style = 0, 133 const wxString& name = wxWebViewNameStr); // For wxWebView internal data passing 134 135 #ifndef SWIG 136 virtual ~wxWebView(); 137 #endif 138 139 void LoadURL(const wxString& url); 140 bool GoBack(); 141 bool GoForward(); 142 void Stop(); 143 void Reload(); 144 145 bool CanGoBack(); 146 bool CanGoForward(); 147 148 bool CanCut(); 149 bool CanCopy(); 150 bool CanPaste(); 151 152 void Cut(); 153 void Copy(); 154 void Paste(); 155 156 //bool CanGetPageSource(); 157 wxString GetPageSource(); 158 void SetPageSource(const wxString& source, const wxString& baseUrl = wxEmptyString); 159 160 wxString GetInnerText(); 161 wxString GetAsMarkup(); 162 wxString GetExternalRepresentation(); 163 164 void SetTransparent(bool transparent); 165 bool IsTransparent() const; 166 167 wxString RunScript(const wxString& javascript); 168 169 bool FindString(const wxString& string, bool forward = true, 170 bool caseSensitive = false, bool wrapSelection = true, 171 bool startInSelection = true); 172 173 bool CanIncreaseTextSize() const; 174 void IncreaseTextSize(); 175 bool CanDecreaseTextSize() const; 176 void DecreaseTextSize(); 177 void ResetTextSize(); 178 void MakeEditable(bool enable); IsEditable()179 bool IsEditable() const { return m_isEditable; } 180 GetPageTitle()181 wxString GetPageTitle() const { return m_title; } SetPageTitle(const wxString & title)182 void SetPageTitle(const wxString& title) { m_title = title; } 183 GetMainFrame()184 wxWebFrame* GetMainFrame() { return m_mainFrame; } 185 186 wxWebViewDOMElementInfo HitTest(const wxPoint& pos) const; 187 188 bool ShouldClose() const; 189 190 static void SetCachePolicy(const wxWebViewCachePolicy& cachePolicy); 191 static wxWebViewCachePolicy GetCachePolicy(); 192 SetMouseWheelZooms(bool mouseWheelZooms)193 void SetMouseWheelZooms(bool mouseWheelZooms) { m_mouseWheelZooms = mouseWheelZooms; } GetMouseWheelZooms()194 bool GetMouseWheelZooms() const { return m_mouseWheelZooms; } 195 196 static void SetDatabaseDirectory(const wxString& databaseDirectory); 197 static wxString GetDatabaseDirectory(); 198 199 static void SetProxyInfo(const wxString& host = wxEmptyString, 200 unsigned long port = 0, 201 wxProxyType type = HTTP, 202 const wxString& username = wxEmptyString, 203 const wxString& password = wxEmptyString); 204 205 wxWebSettings GetWebSettings(); 206 wxWebKitParseMode GetParseMode() const; 207 208 protected: 209 210 // event handlers (these functions should _not_ be virtual) 211 void OnPaint(wxPaintEvent& event); 212 void OnSize(wxSizeEvent& event); 213 void OnMouseEvents(wxMouseEvent& event); 214 void OnContextMenuEvents(wxContextMenuEvent& event); 215 void OnMenuSelectEvents(wxCommandEvent& event); 216 void OnKeyEvents(wxKeyEvent& event); 217 void OnSetFocus(wxFocusEvent& event); 218 void OnKillFocus(wxFocusEvent& event); 219 220 private: 221 // any class wishing to process wxWindows events must use this macro 222 #ifndef SWIG 223 DECLARE_EVENT_TABLE() 224 DECLARE_DYNAMIC_CLASS(wxWebView) 225 #endif 226 float m_textMagnifier; 227 bool m_isEditable; 228 bool m_isInitialized; 229 bool m_beingDestroyed; 230 bool m_mouseWheelZooms; 231 WebViewPrivate* m_impl; 232 wxWebFrame* m_mainFrame; 233 wxString m_title; 234 235 }; 236 237 // ---------------------------------------------------------------------------- 238 // Web Kit Events 239 // ---------------------------------------------------------------------------- 240 241 enum { 242 wxWEBVIEW_LOAD_STARTED = 1, 243 wxWEBVIEW_LOAD_NEGOTIATING = 2, 244 wxWEBVIEW_LOAD_REDIRECTING = 4, 245 wxWEBVIEW_LOAD_TRANSFERRING = 8, 246 wxWEBVIEW_LOAD_STOPPED = 16, 247 wxWEBVIEW_LOAD_FAILED = 32, 248 wxWEBVIEW_LOAD_DL_COMPLETED = 64, 249 wxWEBVIEW_LOAD_DOC_COMPLETED = 128, 250 wxWEBVIEW_LOAD_ONLOAD_HANDLED = 256, 251 wxWEBVIEW_LOAD_WINDOW_OBJECT_CLEARED = 512 252 }; 253 254 enum { 255 wxWEBVIEW_NAV_LINK_CLICKED = 1, 256 wxWEBVIEW_NAV_BACK_NEXT = 2, 257 wxWEBVIEW_NAV_FORM_SUBMITTED = 4, 258 wxWEBVIEW_NAV_RELOAD = 8, 259 wxWEBVIEW_NAV_FORM_RESUBMITTED = 16, 260 wxWEBVIEW_NAV_OTHER = 32 261 }; 262 263 class WXDLLIMPEXP_WEBKIT wxWebViewBeforeLoadEvent : public wxCommandEvent 264 { 265 #ifndef SWIG DECLARE_DYNAMIC_CLASS(wxWebViewBeforeLoadEvent)266 DECLARE_DYNAMIC_CLASS( wxWebViewBeforeLoadEvent ) 267 #endif 268 269 public: 270 bool IsCancelled() const { return m_cancelled; } 271 void Cancel(bool cancel = true) { m_cancelled = cancel; } GetURL()272 wxString GetURL() const { return m_url; } SetURL(const wxString & url)273 void SetURL(const wxString& url) { m_url = url; } SetNavigationType(int navType)274 void SetNavigationType(int navType) { m_navType = navType; } GetNavigationType()275 int GetNavigationType() const { return m_navType; } 276 277 wxWebViewBeforeLoadEvent( wxWindow* win = (wxWindow*) NULL ); Clone(void)278 wxEvent *Clone(void) const { return new wxWebViewBeforeLoadEvent(*this); } 279 280 private: 281 bool m_cancelled; 282 wxString m_url; 283 int m_navType; 284 }; 285 286 class WXDLLIMPEXP_WEBKIT wxWebViewLoadEvent : public wxCommandEvent 287 { 288 #ifndef SWIG DECLARE_DYNAMIC_CLASS(wxWebViewLoadEvent)289 DECLARE_DYNAMIC_CLASS( wxWebViewLoadEvent ) 290 #endif 291 292 public: 293 int GetState() const { return m_state; } SetState(const int state)294 void SetState(const int state) { m_state = state; } GetURL()295 wxString GetURL() const { return m_url; } SetURL(const wxString & url)296 void SetURL(const wxString& url) { m_url = url; } 297 298 wxWebViewLoadEvent( wxWindow* win = (wxWindow*) NULL ); Clone(void)299 wxEvent *Clone(void) const { return new wxWebViewLoadEvent(*this); } 300 301 private: 302 int m_state; 303 wxString m_url; 304 }; 305 306 class WXDLLIMPEXP_WEBKIT wxWebKitWindowFeatures 307 { 308 public: wxWebKitWindowFeatures()309 wxWebKitWindowFeatures() 310 : menuBarVisible(true) 311 , statusBarVisible(true) 312 , toolBarVisible(true) 313 , locationBarVisible(true) 314 , scrollbarsVisible(true) 315 , resizable(true) 316 , fullscreen(false) 317 , dialog(false) 318 { } 319 320 bool menuBarVisible; 321 bool statusBarVisible; 322 bool toolBarVisible; 323 bool locationBarVisible; 324 bool scrollbarsVisible; 325 bool resizable; 326 bool fullscreen; 327 bool dialog; 328 }; 329 330 class WXDLLIMPEXP_WEBKIT wxWebViewNewWindowEvent : public wxCommandEvent 331 { 332 #ifndef SWIG DECLARE_DYNAMIC_CLASS(wxWebViewNewWindowEvent)333 DECLARE_DYNAMIC_CLASS( wxWebViewNewWindowEvent ) 334 #endif 335 336 public: 337 wxString GetURL() const { return m_url; } SetURL(const wxString & url)338 void SetURL(const wxString& url) { m_url = url; } GetTargetName()339 wxString GetTargetName() const { return m_targetName; } SetTargetName(const wxString & name)340 void SetTargetName(const wxString& name) { m_targetName = name; } GetWebView()341 wxWebView* GetWebView() { return m_webView; } SetWebView(wxWebView * webView)342 void SetWebView(wxWebView* webView) { m_webView = webView; } GetWindowFeatures()343 wxWebKitWindowFeatures GetWindowFeatures() { return m_features; } SetWindowFeatures(wxWebKitWindowFeatures features)344 void SetWindowFeatures(wxWebKitWindowFeatures features) { m_features = features; } 345 346 wxWebViewNewWindowEvent( wxWindow* win = static_cast<wxWindow*>(NULL)); Clone(void)347 wxEvent *Clone(void) const { return new wxWebViewNewWindowEvent(*this); } 348 349 private: 350 wxWebView* m_webView; 351 wxWebKitWindowFeatures m_features; 352 wxString m_url; 353 wxString m_targetName; 354 }; 355 356 class WXDLLIMPEXP_WEBKIT wxWebViewRightClickEvent : public wxCommandEvent 357 { 358 #ifndef SWIG 359 DECLARE_DYNAMIC_CLASS( wxWebViewRightClickEvent ) 360 #endif 361 362 public: 363 wxWebViewRightClickEvent( wxWindow* win = static_cast<wxWindow*>(NULL)); Clone(void)364 wxEvent *Clone(void) const { return new wxWebViewRightClickEvent(*this); } 365 GetInfo()366 wxWebViewDOMElementInfo GetInfo() const { return m_info; } SetInfo(wxWebViewDOMElementInfo info)367 void SetInfo(wxWebViewDOMElementInfo info) { m_info = info; } 368 GetPosition()369 wxPoint GetPosition() const { return m_position; } SetPosition(wxPoint pos)370 void SetPosition(wxPoint pos) { m_position = pos; } 371 372 private: 373 wxWebViewDOMElementInfo m_info; 374 wxPoint m_position; 375 }; 376 377 // copied from page/Console.h 378 enum wxWebViewConsoleMessageLevel { 379 TipMessageLevel, 380 LogMessageLevel, 381 WarningMessageLevel, 382 ErrorMessageLevel 383 }; 384 385 class WXDLLIMPEXP_WEBKIT wxWebViewConsoleMessageEvent : public wxCommandEvent 386 { 387 #ifndef SWIG DECLARE_DYNAMIC_CLASS(wxWebViewConsoleMessageEvent)388 DECLARE_DYNAMIC_CLASS( wxWebViewConsoleMessageEvent ) 389 #endif 390 391 public: 392 wxString GetMessage() const { return m_message; } SetMessage(const wxString & message)393 void SetMessage(const wxString& message) { m_message = message; } 394 GetLineNumber()395 unsigned int GetLineNumber() const { return m_lineNumber; } SetLineNumber(unsigned int lineNumber)396 void SetLineNumber(unsigned int lineNumber) { m_lineNumber = lineNumber; } 397 GetSourceID()398 wxString GetSourceID() const { return m_sourceID; } SetSourceID(const wxString & sourceID)399 void SetSourceID(const wxString& sourceID) { m_sourceID = sourceID; } 400 401 wxWebViewConsoleMessageEvent( wxWindow* win = (wxWindow*) NULL ); Clone(void)402 wxEvent *Clone(void) const { return new wxWebViewConsoleMessageEvent(*this); } 403 GetLevel()404 wxWebViewConsoleMessageLevel GetLevel() const { return m_level; } SetLevel(wxWebViewConsoleMessageLevel level)405 void SetLevel(wxWebViewConsoleMessageLevel level) { m_level = level; } 406 407 private: 408 unsigned int m_lineNumber; 409 wxString m_message; 410 wxString m_sourceID; 411 wxWebViewConsoleMessageLevel m_level; 412 }; 413 414 class WXDLLIMPEXP_WEBKIT wxWebViewAlertEvent : public wxCommandEvent 415 { 416 #ifndef SWIG DECLARE_DYNAMIC_CLASS(wxWebViewAlertEvent)417 DECLARE_DYNAMIC_CLASS( wxWebViewAlertEvent ) 418 #endif 419 420 public: 421 wxString GetMessage() const { return m_message; } SetMessage(const wxString & message)422 void SetMessage(const wxString& message) { m_message = message; } 423 424 wxWebViewAlertEvent( wxWindow* win = (wxWindow*) NULL ); Clone(void)425 wxEvent *Clone(void) const { return new wxWebViewAlertEvent(*this); } 426 427 private: 428 wxString m_message; 429 }; 430 431 class WXDLLIMPEXP_WEBKIT wxWebViewConfirmEvent : public wxWebViewAlertEvent 432 { 433 #ifndef SWIG DECLARE_DYNAMIC_CLASS(wxWebViewConfirmEvent)434 DECLARE_DYNAMIC_CLASS( wxWebViewConfirmEvent ) 435 #endif 436 437 public: 438 int GetReturnCode() const { return m_returnCode; } SetReturnCode(int code)439 void SetReturnCode(int code) { m_returnCode = code; } 440 441 wxWebViewConfirmEvent( wxWindow* win = (wxWindow*) NULL ); Clone(void)442 wxEvent *Clone(void) const { return new wxWebViewConfirmEvent(*this); } 443 444 private: 445 int m_returnCode; 446 }; 447 448 class WXDLLIMPEXP_WEBKIT wxWebViewPromptEvent : public wxWebViewConfirmEvent 449 { 450 #ifndef SWIG DECLARE_DYNAMIC_CLASS(wxWebViewPromptEvent)451 DECLARE_DYNAMIC_CLASS( wxWebViewPromptEvent ) 452 #endif 453 454 public: 455 wxString GetResponse() const { return m_response; } SetResponse(const wxString & response)456 void SetResponse(const wxString& response) { m_response = response; } 457 458 wxWebViewPromptEvent( wxWindow* win = (wxWindow*) NULL ); Clone(void)459 wxEvent *Clone(void) const { return new wxWebViewPromptEvent(*this); } 460 461 private: 462 wxString m_response; 463 }; 464 465 class WXDLLIMPEXP_WEBKIT wxWebViewReceivedTitleEvent : public wxCommandEvent 466 { 467 #ifndef SWIG DECLARE_DYNAMIC_CLASS(wxWebViewReceivedTitleEvent)468 DECLARE_DYNAMIC_CLASS( wxWebViewReceivedTitleEvent ) 469 #endif 470 471 public: 472 wxString GetTitle() const { return m_title; } SetTitle(const wxString & title)473 void SetTitle(const wxString& title) { m_title = title; } 474 475 wxWebViewReceivedTitleEvent( wxWindow* win = static_cast<wxWindow*>(NULL)); Clone(void)476 wxEvent *Clone(void) const { return new wxWebViewReceivedTitleEvent(*this); } 477 478 private: 479 wxString m_title; 480 }; 481 482 class WXDLLIMPEXP_WEBKIT wxWebViewWindowObjectClearedEvent : public wxCommandEvent 483 { 484 #ifndef SWIG DECLARE_DYNAMIC_CLASS(wxWebViewWindowObjectClearedEvent)485 DECLARE_DYNAMIC_CLASS( wxWebViewWindowObjectClearedEvent ) 486 #endif 487 488 public: 489 JSGlobalContextRef GetJSContext() const { return m_jsContext; } SetJSContext(JSGlobalContextRef context)490 void SetJSContext(JSGlobalContextRef context) { m_jsContext = context; } 491 GetWindowObject()492 JSObjectRef GetWindowObject() const { return m_windowObject; } SetWindowObject(JSObjectRef object)493 void SetWindowObject(JSObjectRef object) { m_windowObject = object; } 494 495 wxWebViewWindowObjectClearedEvent( wxWindow* win = static_cast<wxWindow*>(NULL)); Clone(void)496 wxEvent *Clone(void) const { return new wxWebViewWindowObjectClearedEvent(*this); } 497 498 private: 499 JSGlobalContextRef m_jsContext; 500 JSObjectRef m_windowObject; 501 }; 502 503 typedef void (wxEvtHandler::*wxWebViewLoadEventFunction)(wxWebViewLoadEvent&); 504 typedef void (wxEvtHandler::*wxWebViewBeforeLoadEventFunction)(wxWebViewBeforeLoadEvent&); 505 typedef void (wxEvtHandler::*wxWebViewNewWindowEventFunction)(wxWebViewNewWindowEvent&); 506 typedef void (wxEvtHandler::*wxWebViewRightClickEventFunction)(wxWebViewRightClickEvent&); 507 typedef void (wxEvtHandler::*wxWebViewConsoleMessageEventFunction)(wxWebViewConsoleMessageEvent&); 508 typedef void (wxEvtHandler::*wxWebViewAlertEventFunction)(wxWebViewAlertEvent&); 509 typedef void (wxEvtHandler::*wxWebViewConfirmEventFunction)(wxWebViewConfirmEvent&); 510 typedef void (wxEvtHandler::*wxWebViewPromptEventFunction)(wxWebViewPromptEvent&); 511 typedef void (wxEvtHandler::*wxWebViewReceivedTitleEventFunction)(wxWebViewReceivedTitleEvent&); 512 typedef void (wxEvtHandler::*wxWebViewWindowObjectClearedFunction)(wxWebViewWindowObjectClearedEvent&); 513 514 #define wxWebViewLoadEventHandler(func) \ 515 (wxObjectEventFunction)(wxEventFunction)wxStaticCastEvent(wxWebViewLoadEventFunction, &func) 516 #define wxWebViewBeforeLoadEventHandler(func) \ 517 (wxObjectEventFunction)(wxEventFunction)wxStaticCastEvent(wxWebViewBeforeLoadEventFunction, &func) 518 #define wxWebViewNewWindowEventHandler(func) \ 519 (wxObjectEventFunction)(wxEventFunction)wxStaticCastEvent(wxWebViewNewWindowEventFunction, &func) 520 #define wxWebViewRightClickEventHandler(func) \ 521 (wxObjectEventFunction)(wxEventFunction)wxStaticCastEvent(wxWebViewRightClickEventFunction, &func) 522 #define wxWebViewConsoleMessageEventHandler(func) \ 523 (wxObjectEventFunction)(wxEventFunction)wxStaticCastEvent(wxWebViewConsoleMessageEventFunction, &func) 524 #define wxWebViewAlertEventHandler(func) \ 525 (wxObjectEventFunction)(wxEventFunction)wxStaticCastEvent(wxWebViewAlertEventFunction, &func) 526 #define wxWebViewConfirmEventHandler(func) \ 527 (wxObjectEventFunction)(wxEventFunction)wxStaticCastEvent(wxWebViewConfirmEventFunction, &func) 528 #define wxWebViewPromptEventHandler(func) \ 529 (wxObjectEventFunction)(wxEventFunction)wxStaticCastEvent(wxWebViewPromptEventFunction, &func) 530 #define wxWebViewReceivedTitleEventHandler(func) \ 531 (wxObjectEventFunction)(wxEventFunction)wxStaticCastEvent(wxWebViewReceivedTitleEventFunction, &func) 532 #define wxWebViewWindowObjectClearedEventHandler(func) \ 533 (wxObjectEventFunction)(wxEventFunction)wxStaticCastEvent(wxWebViewWindowObjectClearedFunction, &func) 534 535 #ifndef SWIG 536 BEGIN_DECLARE_EVENT_TYPES() 537 DECLARE_EXPORTED_EVENT_TYPE(WXDLLIMPEXP_WEBKIT, wxEVT_WEBVIEW_BEFORE_LOAD, wxID_ANY) 538 DECLARE_EXPORTED_EVENT_TYPE(WXDLLIMPEXP_WEBKIT, wxEVT_WEBVIEW_LOAD, wxID_ANY) 539 DECLARE_EXPORTED_EVENT_TYPE(WXDLLIMPEXP_WEBKIT, wxEVT_WEBVIEW_NEW_WINDOW, wxID_ANY) 540 DECLARE_EXPORTED_EVENT_TYPE(WXDLLIMPEXP_WEBKIT, wxEVT_WEBVIEW_RIGHT_CLICK, wxID_ANY) 541 DECLARE_EXPORTED_EVENT_TYPE(WXDLLIMPEXP_WEBKIT, wxEVT_WEBVIEW_CONSOLE_MESSAGE, wxID_ANY) 542 DECLARE_EXPORTED_EVENT_TYPE(WXDLLIMPEXP_WEBKIT, wxEVT_WEBVIEW_JS_ALERT, wxID_ANY) 543 DECLARE_EXPORTED_EVENT_TYPE(WXDLLIMPEXP_WEBKIT, wxEVT_WEBVIEW_JS_CONFIRM, wxID_ANY) 544 DECLARE_EXPORTED_EVENT_TYPE(WXDLLIMPEXP_WEBKIT, wxEVT_WEBVIEW_JS_PROMPT, wxID_ANY) 545 DECLARE_EXPORTED_EVENT_TYPE(WXDLLIMPEXP_WEBKIT, wxEVT_WEBVIEW_RECEIVED_TITLE, wxID_ANY) 546 DECLARE_EXPORTED_EVENT_TYPE(WXDLLIMPEXP_WEBKIT, wxEVT_WEBVIEW_WINDOW_OBJECT_CLEARED, wxID_ANY) 547 END_DECLARE_EVENT_TYPES() 548 #endif 549 550 #define EVT_WEBVIEW_LOAD(winid, func) \ 551 DECLARE_EVENT_TABLE_ENTRY( wxEVT_WEBVIEW_LOAD, \ 552 winid, \ 553 wxID_ANY, \ 554 (wxObjectEventFunction) \ 555 (wxWebViewLoadEventFunction) & func, \ 556 static_cast<wxObject*>(NULL)), 557 558 #define EVT_WEBVIEW_BEFORE_LOAD(winid, func) \ 559 DECLARE_EVENT_TABLE_ENTRY( wxEVT_WEBVIEW_BEFORE_LOAD, \ 560 winid, \ 561 wxID_ANY, \ 562 (wxObjectEventFunction) \ 563 (wxWebViewBeforeLoadEventFunction) & func, \ 564 static_cast<wxObject*>(NULL)), 565 566 #define EVT_WEBVIEW_NEW_WINDOW(winid, func) \ 567 DECLARE_EVENT_TABLE_ENTRY( wxEVT_WEBVIEW_NEW_WINDOW, \ 568 winid, \ 569 wxID_ANY, \ 570 (wxObjectEventFunction) \ 571 (wxWebViewNewWindowEventFunction) & func, \ 572 static_cast<wxObject*>(NULL)), 573 574 #define EVT_WEBVIEW_RIGHT_CLICK(winid, func) \ 575 DECLARE_EVENT_TABLE_ENTRY( wxEVT_WEBVIEW_RIGHT_CLICK, \ 576 winid, \ 577 wxID_ANY, \ 578 (wxObjectEventFunction) \ 579 (wxWebViewRightClickEventFunction) & func, \ 580 static_cast<wxObject*>(NULL)), 581 582 #define EVT_WEBVIEW_CONSOLE_MESSAGE(winid, func) \ 583 DECLARE_EVENT_TABLE_ENTRY( wxEVT_WEBVIEW_CONSOLE_MESSAGE, \ 584 winid, \ 585 wxID_ANY, \ 586 (wxObjectEventFunction) \ 587 (wxWebViewConsoleMessageEventFunction) & func, \ 588 static_cast<wxObject*>(NULL)), 589 590 #define EVT_WEBVIEW_JS_ALERT(winid, func) \ 591 DECLARE_EVENT_TABLE_ENTRY( wxEVT_WEBVIEW_JS_ALERT, \ 592 winid, \ 593 wxID_ANY, \ 594 (wxObjectEventFunction) \ 595 (wxWebViewAlertEventFunction) & func, \ 596 static_cast<wxObject*>(NULL)), 597 598 #define EVT_WEBVIEW_JS_CONFIRM(winid, func) \ 599 DECLARE_EVENT_TABLE_ENTRY( wxEVT_WEBVIEW_JS_CONFIRM, \ 600 winid, \ 601 wxID_ANY, \ 602 (wxObjectEventFunction) \ 603 (wxWebViewConfirmEventFunction) & func, \ 604 static_cast<wxObject*>(NULL)), 605 606 #define EVT_WEBVIEW_JS_PROMPT(winid, func) \ 607 DECLARE_EVENT_TABLE_ENTRY( wxEVT_WEBVIEW_JS_PROMPT, \ 608 winid, \ 609 wxID_ANY, \ 610 (wxObjectEventFunction) \ 611 (wxWebViewPromptEventFunction) & func, \ 612 static_cast<wxObject*>(NULL)), 613 614 #define EVT_WEBVIEW_RECEIVED_TITLE(winid, func) \ 615 DECLARE_EVENT_TABLE_ENTRY( wxEVT_WEBVIEW_RECEIVED_TITLE, \ 616 winid, \ 617 wxID_ANY, \ 618 (wxObjectEventFunction) \ 619 (wxWebViewReceivedTitleEventFunction) & func, \ 620 static_cast<wxObject*>(NULL)), 621 622 #define EVT_WEBVIEW_WINDOW_OBJECT_CLEARED(winid, func) \ 623 DECLARE_EVENT_TABLE_ENTRY( wxEVT_WEBVIEW_WINDOW_OBJECT_CLEARED, \ 624 winid, \ 625 wxID_ANY, \ 626 (wxObjectEventFunction) \ 627 (wxWebViewWindowObjectClearedFunction) & func, \ 628 static_cast<wxObject*>(NULL)), 629 630 #endif // ifndef WXWEBVIEW_H 631