Rename source files for consistency
[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 wxHAVE_WEB_BACKEND_GTK_WEBKIT
16
17 #include "wx/webview.h"
18
19 //-----------------------------------------------------------------------------
20 // wxWebViewGTKWebKit
21 //-----------------------------------------------------------------------------
22
23 class WXDLLIMPEXP_WEB wxWebViewGTKWebKit : public wxWebView
24 {
25 public:
26 wxWebViewGTKWebKit() { Init(); }
27
28 wxWebViewGTKWebKit(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 wxString GetCurrentURL();
74 virtual wxString GetCurrentTitle();
75 virtual wxString GetPageSource();
76 virtual void SetPage(const wxString& html, const wxString& baseUrl);
77 virtual void Print();
78 virtual bool IsBusy();
79
80 void SetZoomType(wxWebViewZoomType);
81 wxWebViewZoomType GetZoomType() const;
82 bool CanSetZoomType(wxWebViewZoomType) const;
83 virtual wxWebViewZoom GetZoom();
84 virtual void SetZoom(wxWebViewZoom);
85
86
87
88 /** FIXME: hack to work around signals being received too early */
89 bool m_ready;
90
91
92 /** TODO: check if this can be made private
93 * The native control has a getter to check for busy state, but except in
94 * very recent versions of webkit this getter doesn't say everything we need
95 * (namely it seems to stay indefinitely busy when loading is cancelled by
96 * user)
97 */
98 bool m_busy;
99
100 protected:
101
102 virtual GdkWindow *GTKGetWindow(wxArrayGdkWindows& windows) const;
103
104 private:
105
106 // focus event handler: calls GTKUpdateBitmap()
107 void GTKOnFocus(wxFocusEvent& event);
108
109 GtkWidget *web_view;
110
111 // FIXME: try to get DECLARE_DYNAMIC_CLASS macros & stuff right
112 //DECLARE_DYNAMIC_CLASS(wxWebViewGTKWebKit)
113 };
114
115 #endif // if wxHAVE_WEB_BACKEND_GTK_WEBKIT
116
117 #endif