]> git.saurik.com Git - wxWidgets.git/commitdiff
Fixes for wxWebKitCtrl to work with wxNotebook.
authorKevin Ollivier <kevino@theolliviers.com>
Tue, 1 Jun 2004 02:53:49 +0000 (02:53 +0000)
committerKevin Ollivier <kevino@theolliviers.com>
Tue, 1 Jun 2004 02:53:49 +0000 (02:53 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@27547 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

include/wx/html/webkit.h
src/html/htmlctrl/webkit/webkit.mm

index c363df714652546c572f77bbaeb3d3747f5a5b3c..1bec21122e935d66182e1682c184e4ed8fc08120 100755 (executable)
@@ -70,6 +70,7 @@ public:
     void OnSize(wxSizeEvent &event);
 protected:
     DECLARE_EVENT_TABLE()
+    void MacVisibilityChanged();
 
 private:
     wxWindow *m_parent;
index 53e4c8438d99392868dfee744439d8d805e3eec7..93609c92948f4eae99f0f0ac2f76929264e7d318 100755 (executable)
@@ -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
 //------------------------------------------------------------