]> git.saurik.com Git - wxWidgets.git/blame - include/wx/osx/webview_webkit.h
Move wxBell() from base to core library.
[wxWidgets.git] / include / wx / osx / webview_webkit.h
CommitLineData
61b98a2d
SL
1/////////////////////////////////////////////////////////////////////////////
2// Name: include/wx/osx/webkit.h
0a6c8516 3// Purpose: wxWebViewWebKit - embeddable web kit control,
61b98a2d
SL
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
9d2f31db
SL
18#if wxUSE_WEBVIEW && wxUSE_WEBVIEW_WEBKIT && (defined(__WXOSX_COCOA__) \
19 || defined(__WXOSX_CARBON__))
61b98a2d 20
61b98a2d
SL
21#include "wx/control.h"
22#include "wx/webview.h"
23
fcb9299b 24#include "wx/osx/core/objcid.h"
d92f48bd 25
61b98a2d
SL
26// ----------------------------------------------------------------------------
27// Web Kit Control
28// ----------------------------------------------------------------------------
29
467d261e 30class WXDLLIMPEXP_WEBVIEW wxWebViewWebKit : public wxWebView
61b98a2d
SL
31{
32public:
0a6c8516 33 wxDECLARE_DYNAMIC_CLASS(wxWebViewWebKit);
61b98a2d 34
0a6c8516
SL
35 wxWebViewWebKit() {}
36 wxWebViewWebKit(wxWindow *parent,
61b98a2d
SL
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);
0a6c8516 51 virtual ~wxWebViewWebKit();
61b98a2d 52
e669ddde
SL
53 virtual bool CanGoBack() const;
54 virtual bool CanGoForward() const;
61b98a2d
SL
55 virtual void GoBack();
56 virtual void GoForward();
a703012a 57 virtual void Reload(wxWebViewReloadFlags flags = wxWEB_VIEW_RELOAD_DEFAULT);
61b98a2d 58 virtual void Stop();
e669ddde
SL
59 virtual wxString GetPageSource() const;
60 virtual wxString GetPageText() const;
61b98a2d 61
e28cc3ca
SL
62 //We do not want to hide the other overloads
63 using wxWebView::SetPage;
61b98a2d
SL
64 virtual void SetPage(const wxString& html, const wxString& baseUrl);
65
66 virtual void Print();
67
4d0dddc7 68 virtual void LoadURL(const wxString& url);
e669ddde
SL
69 virtual wxString GetCurrentURL() const;
70 virtual wxString GetCurrentTitle() const;
71 virtual wxWebViewZoom GetZoom() const;
61b98a2d
SL
72 virtual void SetZoom(wxWebViewZoom zoom);
73
74 virtual void SetZoomType(wxWebViewZoomType zoomType);
75 virtual wxWebViewZoomType GetZoomType() const;
76 virtual bool CanSetZoomType(wxWebViewZoomType type) const;
77
e669ddde 78 virtual bool IsBusy() const { return m_busy; }
34326da7 79
0e37936e 80 //History functions
7c36630b 81 virtual void ClearHistory();
8ba4faba 82 virtual void EnableHistory(bool enable = true);
c13d6ac1
SL
83 virtual wxVector<wxSharedPtr<wxWebViewHistoryItem> > GetBackwardHistory();
84 virtual wxVector<wxSharedPtr<wxWebViewHistoryItem> > GetForwardHistory();
85 virtual void LoadHistoryItem(wxSharedPtr<wxWebViewHistoryItem> item);
34326da7 86
0e37936e 87 //Undo / redo functionality
e669ddde
SL
88 virtual bool CanUndo() const;
89 virtual bool CanRedo() const;
6368d965
SL
90 virtual void Undo();
91 virtual void Redo();
61b98a2d 92
e2392c45 93 //Clipboard functions
6849a4b7
SL
94 virtual bool CanCut() const { return true; }
95 virtual bool CanCopy() const { return true; }
96 virtual bool CanPaste() const { return true; }
028894b4
SL
97 virtual void Cut();
98 virtual void Copy();
99 virtual void Paste();
34326da7 100
c7cbe308 101 //Editing functions
63a65070 102 virtual void SetEditable(bool enable = true);
e669ddde 103 virtual bool IsEditable() const;
34326da7 104
63a65070
SL
105 //Selection
106 virtual void DeleteSelection();
e669ddde 107 virtual bool HasSelection() const;
835165d5 108 virtual void SelectAll();
e669ddde
SL
109 virtual wxString GetSelectedText() const;
110 virtual wxString GetSelectedSource() const;
ef53bf2a 111 virtual void ClearSelection();
34326da7 112
c9ccc09c 113 void RunScript(const wxString& javascript);
34326da7 114
eff8f795 115 //Virtual Filesystem Support
7d8d6163 116 virtual void RegisterHandler(wxSharedPtr<wxWebViewHandler> handler);
e2392c45 117
61b98a2d 118 // ---- methods not from the parent (common) interface
e669ddde 119 bool CanGetPageSource() const;
61b98a2d
SL
120
121 void SetScrollPos(int pos);
122 int GetScrollPos();
123
e669ddde 124 bool CanIncreaseTextSize() const;
61b98a2d 125 void IncreaseTextSize();
e669ddde 126 bool CanDecreaseTextSize() const;
61b98a2d
SL
127 void DecreaseTextSize();
128
e669ddde 129 float GetWebkitZoom() const;
61b98a2d
SL
130 void SetWebkitZoom(float zoom);
131
132 // don't hide base class virtuals
133 virtual void SetScrollPos( int orient, int pos, bool refresh = true )
134 { return wxControl::SetScrollPos(orient, pos, refresh); }
135 virtual int GetScrollPos( int orient ) const
136 { return wxControl::GetScrollPos(orient); }
137
138 //we need to resize the webview when the control size changes
139 void OnSize(wxSizeEvent &event);
140 void OnMove(wxMoveEvent &event);
141 void OnMouseEvents(wxMouseEvent &event);
142
143 bool m_busy;
144
145protected:
146 DECLARE_EVENT_TABLE()
147 void MacVisibilityChanged();
148
149private:
150 wxWindow *m_parent;
151 wxWindowID m_windowID;
152 wxString m_pageTitle;
153
d92f48bd 154 wxObjCID m_webView;
61b98a2d
SL
155
156 // we may use this later to setup our own mouse events,
157 // so leave it in for now.
158 void* m_webKitCtrlEventHandler;
159 //It should be WebView*, but WebView is an Objective-C class
160 //TODO: look into using DECLARE_WXCOCOA_OBJC_CLASS rather than this.
161};
162
34326da7 163#endif // wxUSE_WEBVIEW && wxUSE_WEBVIEW_WEBKIT
61b98a2d
SL
164
165#endif // _WX_WEBKIT_H_