Fixes for wxWebKitCtrl to work with wxNotebook.
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@27547 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -70,6 +70,7 @@ public:
|
|||||||
void OnSize(wxSizeEvent &event);
|
void OnSize(wxSizeEvent &event);
|
||||||
protected:
|
protected:
|
||||||
DECLARE_EVENT_TABLE()
|
DECLARE_EVENT_TABLE()
|
||||||
|
void MacVisibilityChanged();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
wxWindow *m_parent;
|
wxWindow *m_parent;
|
||||||
|
@@ -30,6 +30,7 @@
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include "wx/html/webkit.h"
|
#include "wx/html/webkit.h"
|
||||||
|
#include "wx/notebook.h"
|
||||||
//#include "wx/html/wklisten.h"
|
//#include "wx/html/wklisten.h"
|
||||||
|
|
||||||
|
|
||||||
@@ -105,7 +106,7 @@ bool wxWebKitCtrl::Create(wxWindow *parent,
|
|||||||
{
|
{
|
||||||
|
|
||||||
m_currentURL = strURL;
|
m_currentURL = strURL;
|
||||||
m_pageTitle = wxT("");
|
//m_pageTitle = _("Untitled Page");
|
||||||
|
|
||||||
//still needed for wxCocoa??
|
//still needed for wxCocoa??
|
||||||
/*
|
/*
|
||||||
@@ -146,16 +147,17 @@ bool wxWebKitCtrl::Create(wxWindow *parent,
|
|||||||
wxControl::Create(parent, m_windowID, pos, size, style , validator , name);
|
wxControl::Create(parent, m_windowID, pos, size, style , validator , name);
|
||||||
WebInitForCarbon();
|
WebInitForCarbon();
|
||||||
HIWebViewCreate( (HIViewRef*) &m_macControl );
|
HIWebViewCreate( (HIViewRef*) &m_macControl );
|
||||||
|
|
||||||
|
m_webView = (WebView*) HIWebViewGetWebView( (HIViewRef) m_macControl );
|
||||||
MacPostControlCreate(pos, size);
|
MacPostControlCreate(pos, size);
|
||||||
|
|
||||||
HIViewSetVisible( (HIViewRef) m_macControl, true );
|
HIViewSetVisible( (HIViewRef) m_macControl, true );
|
||||||
|
|
||||||
m_webView = (WebView*) HIWebViewGetWebView( (HIViewRef) m_macControl );
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// Register event listener interfaces
|
// Register event listener interfaces
|
||||||
MyFrameLoadMonitor* myFrameLoadMonitor = [[MyFrameLoadMonitor alloc] initWithWxWindow: (wxWindow*)this];
|
MyFrameLoadMonitor* myFrameLoadMonitor = [[MyFrameLoadMonitor alloc] initWithWxWindow: (wxWindow*)this];
|
||||||
[m_webView setFrameLoadDelegate:myFrameLoadMonitor];
|
[m_webView setFrameLoadDelegate:myFrameLoadMonitor];
|
||||||
|
|
||||||
LoadURL(m_currentURL);
|
LoadURL(m_currentURL);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@@ -225,7 +227,7 @@ void wxWebKitCtrl::Stop(){
|
|||||||
|
|
||||||
bool wxWebKitCtrl::CanGetPageSource(){
|
bool wxWebKitCtrl::CanGetPageSource(){
|
||||||
if ( !m_webView )
|
if ( !m_webView )
|
||||||
return;
|
return false;
|
||||||
|
|
||||||
WebDataSource* dataSource = [[m_webView mainFrame] dataSource];
|
WebDataSource* dataSource = [[m_webView mainFrame] dataSource];
|
||||||
return ( [[dataSource representation] canProvideDocumentSource] );
|
return ( [[dataSource representation] canProvideDocumentSource] );
|
||||||
@@ -233,7 +235,7 @@ bool wxWebKitCtrl::CanGetPageSource(){
|
|||||||
|
|
||||||
wxString wxWebKitCtrl::GetPageSource(){
|
wxString wxWebKitCtrl::GetPageSource(){
|
||||||
if ( !m_webView )
|
if ( !m_webView )
|
||||||
return;
|
return wxT("");
|
||||||
|
|
||||||
if (CanGetPageSource()){
|
if (CanGetPageSource()){
|
||||||
WebDataSource* dataSource = [[m_webView mainFrame] dataSource];
|
WebDataSource* dataSource = [[m_webView mainFrame] dataSource];
|
||||||
@@ -253,10 +255,21 @@ void wxWebKitCtrl::SetPageSource(wxString& source, const wxString& baseUrl){
|
|||||||
}
|
}
|
||||||
|
|
||||||
void wxWebKitCtrl::OnSize(wxSizeEvent &event){
|
void wxWebKitCtrl::OnSize(wxSizeEvent &event){
|
||||||
|
if ( GetParent()->IsKindOf( CLASSINFO( wxNotebook) ) ){
|
||||||
|
NSRect bounds = [m_webView frame];
|
||||||
|
bounds.origin.x += GetParent()->GetPosition().x;
|
||||||
|
bounds.origin.y += 18;
|
||||||
|
[m_webView setFrame:bounds];
|
||||||
|
}
|
||||||
[m_webView display];
|
[m_webView display];
|
||||||
event.Skip();
|
event.Skip();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void wxWebKitCtrl::MacVisibilityChanged(){
|
||||||
|
bool isHidden = !IsControlVisible( (HIViewRef)m_macControl);
|
||||||
|
[m_webView setHidden:isHidden];
|
||||||
|
}
|
||||||
|
|
||||||
//------------------------------------------------------------
|
//------------------------------------------------------------
|
||||||
// Listener interfaces
|
// Listener interfaces
|
||||||
//------------------------------------------------------------
|
//------------------------------------------------------------
|
||||||
|
Reference in New Issue
Block a user