2011-05-04 14:24:30 -04:00
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
|
|
|
// Name: include/wx/osx/webkit.h
|
2011-07-05 09:57:44 -04:00
|
|
|
// Purpose: wxWebViewWebKit - embeddable web kit control,
|
2011-05-04 14:24:30 -04:00
|
|
|
// OS X implementation of web view component
|
|
|
|
// Author: Jethro Grassie / Kevin Ollivier / Marianne Gagnon
|
|
|
|
// Modified by:
|
|
|
|
// Created: 2004-4-16
|
|
|
|
// RCS-ID: $Id$
|
|
|
|
// Copyright: (c) Jethro Grassie / Kevin Ollivier / Marianne Gagnon
|
|
|
|
// Licence: wxWindows licence
|
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
|
|
|
#ifndef _WX_WEBKIT_H
|
|
|
|
#define _WX_WEBKIT_H
|
|
|
|
|
|
|
|
#include "wx/setup.h"
|
|
|
|
|
2011-09-12 14:35:39 -04:00
|
|
|
#if wxUSE_WEBVIEW && wxUSE_WEBVIEW_WEBKIT && (defined(__WXOSX_COCOA__) \
|
|
|
|
|| defined(__WXOSX_CARBON__))
|
2011-05-04 14:24:30 -04:00
|
|
|
|
|
|
|
#include "wx/control.h"
|
|
|
|
#include "wx/webview.h"
|
|
|
|
|
|
|
|
// ----------------------------------------------------------------------------
|
|
|
|
// Web Kit Control
|
|
|
|
// ----------------------------------------------------------------------------
|
|
|
|
|
2011-08-19 06:45:16 -04:00
|
|
|
class WXDLLIMPEXP_WEBVIEW wxWebViewWebKit : public wxWebView
|
2011-05-04 14:24:30 -04:00
|
|
|
{
|
|
|
|
public:
|
2011-07-05 09:57:44 -04:00
|
|
|
wxDECLARE_DYNAMIC_CLASS(wxWebViewWebKit);
|
2011-05-04 14:24:30 -04:00
|
|
|
|
2011-07-05 09:57:44 -04:00
|
|
|
wxWebViewWebKit() {}
|
|
|
|
wxWebViewWebKit(wxWindow *parent,
|
2011-05-04 14:24:30 -04:00
|
|
|
wxWindowID winID = wxID_ANY,
|
|
|
|
const wxString& strURL = wxWebViewDefaultURLStr,
|
|
|
|
const wxPoint& pos = wxDefaultPosition,
|
|
|
|
const wxSize& size = wxDefaultSize, long style = 0,
|
|
|
|
const wxString& name = wxWebViewNameStr)
|
|
|
|
{
|
|
|
|
Create(parent, winID, strURL, pos, size, style, name);
|
|
|
|
}
|
|
|
|
bool Create(wxWindow *parent,
|
|
|
|
wxWindowID winID = wxID_ANY,
|
|
|
|
const wxString& strURL = wxWebViewDefaultURLStr,
|
|
|
|
const wxPoint& pos = wxDefaultPosition,
|
|
|
|
const wxSize& size = wxDefaultSize, long style = 0,
|
|
|
|
const wxString& name = wxWebViewNameStr);
|
2011-07-05 09:57:44 -04:00
|
|
|
virtual ~wxWebViewWebKit();
|
2011-05-04 14:24:30 -04:00
|
|
|
|
2011-08-17 06:26:09 -04:00
|
|
|
virtual bool CanGoBack() const;
|
|
|
|
virtual bool CanGoForward() const;
|
2011-05-04 14:24:30 -04:00
|
|
|
virtual void GoBack();
|
|
|
|
virtual void GoForward();
|
2011-05-06 09:37:01 -04:00
|
|
|
virtual void Reload(wxWebViewReloadFlags flags = wxWEB_VIEW_RELOAD_DEFAULT);
|
2011-05-04 14:24:30 -04:00
|
|
|
virtual void Stop();
|
2011-08-17 06:26:09 -04:00
|
|
|
virtual wxString GetPageSource() const;
|
|
|
|
virtual wxString GetPageText() const;
|
2011-05-04 14:24:30 -04:00
|
|
|
|
2011-08-01 13:57:48 -04:00
|
|
|
//We do not want to hide the other overloads
|
|
|
|
using wxWebView::SetPage;
|
2011-05-04 14:24:30 -04:00
|
|
|
virtual void SetPage(const wxString& html, const wxString& baseUrl);
|
|
|
|
|
|
|
|
virtual void Print();
|
|
|
|
|
2011-08-17 06:55:59 -04:00
|
|
|
virtual void LoadURL(const wxString& url);
|
2011-08-17 06:26:09 -04:00
|
|
|
virtual wxString GetCurrentURL() const;
|
|
|
|
virtual wxString GetCurrentTitle() const;
|
|
|
|
virtual wxWebViewZoom GetZoom() const;
|
2011-05-04 14:24:30 -04:00
|
|
|
virtual void SetZoom(wxWebViewZoom zoom);
|
|
|
|
|
|
|
|
virtual void SetZoomType(wxWebViewZoomType zoomType);
|
|
|
|
virtual wxWebViewZoomType GetZoomType() const;
|
|
|
|
virtual bool CanSetZoomType(wxWebViewZoomType type) const;
|
|
|
|
|
2011-08-17 06:26:09 -04:00
|
|
|
virtual bool IsBusy() const { return m_busy; }
|
2011-07-05 13:06:12 -04:00
|
|
|
|
|
|
|
//History functions
|
2011-08-05 09:56:50 -04:00
|
|
|
virtual void ClearHistory();
|
2011-08-02 05:21:47 -04:00
|
|
|
virtual void EnableHistory(bool enable = true);
|
2011-08-15 08:31:31 -04:00
|
|
|
virtual wxVector<wxSharedPtr<wxWebViewHistoryItem> > GetBackwardHistory();
|
|
|
|
virtual wxVector<wxSharedPtr<wxWebViewHistoryItem> > GetForwardHistory();
|
|
|
|
virtual void LoadHistoryItem(wxSharedPtr<wxWebViewHistoryItem> item);
|
2011-07-05 13:06:12 -04:00
|
|
|
|
|
|
|
//Undo / redo functionality
|
2011-08-17 06:26:09 -04:00
|
|
|
virtual bool CanUndo() const;
|
|
|
|
virtual bool CanRedo() const;
|
2011-08-05 09:17:19 -04:00
|
|
|
virtual void Undo();
|
|
|
|
virtual void Redo();
|
2011-05-04 14:24:30 -04:00
|
|
|
|
2011-07-06 05:45:29 -04:00
|
|
|
//Clipboard functions
|
2011-08-17 09:50:01 -04:00
|
|
|
virtual bool CanCut() const { return true; }
|
|
|
|
virtual bool CanCopy() const { return true; }
|
|
|
|
virtual bool CanPaste() const { return true; }
|
2011-07-06 06:20:03 -04:00
|
|
|
virtual void Cut();
|
|
|
|
virtual void Copy();
|
|
|
|
virtual void Paste();
|
2011-07-08 15:34:56 -04:00
|
|
|
|
|
|
|
//Editing functions
|
2011-07-09 10:31:29 -04:00
|
|
|
virtual void SetEditable(bool enable = true);
|
2011-08-17 06:26:09 -04:00
|
|
|
virtual bool IsEditable() const;
|
2011-07-09 10:31:29 -04:00
|
|
|
|
|
|
|
//Selection
|
|
|
|
virtual void DeleteSelection();
|
2011-08-17 06:26:09 -04:00
|
|
|
virtual bool HasSelection() const;
|
2011-08-06 08:58:26 -04:00
|
|
|
virtual void SelectAll();
|
2011-08-17 06:26:09 -04:00
|
|
|
virtual wxString GetSelectedText() const;
|
|
|
|
virtual wxString GetSelectedSource() const;
|
2011-08-06 08:20:37 -04:00
|
|
|
virtual void ClearSelection();
|
2011-07-15 08:38:47 -04:00
|
|
|
|
|
|
|
void RunScript(const wxString& javascript);
|
2011-07-28 12:49:48 -04:00
|
|
|
|
|
|
|
//Virtual Filesystem Support
|
2011-08-14 08:15:34 -04:00
|
|
|
virtual void RegisterHandler(wxSharedPtr<wxWebViewHandler> handler);
|
2011-07-06 05:45:29 -04:00
|
|
|
|
2011-05-04 14:24:30 -04:00
|
|
|
// ---- methods not from the parent (common) interface
|
2011-08-17 06:26:09 -04:00
|
|
|
bool CanGetPageSource() const;
|
2011-05-04 14:24:30 -04:00
|
|
|
|
|
|
|
void SetScrollPos(int pos);
|
|
|
|
int GetScrollPos();
|
|
|
|
|
2011-08-17 06:26:09 -04:00
|
|
|
bool CanIncreaseTextSize() const;
|
2011-05-04 14:24:30 -04:00
|
|
|
void IncreaseTextSize();
|
2011-08-17 06:26:09 -04:00
|
|
|
bool CanDecreaseTextSize() const;
|
2011-05-04 14:24:30 -04:00
|
|
|
void DecreaseTextSize();
|
|
|
|
|
2011-08-17 06:26:09 -04:00
|
|
|
float GetWebkitZoom() const;
|
2011-05-04 14:24:30 -04:00
|
|
|
void SetWebkitZoom(float zoom);
|
|
|
|
|
|
|
|
// don't hide base class virtuals
|
|
|
|
virtual void SetScrollPos( int orient, int pos, bool refresh = true )
|
|
|
|
{ return wxControl::SetScrollPos(orient, pos, refresh); }
|
|
|
|
virtual int GetScrollPos( int orient ) const
|
|
|
|
{ return wxControl::GetScrollPos(orient); }
|
|
|
|
|
|
|
|
//we need to resize the webview when the control size changes
|
|
|
|
void OnSize(wxSizeEvent &event);
|
|
|
|
void OnMove(wxMoveEvent &event);
|
|
|
|
void OnMouseEvents(wxMouseEvent &event);
|
|
|
|
|
|
|
|
bool m_busy;
|
|
|
|
|
|
|
|
protected:
|
|
|
|
DECLARE_EVENT_TABLE()
|
|
|
|
void MacVisibilityChanged();
|
|
|
|
|
|
|
|
private:
|
|
|
|
wxWindow *m_parent;
|
|
|
|
wxWindowID m_windowID;
|
|
|
|
wxString m_pageTitle;
|
|
|
|
|
|
|
|
struct objc_object *m_webView;
|
|
|
|
|
|
|
|
// we may use this later to setup our own mouse events,
|
|
|
|
// so leave it in for now.
|
|
|
|
void* m_webKitCtrlEventHandler;
|
|
|
|
//It should be WebView*, but WebView is an Objective-C class
|
|
|
|
//TODO: look into using DECLARE_WXCOCOA_OBJC_CLASS rather than this.
|
|
|
|
};
|
|
|
|
|
2011-09-12 14:35:39 -04:00
|
|
|
#endif // wxUSE_WEBVIEW && wxUSE_WEBVIEW_WEBKIT
|
2011-05-04 14:24:30 -04:00
|
|
|
|
|
|
|
#endif // _WX_WEBKIT_H_
|