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
|
/////////////////////////////////////////////////////////////////////////////
// Name: wx/html/webkit.h
// Purpose: wxWebKitCtrl - embeddable web kit control
// Author: Jethro Grassie / Kevin Ollivier
// Modified by:
// Created: 2004-4-16
// Copyright: (c) Jethro Grassie / Kevin Ollivier
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#ifndef _WX_WEBKIT_H
#define _WX_WEBKIT_H
/**
@class wxWebKitCtrl
This control is a native wrapper around the Safari web browsing
engine. This wrapper differs from the one in wxWebView in that this
version supports functionality specific to WebKit, such as having
RunScript return a value, which is a very critical feature in many web
embedding scenarios.
This class is only available on OSX.
**/
class wxWebKitCtrl : public wxControl
{
public:
wxWebKitCtrl();
wxWebKitCtrl(wxWindow *parent,
wxWindowID winid,
const wxString& strURL,
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize, long style = 0,
const wxValidator& validator = wxDefaultValidator,
const wxString& name = wxWebKitCtrlNameStr);
bool Create(wxWindow *parent,
wxWindowID winid,
const wxString& strURL,
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize, long style = 0,
const wxValidator& validator = wxDefaultValidator,
const wxString& name = wxWebKitCtrlNameStr);
virtual ~wxWebKitCtrl();
void LoadURL(const wxString &url);
bool CanGoBack();
bool CanGoForward();
bool GoBack();
bool GoForward();
void Reload();
void Stop();
bool CanGetPageSource();
wxString GetPageSource();
void SetPageSource(const wxString& source, const wxString& baseUrl = wxEmptyString);
wxString GetPageURL();
void SetPageTitle(const wxString& title);
wxString GetPageTitle();
// since these worked in 2.6, add wrappers
void SetTitle(const wxString& title);
wxString GetTitle();
wxString GetSelection();
bool CanIncreaseTextSize();
void IncreaseTextSize();
bool CanDecreaseTextSize();
void DecreaseTextSize();
void Print(bool showPrompt = false);
void MakeEditable(bool enable = true);
bool IsEditable();
wxString RunScript(const wxString& javascript);
void SetScrollPos(int pos);
int GetScrollPos();
};
// ----------------------------------------------------------------------------
// Web Kit Events
// ----------------------------------------------------------------------------
enum {
wxWEBKIT_STATE_START = 1,
wxWEBKIT_STATE_NEGOTIATING = 2,
wxWEBKIT_STATE_REDIRECTING = 4,
wxWEBKIT_STATE_TRANSFERRING = 8,
wxWEBKIT_STATE_STOP = 16,
wxWEBKIT_STATE_FAILED = 32
};
enum {
wxWEBKIT_NAV_LINK_CLICKED = 1,
wxWEBKIT_NAV_BACK_NEXT = 2,
wxWEBKIT_NAV_FORM_SUBMITTED = 4,
wxWEBKIT_NAV_RELOAD = 8,
wxWEBKIT_NAV_FORM_RESUBMITTED = 16,
wxWEBKIT_NAV_OTHER = 32
};
class wxWebKitBeforeLoadEvent : public wxCommandEvent
{
public:
bool IsCancelled();
void Cancel(bool cancel = true);
wxString GetURL();
void SetURL(const wxString& url);
void SetNavigationType(int navType);
int GetNavigationType();
wxWebKitBeforeLoadEvent( wxWindow* win = 0 );
};
class wxWebKitStateChangedEvent : public wxCommandEvent
{
public:
int GetState();
void SetState(const int state);
wxString GetURL();
void SetURL(const wxString& url);
wxWebKitStateChangedEvent( wxWindow* win = 0 );
};
class wxWebKitNewWindowEvent : public wxCommandEvent
{
public:
wxString GetURL() const;
void SetURL(const wxString& url);
wxString GetTargetName() const;
void SetTargetName(const wxString& name);
wxWebKitNewWindowEvent( wxWindow* win = 0 );
};
wxEventType wxEVT_WEBKIT_STATE_CHANGED;
wxEventType wxEVT_WEBKIT_BEFORE_LOAD;
wxEventType wxEVT_WEBKIT_NEW_WINDOW;
#endif
// _WX_WEBKIT_H_
|