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