]> git.saurik.com Git - wxWidgets.git/blame - include/wx/osx/webview_webkit.h
Extend history api using the ie backend to include loading history items, and getting...
[wxWidgets.git] / include / wx / osx / webview_webkit.h
CommitLineData
61b98a2d
SL
1/////////////////////////////////////////////////////////////////////////////
2// Name: include/wx/osx/webkit.h
3// Purpose: wxOSXWebKitCtrl - 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// TODO: define this in setup.h ?
21#define wxHAVE_WEB_BACKEND_OSX_WEBKIT 1
22
23#include "wx/control.h"
24#include "wx/webview.h"
25
26// ----------------------------------------------------------------------------
27// Web Kit Control
28// ----------------------------------------------------------------------------
29
3046dbdc 30class WXDLLIMPEXP_WEB wxOSXWebKitCtrl : public wxWebView
61b98a2d
SL
31{
32public:
33 wxDECLARE_DYNAMIC_CLASS(wxOSXWebKitCtrl);
34
35 wxOSXWebKitCtrl() {}
36 wxOSXWebKitCtrl(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 ~wxOSXWebKitCtrl();
52
53 void InternalLoadURL(const wxString &url);
54
55 virtual bool CanGoBack();
56 virtual bool CanGoForward();
57 virtual void GoBack();
58 virtual void GoForward();
a703012a 59 virtual void Reload(wxWebViewReloadFlags flags = wxWEB_VIEW_RELOAD_DEFAULT);
61b98a2d
SL
60 virtual void Stop();
61 virtual wxString GetPageSource();
62 virtual void SetPageTitle(const wxString& title) { m_pageTitle = title; }
63 virtual wxString GetPageTitle(){ return m_pageTitle; }
64
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 // ---- methods not from the parent (common) interface
82 wxString GetSelectedText();
83
84 wxString RunScript(const wxString& javascript);
85
86 bool CanGetPageSource();
87
88 void SetScrollPos(int pos);
89 int GetScrollPos();
90
91 void MakeEditable(bool enable = true);
92 bool IsEditable();
93
94 wxString GetSelection();
95
96 bool CanIncreaseTextSize();
97 void IncreaseTextSize();
98 bool CanDecreaseTextSize();
99 void DecreaseTextSize();
100
101 float GetWebkitZoom();
102 void SetWebkitZoom(float zoom);
103
104 // don't hide base class virtuals
105 virtual void SetScrollPos( int orient, int pos, bool refresh = true )
106 { return wxControl::SetScrollPos(orient, pos, refresh); }
107 virtual int GetScrollPos( int orient ) const
108 { return wxControl::GetScrollPos(orient); }
109
110 //we need to resize the webview when the control size changes
111 void OnSize(wxSizeEvent &event);
112 void OnMove(wxMoveEvent &event);
113 void OnMouseEvents(wxMouseEvent &event);
114
115 bool m_busy;
116
117protected:
118 DECLARE_EVENT_TABLE()
119 void MacVisibilityChanged();
120
121private:
122 wxWindow *m_parent;
123 wxWindowID m_windowID;
124 wxString m_pageTitle;
125
126 struct objc_object *m_webView;
127
128 // we may use this later to setup our own mouse events,
129 // so leave it in for now.
130 void* m_webKitCtrlEventHandler;
131 //It should be WebView*, but WebView is an Objective-C class
132 //TODO: look into using DECLARE_WXCOCOA_OBJC_CLASS rather than this.
133};
134
135
136#else
137// TODO: define this in setup.h ?
138#define wxHAVE_WEB_BACKEND_OSX_WEBKIT 0
139
140#endif // wxUSE_WEBKIT
141
142#endif // _WX_WEBKIT_H_