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