]> git.saurik.com Git - wxWidgets.git/blob - include/wx/osx/webview_webkit.h
Bring osx class naming into line with the other ports.
[wxWidgets.git] / include / wx / osx / webview_webkit.h
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: include/wx/osx/webkit.h
3 // Purpose: wxWebViewWebKit - embeddable web kit control,
4 // OS X implementation of web view component
5 // Author: Jethro Grassie / Kevin Ollivier / Marianne Gagnon
6 // Modified by:
7 // Created: 2004-4-16
8 // RCS-ID: $Id$
9 // Copyright: (c) Jethro Grassie / Kevin Ollivier / Marianne Gagnon
10 // Licence: wxWindows licence
11 /////////////////////////////////////////////////////////////////////////////
12
13 #ifndef _WX_WEBKIT_H
14 #define _WX_WEBKIT_H
15
16 #include "wx/setup.h"
17
18 #if wxUSE_WEBKIT && (defined(__WXMAC__) || defined(__WXCOCOA__))
19
20 #include "wx/control.h"
21 #include "wx/webview.h"
22
23 // ----------------------------------------------------------------------------
24 // Web Kit Control
25 // ----------------------------------------------------------------------------
26
27 class WXDLLIMPEXP_WEB wxWebViewWebKit : public wxWebView
28 {
29 public:
30 wxDECLARE_DYNAMIC_CLASS(wxWebViewWebKit);
31
32 wxWebViewWebKit() {}
33 wxWebViewWebKit(wxWindow *parent,
34 wxWindowID winID = wxID_ANY,
35 const wxString& strURL = wxWebViewDefaultURLStr,
36 const wxPoint& pos = wxDefaultPosition,
37 const wxSize& size = wxDefaultSize, long style = 0,
38 const wxString& name = wxWebViewNameStr)
39 {
40 Create(parent, winID, strURL, pos, size, style, name);
41 }
42 bool Create(wxWindow *parent,
43 wxWindowID winID = wxID_ANY,
44 const wxString& strURL = wxWebViewDefaultURLStr,
45 const wxPoint& pos = wxDefaultPosition,
46 const wxSize& size = wxDefaultSize, long style = 0,
47 const wxString& name = wxWebViewNameStr);
48 virtual ~wxWebViewWebKit();
49
50 void InternalLoadURL(const wxString &url);
51
52 virtual bool CanGoBack();
53 virtual bool CanGoForward();
54 virtual void GoBack();
55 virtual void GoForward();
56 virtual void Reload(wxWebViewReloadFlags flags = wxWEB_VIEW_RELOAD_DEFAULT);
57 virtual void Stop();
58 virtual wxString GetPageSource();
59 virtual void SetPageTitle(const wxString& title) { m_pageTitle = title; }
60 virtual wxString GetPageTitle(){ return m_pageTitle; }
61
62 virtual void SetPage(const wxString& html, const wxString& baseUrl);
63
64 virtual void Print();
65
66 virtual void LoadUrl(const wxString& url);
67 virtual wxString GetCurrentURL();
68 virtual wxString GetCurrentTitle();
69 virtual wxWebViewZoom GetZoom();
70 virtual void SetZoom(wxWebViewZoom zoom);
71
72 virtual void SetZoomType(wxWebViewZoomType zoomType);
73 virtual wxWebViewZoomType GetZoomType() const;
74 virtual bool CanSetZoomType(wxWebViewZoomType type) const;
75
76 virtual bool IsBusy() { return m_busy; }
77
78 // ---- methods not from the parent (common) interface
79 wxString GetSelectedText();
80
81 wxString RunScript(const wxString& javascript);
82
83 bool CanGetPageSource();
84
85 void SetScrollPos(int pos);
86 int GetScrollPos();
87
88 void MakeEditable(bool enable = true);
89 bool IsEditable();
90
91 wxString GetSelection();
92
93 bool CanIncreaseTextSize();
94 void IncreaseTextSize();
95 bool CanDecreaseTextSize();
96 void DecreaseTextSize();
97
98 float GetWebkitZoom();
99 void SetWebkitZoom(float zoom);
100
101 // don't hide base class virtuals
102 virtual void SetScrollPos( int orient, int pos, bool refresh = true )
103 { return wxControl::SetScrollPos(orient, pos, refresh); }
104 virtual int GetScrollPos( int orient ) const
105 { return wxControl::GetScrollPos(orient); }
106
107 //we need to resize the webview when the control size changes
108 void OnSize(wxSizeEvent &event);
109 void OnMove(wxMoveEvent &event);
110 void OnMouseEvents(wxMouseEvent &event);
111
112 bool m_busy;
113
114 protected:
115 DECLARE_EVENT_TABLE()
116 void MacVisibilityChanged();
117
118 private:
119 wxWindow *m_parent;
120 wxWindowID m_windowID;
121 wxString m_pageTitle;
122
123 struct objc_object *m_webView;
124
125 // we may use this later to setup our own mouse events,
126 // so leave it in for now.
127 void* m_webKitCtrlEventHandler;
128 //It should be WebView*, but WebView is an Objective-C class
129 //TODO: look into using DECLARE_WXCOCOA_OBJC_CLASS rather than this.
130 };
131
132 #endif // wxUSE_WEBKIT
133
134 #endif // _WX_WEBKIT_H_