wxMoWebCtrl (wxWebKitCtrl iPhone) implementation

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/branches/SOC2011_WXIOS@68151 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Linas Valiukas
2011-07-04 15:04:36 +00:00
parent 169fe09b6e
commit 0bfa368461
7 changed files with 670 additions and 79 deletions
+1
View File
@@ -2610,6 +2610,7 @@ IMPORTANT: please read docs/tech/tn0016.txt before modifying this file!
src/osx/iphone/textctrl.mm
src/osx/iphone/toolbar.mm
src/osx/iphone/utils.mm
src/osx/iphone/webkit.mm
src/osx/iphone/window.mm
</set>
+35 -6
View File
@@ -14,12 +14,17 @@
#if wxUSE_WEBKIT
#if !defined(__WXMAC__) && !defined(__WXCOCOA__)
#if !defined(__WXMAC__) && !defined(__WXCOCOA__) && !defined(__WXOSX_IPHONE__)
#error "wxWebKitCtrl not implemented for this platform"
#endif
#include "wx/control.h"
DECLARE_WXCOCOA_OBJC_CLASS(WebView);
#if wxOSX_USE_IPHONE
DECLARE_WXCOCOA_OBJC_CLASS(wxUIWebView);
#else
DECLARE_WXCOCOA_OBJC_CLASS(WebView);
#endif
// ----------------------------------------------------------------------------
// Web Kit Control
@@ -37,7 +42,8 @@ public:
wxWindowID winID,
const wxString& strURL,
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize, long style = 0,
const wxSize& size = wxDefaultSize,
long style = 0,
const wxValidator& validator = wxDefaultValidator,
const wxString& name = wxWebKitCtrlNameStr)
{
@@ -47,7 +53,8 @@ public:
wxWindowID winID,
const wxString& strURL,
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize, long style = 0,
const wxSize& size = wxDefaultSize,
long style = 0,
const wxValidator& validator = wxDefaultValidator,
const wxString& name = wxWebKitCtrlNameStr);
virtual ~wxWebKitCtrl();
@@ -62,7 +69,8 @@ public:
void Stop();
bool CanGetPageSource();
wxString GetPageSource();
void SetPageSource(const wxString& source, const wxString& baseUrl = wxEmptyString);
void SetPageSource(const wxString& source,
const wxString& baseUrl = wxEmptyString);
wxString GetPageURL(){ return m_currentURL; }
void SetPageTitle(const wxString& title) { m_pageTitle = title; }
wxString GetPageTitle(){ return m_pageTitle; }
@@ -87,6 +95,15 @@ public:
void SetScrollPos(int pos);
int GetScrollPos();
#if wxOSX_USE_IPHONE
/// If scaling is true, the user will be able to adjust the zoom.
/// The default is false.
void SetUserScaling(bool scaling);
/// Returns true if the user can adjust the zoom.
bool GetUserScaling() const;
#endif // wxOSX_USE_IPHONE
// don't hide base class virtuals
virtual void SetScrollPos( int orient, int pos, bool refresh = true )
@@ -107,8 +124,20 @@ private:
wxWindowID m_windowID;
wxString m_currentURL;
wxString m_pageTitle;
#if wxOSX_USE_IPHONE
// Takes note of the curr. text size; used by IncreaseTextSize() / DecreaseTextSize()
unsigned int m_currTextSize;
// Adjusts text size according to m_currTextSize
void AdjustTextSize();
#endif
#if wxOSX_USE_IPHONE
WX_wxUIWebView m_webView;
#else
WX_WebView m_webView;
#endif
// we may use this later to setup our own mouse events,
// so leave it in for now.
@@ -125,7 +154,7 @@ enum {
wxWEBKIT_STATE_REDIRECTING = 4,
wxWEBKIT_STATE_TRANSFERRING = 8,
wxWEBKIT_STATE_STOP = 16,
wxWEBKIT_STATE_FAILED = 32
wxWEBKIT_STATE_FAILED = 32
};
enum {
+4 -29
View File
@@ -14,6 +14,7 @@
#include "wx/bitmap.h"
#include "wx/control.h"
#include "wx/html/webkit.h"
extern WXDLLEXPORT_DATA(const wxChar) wxWebCtrlNameStr[];
@@ -25,11 +26,11 @@ extern WXDLLEXPORT_DATA(const wxChar) wxWebCtrlNameStr[];
@category{wxMobile}
*/
class WXDLLEXPORT wxMoWebCtrl : public wxControl
class WXDLLEXPORT wxMoWebCtrl : public wxWebKitCtrl
{
public:
/// Default constructor.
wxMoWebCtrl() { Init(); }
wxMoWebCtrl();
/// Constructor.
wxMoWebCtrl(wxWindow *parent,
@@ -38,11 +39,7 @@ public:
const wxSize& size = wxDefaultSize,
long style = 0,
const wxValidator& validator = wxDefaultValidator,
const wxString& name = wxWebCtrlNameStr)
{
Init();
Create(parent, id, pos, size, style, validator, name);
}
const wxString& name = wxWebCtrlNameStr);
bool Create(wxWindow *parent,
wxWindowID id,
@@ -56,28 +53,6 @@ public:
void Init();
/// Begins loading the specified URL.
bool LoadURL(const wxString& url);
/// Returns true if it is possible to go back in the browser history.
bool CanGoBack();
/// Returns true if it is possible to go forward in the browser history.
bool CanGoForward();
/// Goes back in the browser history.
bool GoBack();
/// Goes forward in the browser history.
bool GoForward();
/// If scaling is true, the user will be able to adjust the zoom.
/// The default is false.
void SetUserScaling(bool scaling) { m_userScaling = scaling; }
/// Returns true if the user can adjust the zoom.
bool GetUserScaling() const { return m_userScaling; }
virtual bool SetBackgroundColour(const wxColour &colour);
virtual bool SetForegroundColour(const wxColour &colour);
virtual bool SetFont(const wxFont& font);
-5
View File
@@ -313,11 +313,6 @@
#define wxUSE_PROPGRID 0
#endif
#if wxUSE_WEBKIT
#undef wxUSE_WEBKIT
#define wxUSE_WEBKIT 0
#endif
#if wxUSE_DATAOBJ
#undef wxUSE_DATAOBJ
#define wxUSE_DATAOBJ 0
@@ -16,6 +16,7 @@
407EE18A12F04CF900D0F171 /* AudioToolbox.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 407EE18912F04CF900D0F171 /* AudioToolbox.framework */; };
B90DBFCE13C1A3EA00FA1ADF /* segctrl.mm in Sources */ = {isa = PBXBuildFile; fileRef = B90DBFCD13C1A3EA00FA1ADF /* segctrl.mm */; };
B90DC11913C1B30E00FA1ADF /* listbox.mm in Sources */ = {isa = PBXBuildFile; fileRef = B90DC11813C1B30E00FA1ADF /* listbox.mm */; };
B90DC24413C1D6C800FA1ADF /* webkit.mm in Sources */ = {isa = PBXBuildFile; fileRef = B90DC24313C1D6C800FA1ADF /* webkit.mm */; };
B9133F9513BBC9FB0024E59E /* srchctrl.mm in Sources */ = {isa = PBXBuildFile; fileRef = B9133F9413BBC9FB0024E59E /* srchctrl.mm */; };
B913435013BC0A780024E59E /* navctrl.mm in Sources */ = {isa = PBXBuildFile; fileRef = B913434F13BC0A780024E59E /* navctrl.mm */; };
B9CA6D3B13BEF72300061979 /* tablecell.mm in Sources */ = {isa = PBXBuildFile; fileRef = B9CA6D3A13BEF72300061979 /* tablecell.mm */; };
@@ -102,6 +103,7 @@
409CBDCA13B13C7100AB1F39 /* wxrelease.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; name = wxrelease.xcconfig; path = ../../build/osx/wxrelease.xcconfig; sourceTree = SOURCE_ROOT; };
B90DBFCD13C1A3EA00FA1ADF /* segctrl.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; name = segctrl.mm; path = ../../src/osx/iphone/segctrl.mm; sourceTree = SOURCE_ROOT; };
B90DC11813C1B30E00FA1ADF /* listbox.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; name = listbox.mm; path = ../../src/osx/iphone/listbox.mm; sourceTree = SOURCE_ROOT; };
B90DC24313C1D6C800FA1ADF /* webkit.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; name = webkit.mm; path = ../../src/osx/iphone/webkit.mm; sourceTree = SOURCE_ROOT; };
B9133F9413BBC9FB0024E59E /* srchctrl.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; name = srchctrl.mm; path = ../../src/osx/iphone/srchctrl.mm; sourceTree = SOURCE_ROOT; };
B913434F13BC0A780024E59E /* navctrl.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; name = navctrl.mm; path = ../../src/osx/iphone/navctrl.mm; sourceTree = SOURCE_ROOT; };
B9CA6D3A13BEF72300061979 /* tablecell.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; name = tablecell.mm; path = ../../src/osx/iphone/tablecell.mm; sourceTree = SOURCE_ROOT; };
@@ -307,6 +309,7 @@
B9DF073A13B9FCF700D6F0D8 /* textctrl.mm */,
B9DF073B13B9FCF700D6F0D8 /* toolbar.mm */,
B9DF073C13B9FCF700D6F0D8 /* utils.mm */,
B90DC24313C1D6C800FA1ADF /* webkit.mm */,
B9DF073D13B9FCF700D6F0D8 /* window.mm */,
);
name = "src-osx-iphone";
@@ -537,6 +540,7 @@
B9CA731513BFA41000061979 /* pagectrl.mm in Sources */,
B90DBFCE13C1A3EA00FA1ADF /* segctrl.mm in Sources */,
B90DC11913C1B30E00FA1ADF /* listbox.mm in Sources */,
B90DC24413C1D6C800FA1ADF /* webkit.mm in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
+23 -39
View File
@@ -23,18 +23,33 @@
#include "wx/arrimpl.cpp"
#ifdef __WXMSW__
#include "wx/mobile/web/iehtmlwin.h"
#endif
extern WXDLLEXPORT_DATA(const wxChar) wxWebCtrlNameStr[] = wxT("WebCtrl");
IMPLEMENT_DYNAMIC_CLASS(wxMoWebCtrl, wxControl)
IMPLEMENT_DYNAMIC_CLASS(wxMoWebCtrl, wxWebKitCtrl)
BEGIN_EVENT_TABLE(wxMoWebCtrl, wxControl)
BEGIN_EVENT_TABLE(wxMoWebCtrl, wxWebKitCtrl)
EVT_SIZE(wxMoWebCtrl::OnSize)
END_EVENT_TABLE()
/// Default constructor.
wxMoWebCtrl::wxMoWebCtrl()
{
Init();
}
/// Constructor.
wxMoWebCtrl::wxMoWebCtrl(wxWindow *parent,
wxWindowID id,
const wxPoint& pos,
const wxSize& size,
long style,
const wxValidator& validator,
const wxString& name)
{
Init();
Create(parent, id, pos, size, style, validator, name);
}
bool wxMoWebCtrl::Create(wxWindow *parent,
wxWindowID id,
const wxPoint& pos,
@@ -43,13 +58,12 @@ bool wxMoWebCtrl::Create(wxWindow *parent,
const wxValidator& validator,
const wxString& name)
{
// FIXME stub
return true;
return wxWebKitCtrl::Create(parent, id, wxEmptyString, pos, size, style, validator, name);
}
wxMoWebCtrl::~wxMoWebCtrl()
{
}
void wxMoWebCtrl::Init()
@@ -97,33 +111,3 @@ void wxMoWebCtrl::OnSize(wxSizeEvent& WXUNUSED(event))
{
// FIXME stub
}
bool wxMoWebCtrl::LoadURL(const wxString& url)
{
// FIXME stub
return true;
}
bool wxMoWebCtrl::CanGoBack()
{
// FIXME stub
return true;
}
bool wxMoWebCtrl::CanGoForward()
{
// FIXME stub
return true;
}
bool wxMoWebCtrl::GoBack()
{
// FIXME stub
return true;
}
bool wxMoWebCtrl::GoForward()
{
// FIXME stub
return true;
}
File diff suppressed because it is too large Load Diff