]> git.saurik.com Git - wxWidgets.git/blame - include/wx/html/webkit.h
remove EVT_STC_POSCHANGED as it's been deprecated in Scintilla for
[wxWidgets.git] / include / wx / html / webkit.h
CommitLineData
2c990ba6
KO
1/////////////////////////////////////////////////////////////////////////////
2// Name: webkit.h
3// Purpose: wxWebKitCtrl - embeddable web kit control
4// Author: Jethro Grassie / Kevin Ollivier
5// Modified by:
6// Created: 2004-4-16
7// RCS-ID: $Id$
8// Copyright: (c) Jethro Grassie / Kevin Ollivier
65571936 9// Licence: wxWindows licence
2c990ba6
KO
10/////////////////////////////////////////////////////////////////////////////
11
12#ifndef _WX_WEBKIT_H
13#define _WX_WEBKIT_H
14
3ca7ba74 15#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA)
2c990ba6
KO
16#pragma interface "webkit.h"
17#endif
18
19#if !defined(__WXMAC__) && !defined(__WXCOCOA__)
20#error "wxWebKitCtrl not implemented for this platform"
21#endif
22
23#ifdef __WXCOCOA
24#include <WebKit/WebKit.h>
25#endif
26#include "wx/control.h"
27
28// ----------------------------------------------------------------------------
29// Web Kit Control
30// ----------------------------------------------------------------------------
31
32class wxWebKitCtrl : public wxControl
33{
34public:
3ca7ba74 35 DECLARE_DYNAMIC_CLASS(wxWebKitCtrl)
2c990ba6 36
3ca7ba74 37 wxWebKitCtrl() {};
2c990ba6 38 wxWebKitCtrl(wxWindow *parent,
3ca7ba74 39 wxWindowID winID,
2c990ba6
KO
40 const wxString& strURL,
41 const wxPoint& pos = wxDefaultPosition,
3ca7ba74
RD
42 const wxSize& size = wxDefaultSize, long style = 0,
43 const wxValidator& validator = wxDefaultValidator,
44 const wxString& name = wxT("webkitctrl"))
2c990ba6
KO
45 {
46 Create(parent, winID, strURL, pos, size, style, validator, name);
47 };
3ca7ba74 48 bool Create(wxWindow *parent,
2c990ba6
KO
49 wxWindowID winID,
50 const wxString& strURL,
51 const wxPoint& pos = wxDefaultPosition,
52 const wxSize& size = wxDefaultSize, long style = 0,
53 const wxValidator& validator = wxDefaultValidator,
7eb8c6ee 54 const wxString& name = wxT("webkitctrl"));
3ca7ba74
RD
55 virtual ~wxWebKitCtrl();
56
2c990ba6
KO
57 void LoadURL(const wxString &url);
58
59 bool CanGoBack();
60 bool CanGoForward();
61 bool GoBack();
62 bool GoForward();
63 void Reload();
64 void Stop();
65 bool CanGetPageSource();
66 wxString GetPageSource();
7eb8c6ee 67 void SetPageSource(wxString& source, const wxString& baseUrl = wxEmptyString);
2c990ba6
KO
68
69 //we need to resize the webview when the control size changes
005198fa 70 void OnSize(wxSizeEvent &event);
2c990ba6 71protected:
3ca7ba74 72 DECLARE_EVENT_TABLE()
14f21d6d 73 void MacVisibilityChanged();
2c990ba6
KO
74
75private:
76 wxWindow *m_parent;
77 wxWindowID m_windowID;
78 wxString m_currentURL;
79 wxString m_pageTitle;
80 void* m_webView;
81 //It should be WebView, but WebView is Cocoa only, so any class which included
82 //this header would have to link to Cocoa, so for now use void* instead.
83};
84
85// ----------------------------------------------------------------------------
86// Web Kit Events
87// ----------------------------------------------------------------------------
88
89enum {
3ca7ba74
RD
90 wxWEBKIT_STATE_START = 1,
91 wxWEBKIT_STATE_NEGOTIATING = 2,
92 wxWEBKIT_STATE_REDIRECTING = 4,
93 wxWEBKIT_STATE_TRANSFERRING = 8,
94 wxWEBKIT_STATE_STOP = 16,
2c990ba6
KO
95 wxWEBKIT_STATE_FAILED = 32
96};
97
98class wxWebKitStateChangedEvent : public wxCommandEvent
99{
100 DECLARE_DYNAMIC_CLASS( wxWebKitStateChangedEvent )
101
102public:
3ca7ba74
RD
103 int GetState() { return m_state; }
104 void SetState(const int state) { m_state = state; }
105 wxString GetURL() { return m_url; }
106 void SetURL(const wxString& url) { m_url = url; }
2c990ba6
KO
107
108 wxWebKitStateChangedEvent( wxWindow* win = (wxWindow*) NULL );
3ca7ba74 109 wxEvent *Clone(void) const { return new wxWebKitStateChangedEvent(*this); }
2c990ba6
KO
110
111protected:
3ca7ba74
RD
112 int m_state;
113 wxString m_url;
2c990ba6
KO
114};
115
116typedef void (wxEvtHandler::*wxWebKitStateChangedEventFunction)(wxWebKitStateChangedEvent&);
117
118BEGIN_DECLARE_EVENT_TYPES()
119 DECLARE_LOCAL_EVENT_TYPE(wxEVT_WEBKIT_STATE_CHANGED, -1)
120END_DECLARE_EVENT_TYPES()
121
122#define EVT_WEBKIT_STATE_CHANGED(func) \
123 DECLARE_EVENT_TABLE_ENTRY( wxEVT_WEBKIT_STATE_CHANGED, \
124 -1, \
125 -1, \
126 (wxObjectEventFunction) \
127 (wxWebKitStateChangedEventFunction) & func, \
128 (wxObject *) NULL ),
129
130#endif // _WX_WEBKIT_H_