1 /////////////////////////////////////////////////////////////////////////////
2 // Name: include/gtk/wx/webview.h
3 // Purpose: GTK webkit backend for web view component
4 // Author: Robert Roebling, Marianne Gagnon
6 // Copyright: (c) 2010 Marianne Gagnon, 1998 Robert Roebling
7 // Licence: wxWindows licence
8 /////////////////////////////////////////////////////////////////////////////
10 #ifndef _WX_GTK_WEBKITCTRL_H_
11 #define _WX_GTK_WEBKITCTRL_H_
15 #if wxHAVE_WEB_BACKEND_GTK_WEBKIT
17 #include "wx/webview.h"
19 //-----------------------------------------------------------------------------
21 //-----------------------------------------------------------------------------
23 class WXDLLIMPEXP_WEB wxWebViewGTKWebKit
: public wxWebView
26 wxWebViewGTKWebKit() { Init(); }
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
)
37 Create(parent
, id
, url
, pos
, size
, style
, name
);
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
);
47 virtual bool Enable( bool enable
= true );
52 static wxVisualAttributes
53 GetClassDefaultAttributes(wxWindowVariant variant
= wxWINDOW_VARIANT_NORMAL
);
55 // helper to allow access to protected member from GTK callback
56 void MoveWindow(int x
, int y
, int width
, int height
)
58 DoMoveWindow(x
, y
, width
, height
);
63 void SetWebkitZoom(float level
);
64 float GetWebkitZoom();
67 virtual void LoadUrl(const wxString
& url
);
68 virtual void GoBack();
69 virtual void GoForward();
70 virtual void Reload(wxWebViewReloadFlags flags
= 0);
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
);
78 virtual bool IsBusy();
80 void SetZoomType(wxWebViewZoomType
);
81 wxWebViewZoomType
GetZoomType() const;
82 bool CanSetZoomType(wxWebViewZoomType
) const;
83 virtual wxWebViewZoom
GetZoom();
84 virtual void SetZoom(wxWebViewZoom
);
88 /** FIXME: hack to work around signals being received too early */
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
102 virtual GdkWindow
*GTKGetWindow(wxArrayGdkWindows
& windows
) const;
106 // focus event handler: calls GTKUpdateBitmap()
107 void GTKOnFocus(wxFocusEvent
& event
);
111 // FIXME: try to get DECLARE_DYNAMIC_CLASS macros & stuff right
112 //DECLARE_DYNAMIC_CLASS(wxWebViewGTKWebKit)
115 #endif // if wxHAVE_WEB_BACKEND_GTK_WEBKIT