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