]> git.saurik.com Git - wxWidgets.git/blame - include/wx/gtk/webview_webkit.h
adjusting include styles
[wxWidgets.git] / include / wx / gtk / webview_webkit.h
CommitLineData
61b98a2d
SL
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
47943187 15#if wxUSE_WEBVIEW_WEBKIT && defined(__WXGTK__)
61b98a2d 16
19fc1a2f
SL
17#include "webkit/webkit.h"
18#include "wx/sharedptr.h"
61b98a2d
SL
19#include "wx/webview.h"
20
21//-----------------------------------------------------------------------------
b64b4e70 22// wxWebViewWebKit
61b98a2d
SL
23//-----------------------------------------------------------------------------
24
b64b4e70 25class WXDLLIMPEXP_WEB wxWebViewWebKit : public wxWebView
61b98a2d
SL
26{
27public:
b64b4e70 28 wxWebViewWebKit() { Init(); }
61b98a2d 29
b64b4e70 30 wxWebViewWebKit(wxWindow *parent,
61b98a2d
SL
31 wxWindowID id = wxID_ANY,
32 const wxString& url = wxWebViewDefaultURLStr,
33 const wxPoint& pos = wxDefaultPosition,
34 const wxSize& size = wxDefaultSize, long style = 0,
35 const wxString& name = wxWebViewNameStr)
36 {
37 Init();
38
39 Create(parent, id, url, pos, size, style, name);
40 }
41
42 virtual bool Create(wxWindow *parent,
43 wxWindowID id = wxID_ANY,
44 const wxString& url = wxWebViewDefaultURLStr,
45 const wxPoint& pos = wxDefaultPosition,
46 const wxSize& size = wxDefaultSize, long style = 0,
47 const wxString& name = wxWebViewNameStr);
48
49 virtual bool Enable( bool enable = true );
50
51 // implementation
52 // --------------
53
54 static wxVisualAttributes
55 GetClassDefaultAttributes(wxWindowVariant variant = wxWINDOW_VARIANT_NORMAL);
56
57 // helper to allow access to protected member from GTK callback
58 void MoveWindow(int x, int y, int width, int height)
59 {
60 DoMoveWindow(x, y, width, height);
61 }
62
63 void ZoomIn();
64 void ZoomOut();
65 void SetWebkitZoom(float level);
66 float GetWebkitZoom();
67
68 virtual void Stop();
69 virtual void LoadUrl(const wxString& url);
70 virtual void GoBack();
71 virtual void GoForward();
a703012a 72 virtual void Reload(wxWebViewReloadFlags flags = wxWEB_VIEW_RELOAD_DEFAULT);
61b98a2d
SL
73 virtual bool CanGoBack();
74 virtual bool CanGoForward();
152a5808
SL
75 virtual void ClearHistory();
76 virtual void EnableHistory(bool enable = true);
19fc1a2f
SL
77 virtual wxVector<wxSharedPtr<wxWebHistoryItem> > GetBackwardHistory();
78 virtual wxVector<wxSharedPtr<wxWebHistoryItem> > GetForwardHistory();
79 virtual void LoadHistoryItem(wxSharedPtr<wxWebHistoryItem> item);
61b98a2d
SL
80 virtual wxString GetCurrentURL();
81 virtual wxString GetCurrentTitle();
82 virtual wxString GetPageSource();
241b769f 83 virtual wxString GetPageText();
3dffc2ae
SL
84 //We do not want to hide the other overloads
85 using wxWebView::SetPage;
61b98a2d
SL
86 virtual void SetPage(const wxString& html, const wxString& baseUrl);
87 virtual void Print();
88 virtual bool IsBusy();
89
90 void SetZoomType(wxWebViewZoomType);
91 wxWebViewZoomType GetZoomType() const;
92 bool CanSetZoomType(wxWebViewZoomType) const;
93 virtual wxWebViewZoom GetZoom();
94 virtual void SetZoom(wxWebViewZoom);
95
ae26e17b
SL
96 //Clipboard functions
97 virtual bool CanCut();
98 virtual bool CanCopy();
99 virtual bool CanPaste();
100 virtual void Cut();
101 virtual void Copy();
102 virtual void Paste();
61b98a2d 103
97e49559
SL
104 //Undo / redo functionality
105 virtual bool CanUndo();
106 virtual bool CanRedo();
107 virtual void Undo();
108 virtual void Redo();
109
c7cbe308
SL
110 //Editing functions
111 virtual void SetEditable(bool enable = true);
112 virtual bool IsEditable();
113
63a65070
SL
114 //Selection
115 virtual void DeleteSelection();
116 virtual bool HasSelection();
117 virtual void SelectAll();
c9355a3d 118 virtual wxString GetSelectedText();
97ba4d81 119 virtual wxString GetSelectedSource();
41933aa5 120 virtual void ClearSelection();
63a65070 121
c9ccc09c 122 virtual void RunScript(const wxString& javascript);
eff8f795
SL
123
124 //Virtual Filesystem Support
3baf235f
SL
125 virtual void RegisterHandler(wxSharedPtr<wxWebHandler> handler);
126 virtual wxVector<wxSharedPtr<wxWebHandler> > GetHandlers() { return m_handlerList; }
c9ccc09c 127
61b98a2d
SL
128 /** FIXME: hack to work around signals being received too early */
129 bool m_ready;
130
131
132 /** TODO: check if this can be made private
133 * The native control has a getter to check for busy state, but except in
134 * very recent versions of webkit this getter doesn't say everything we need
135 * (namely it seems to stay indefinitely busy when loading is cancelled by
136 * user)
137 */
138 bool m_busy;
3baf235f 139
211da8a5 140 wxString m_vfsurl;
61b98a2d 141
36b52591
SL
142 //We use this flag to stop recursion when we load a page from the navigation
143 //callback, mainly when loading a VFS page
144 bool m_guard;
145
61b98a2d
SL
146protected:
147
148 virtual GdkWindow *GTKGetWindow(wxArrayGdkWindows& windows) const;
149
150private:
151
152 // focus event handler: calls GTKUpdateBitmap()
153 void GTKOnFocus(wxFocusEvent& event);
154
155 GtkWidget *web_view;
152a5808 156 gint m_historyLimit;
61b98a2d 157
3baf235f 158 wxVector<wxSharedPtr<wxWebHandler> > m_handlerList;
f2049b68 159
cddf4541 160 wxDECLARE_DYNAMIC_CLASS(wxWebViewWebKit);
61b98a2d
SL
161};
162
cddf4541 163#endif // wxUSE_WEBVIEW_WEBKIT && defined(__WXGTK__)
61b98a2d 164
384b8d9f 165#endif