]> git.saurik.com Git - wxWidgets.git/blob - include/wx/gtk/webview_webkit.h
Add support for the new history functions to the ie backend. For this we manage our...
[wxWidgets.git] / include / wx / gtk / webview_webkit.h
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: include/gtk/wx/webview.h
3 // Purpose: GTK webkit backend for web view component
4 // Author: Robert Roebling, Marianne Gagnon
5 // Id: $Id$
6 // Copyright: (c) 2010 Marianne Gagnon, 1998 Robert Roebling
7 // Licence: wxWindows licence
8 /////////////////////////////////////////////////////////////////////////////
9
10 #ifndef _WX_GTK_WEBKITCTRL_H_
11 #define _WX_GTK_WEBKITCTRL_H_
12
13 #include "wx/setup.h"
14
15 #if wxUSE_WEBVIEW_WEBKIT
16
17 #include "wx/webview.h"
18
19 //-----------------------------------------------------------------------------
20 // wxWebViewWebKit
21 //-----------------------------------------------------------------------------
22
23 class WXDLLIMPEXP_WEB wxWebViewWebKit : public wxWebView
24 {
25 public:
26 wxWebViewWebKit() { Init(); }
27
28 wxWebViewWebKit(wxWindow *parent,
29 wxWindowID id = wxID_ANY,
30 const wxString& url = wxWebViewDefaultURLStr,
31 const wxPoint& pos = wxDefaultPosition,
32 const wxSize& size = wxDefaultSize, long style = 0,
33 const wxString& name = wxWebViewNameStr)
34 {
35 Init();
36
37 Create(parent, id, url, pos, size, style, name);
38 }
39
40 virtual bool Create(wxWindow *parent,
41 wxWindowID id = wxID_ANY,
42 const wxString& url = wxWebViewDefaultURLStr,
43 const wxPoint& pos = wxDefaultPosition,
44 const wxSize& size = wxDefaultSize, long style = 0,
45 const wxString& name = wxWebViewNameStr);
46
47 virtual bool Enable( bool enable = true );
48
49 // implementation
50 // --------------
51
52 static wxVisualAttributes
53 GetClassDefaultAttributes(wxWindowVariant variant = wxWINDOW_VARIANT_NORMAL);
54
55 // helper to allow access to protected member from GTK callback
56 void MoveWindow(int x, int y, int width, int height)
57 {
58 DoMoveWindow(x, y, width, height);
59 }
60
61 void ZoomIn();
62 void ZoomOut();
63 void SetWebkitZoom(float level);
64 float GetWebkitZoom();
65
66 virtual void Stop();
67 virtual void LoadUrl(const wxString& url);
68 virtual void GoBack();
69 virtual void GoForward();
70 virtual void Reload(wxWebViewReloadFlags flags = wxWEB_VIEW_RELOAD_DEFAULT);
71 virtual bool CanGoBack();
72 virtual bool CanGoForward();
73 virtual void ClearHistory();
74 virtual void EnableHistory(bool enable = true);
75 virtual wxString GetCurrentURL();
76 virtual wxString GetCurrentTitle();
77 virtual wxString GetPageSource();
78 virtual void SetPage(const wxString& html, const wxString& baseUrl);
79 virtual void Print();
80 virtual bool IsBusy();
81
82 void SetZoomType(wxWebViewZoomType);
83 wxWebViewZoomType GetZoomType() const;
84 bool CanSetZoomType(wxWebViewZoomType) const;
85 virtual wxWebViewZoom GetZoom();
86 virtual void SetZoom(wxWebViewZoom);
87
88
89
90 /** FIXME: hack to work around signals being received too early */
91 bool m_ready;
92
93
94 /** TODO: check if this can be made private
95 * The native control has a getter to check for busy state, but except in
96 * very recent versions of webkit this getter doesn't say everything we need
97 * (namely it seems to stay indefinitely busy when loading is cancelled by
98 * user)
99 */
100 bool m_busy;
101
102 protected:
103
104 virtual GdkWindow *GTKGetWindow(wxArrayGdkWindows& windows) const;
105
106 private:
107
108 // focus event handler: calls GTKUpdateBitmap()
109 void GTKOnFocus(wxFocusEvent& event);
110
111 GtkWidget *web_view;
112 gint m_historyLimit;
113
114 // FIXME: try to get DECLARE_DYNAMIC_CLASS macros & stuff right
115 //DECLARE_DYNAMIC_CLASS(wxWebViewWebKit)
116 };
117
118 #endif // if wxHAVE_WEB_BACKEND_GTK_WEBKIT
119
120 #endif