]> git.saurik.com Git - wxWidgets.git/blob - include/wx/osx/webview_webkit.h
Remove redundant InternalLoadURL method.
[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_WEBVIEW_WEBKIT && (defined(__WXOSX_COCOA__) \
19 || defined(__WXOSX_CARBON__))
20
21 #include "wx/control.h"
22 #include "wx/webview.h"
23
24 // ----------------------------------------------------------------------------
25 // Web Kit Control
26 // ----------------------------------------------------------------------------
27
28 class wxMacControl;
29 class wxWidgetCocoaImpl;
30
31 class WXDLLIMPEXP_WEB wxWebViewWebKit : public wxWebView
32 {
33 public:
34 wxDECLARE_DYNAMIC_CLASS(wxWebViewWebKit);
35
36 wxWebViewWebKit() {}
37 wxWebViewWebKit(wxWindow *parent,
38 wxWindowID winID = wxID_ANY,
39 const wxString& strURL = wxWebViewDefaultURLStr,
40 const wxPoint& pos = wxDefaultPosition,
41 const wxSize& size = wxDefaultSize, long style = 0,
42 const wxString& name = wxWebViewNameStr)
43 {
44 Create(parent, winID, strURL, pos, size, style, name);
45 }
46 bool Create(wxWindow *parent,
47 wxWindowID winID = wxID_ANY,
48 const wxString& strURL = wxWebViewDefaultURLStr,
49 const wxPoint& pos = wxDefaultPosition,
50 const wxSize& size = wxDefaultSize, long style = 0,
51 const wxString& name = wxWebViewNameStr);
52 virtual ~wxWebViewWebKit();
53
54 virtual bool CanGoBack();
55 virtual bool CanGoForward();
56 virtual void GoBack();
57 virtual void GoForward();
58 virtual void Reload(wxWebViewReloadFlags flags = wxWEB_VIEW_RELOAD_DEFAULT);
59 virtual void Stop();
60 virtual wxString GetPageSource();
61 virtual wxString GetPageText() { return ""; }
62
63 //We do not want to hide the other overloads
64 using wxWebView::SetPage;
65 virtual void SetPage(const wxString& html, const wxString& baseUrl);
66
67 virtual void Print();
68
69 virtual void LoadUrl(const wxString& url);
70 virtual wxString GetCurrentURL();
71 virtual wxString GetCurrentTitle();
72 virtual wxWebViewZoom GetZoom();
73 virtual void SetZoom(wxWebViewZoom zoom);
74
75 virtual void SetZoomType(wxWebViewZoomType zoomType);
76 virtual wxWebViewZoomType GetZoomType() const;
77 virtual bool CanSetZoomType(wxWebViewZoomType type) const;
78
79 virtual bool IsBusy() { return m_busy; }
80
81 //History functions
82 virtual void ClearHistory();
83 virtual void EnableHistory(bool enable = true);
84 virtual wxVector<wxSharedPtr<wxWebHistoryItem> > GetBackwardHistory();
85 virtual wxVector<wxSharedPtr<wxWebHistoryItem> > GetForwardHistory();
86 virtual void LoadHistoryItem(wxSharedPtr<wxWebHistoryItem> item);
87
88 //Undo / redo functionality
89 virtual bool CanUndo();
90 virtual bool CanRedo();
91 virtual void Undo();
92 virtual void Redo();
93
94 //Clipboard functions
95 virtual bool CanCut() { return false; }
96 virtual bool CanCopy() { return false; }
97 virtual bool CanPaste() { return false; }
98 virtual void Cut();
99 virtual void Copy();
100 virtual void Paste();
101
102 //Editing functions
103 virtual void SetEditable(bool enable = true);
104 virtual bool IsEditable();
105
106 //Selection
107 virtual void DeleteSelection();
108 virtual bool HasSelection();
109 virtual void SelectAll() {};
110 virtual wxString GetSelectedText();
111 virtual wxString GetSelectedSource() { return ""; }
112 virtual void ClearSelection() {}
113
114 void RunScript(const wxString& javascript);
115
116 //Virtual Filesystem Support
117 virtual void RegisterHandler(wxWebHandler* WXUNUSED(handler)) {};
118
119 // ---- methods not from the parent (common) interface
120 bool CanGetPageSource();
121
122 void SetScrollPos(int pos);
123 int GetScrollPos();
124
125 bool CanIncreaseTextSize();
126 void IncreaseTextSize();
127 bool CanDecreaseTextSize();
128 void DecreaseTextSize();
129
130 float GetWebkitZoom();
131 void SetWebkitZoom(float zoom);
132
133 // don't hide base class virtuals
134 virtual void SetScrollPos( int orient, int pos, bool refresh = true )
135 { return wxControl::SetScrollPos(orient, pos, refresh); }
136 virtual int GetScrollPos( int orient ) const
137 { return wxControl::GetScrollPos(orient); }
138
139 //we need to resize the webview when the control size changes
140 void OnSize(wxSizeEvent &event);
141 void OnMove(wxMoveEvent &event);
142 void OnMouseEvents(wxMouseEvent &event);
143
144 bool m_busy;
145
146 protected:
147 DECLARE_EVENT_TABLE()
148 void MacVisibilityChanged();
149
150 private:
151 wxWindow *m_parent;
152 wxWindowID m_windowID;
153 wxString m_pageTitle;
154
155 struct objc_object *m_webView;
156
157 // we may use this later to setup our own mouse events,
158 // so leave it in for now.
159 void* m_webKitCtrlEventHandler;
160 //It should be WebView*, but WebView is an Objective-C class
161 //TODO: look into using DECLARE_WXCOCOA_OBJC_CLASS rather than this.
162
163 #if wxOSX_USE_CARBON
164 wxMacControl *m_peer;
165 #else
166 wxWidgetCocoaImpl *m_peer;
167 #endif
168 };
169
170 #endif // wxUSE_WEBKIT
171
172 #endif // _WX_WEBKIT_H_