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:
Kevin Ollivier 2004-06-01 02:53:49 +00:00
parent 0a8d9df6a5
commit 14f21d6d89
2 changed files with 20 additions and 6 deletions

View File

@ -70,6 +70,7 @@ public:
void OnSize(wxSizeEvent &event);
protected:
DECLARE_EVENT_TABLE()
void MacVisibilityChanged();
private:
wxWindow *m_parent;

View File

@ -30,6 +30,7 @@
#endif
#include "wx/html/webkit.h"
#include "wx/notebook.h"
//#include "wx/html/wklisten.h"
@ -105,7 +106,7 @@ bool wxWebKitCtrl::Create(wxWindow *parent,
{
m_currentURL = strURL;
m_pageTitle = wxT("");
//m_pageTitle = _("Untitled Page");
//still needed for wxCocoa??
/*
@ -146,16 +147,17 @@ bool wxWebKitCtrl::Create(wxWindow *parent,
wxControl::Create(parent, m_windowID, pos, size, style , validator , name);
WebInitForCarbon();
HIWebViewCreate( (HIViewRef*) &m_macControl );
MacPostControlCreate(pos, size);
HIViewSetVisible( (HIViewRef) m_macControl, true );
m_webView = (WebView*) HIWebViewGetWebView( (HIViewRef) m_macControl );
MacPostControlCreate(pos, size);
HIViewSetVisible( (HIViewRef) m_macControl, true );
#endif
// Register event listener interfaces
MyFrameLoadMonitor* myFrameLoadMonitor = [[MyFrameLoadMonitor alloc] initWithWxWindow: (wxWindow*)this];
[m_webView setFrameLoadDelegate:myFrameLoadMonitor];
LoadURL(m_currentURL);
return true;
}
@ -225,7 +227,7 @@ void wxWebKitCtrl::Stop(){
bool wxWebKitCtrl::CanGetPageSource(){
if ( !m_webView )
return;
return false;
WebDataSource* dataSource = [[m_webView mainFrame] dataSource];
return ( [[dataSource representation] canProvideDocumentSource] );
@ -233,7 +235,7 @@ bool wxWebKitCtrl::CanGetPageSource(){
wxString wxWebKitCtrl::GetPageSource(){
if ( !m_webView )
return;
return wxT("");
if (CanGetPageSource()){
WebDataSource* dataSource = [[m_webView mainFrame] dataSource];
@ -253,10 +255,21 @@ void wxWebKitCtrl::SetPageSource(wxString& source, const wxString& baseUrl){
}
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];
event.Skip();
}
void wxWebKitCtrl::MacVisibilityChanged(){
bool isHidden = !IsControlVisible( (HIViewRef)m_macControl);
[m_webView setHidden:isHidden];
}
//------------------------------------------------------------
// Listener interfaces
//------------------------------------------------------------