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