]> git.saurik.com Git - wxWidgets.git/blobdiff - src/html/htmlctrl/webkit/webkit.mm
Hardware defines spec.
[wxWidgets.git] / src / html / htmlctrl / webkit / webkit.mm
index 22d4b2368415ed8f69991ff1988e41605c27d3e0..cb85a483a4871d60a690a2cb5e464061dfa1adfb 100755 (executable)
@@ -13,8 +13,6 @@
     #pragma implementation "webkit.h"
 #endif
 
-#if wxUSE_WEBKIT
-
 // For compilers that support precompilation, includes "wx.h".
 #include "wx/wxprec.h"
 
@@ -22,6 +20,8 @@
     #include "wx/wx.h"
 #endif
 
+#if wxUSE_WEBKIT
+
 #ifdef __WXCOCOA__
 #include "wx/cocoa/autorelease.h"
 #else
@@ -145,13 +145,14 @@ bool wxWebKitCtrl::Create(wxWindow *parent,
     SetInitialFrameRect(pos,sizeInstance);
 #else
     m_macIsUserPane = false;
+    m_peer = new wxMacControl();
     wxControl::Create(parent, m_windowID, pos, size, style , validator , name);
     WebInitForCarbon();
-    HIWebViewCreate( (HIViewRef*) *m_peer );
+    HIWebViewCreate( m_peer->GetControlRefAddr() );
     
-    m_webView = (WebView*) HIWebViewGetWebView( (HIViewRef) *m_peer );
+    m_webView = (WebView*) HIWebViewGetWebView( m_peer->GetControlRef() );
     MacPostControlCreate(pos, size);
-    HIViewSetVisible( (HIViewRef) *m_peer, true );           
+    HIViewSetVisible( m_peer->GetControlRef(), true );           
     [m_webView setHidden:false];
 #endif
 
@@ -199,17 +200,17 @@ bool wxWebKitCtrl::CanGoForward(){
 bool wxWebKitCtrl::GoBack(){
     if ( !m_webView )
         return false;
-        
-    [m_webView goBack];
-    return true;
+    
+    bool result = [(WebView*)m_webView goBack];
+    return result;
 }
 
 bool wxWebKitCtrl::GoForward(){ 
     if ( !m_webView )
         return false;
         
-    [m_webView goForward];
-    return true;
+    bool result = [(WebView*)m_webView goForward];
+    return result;
 }
 
 void wxWebKitCtrl::Reload(){ 
@@ -235,14 +236,13 @@ bool wxWebKitCtrl::CanGetPageSource(){
 }
 
 wxString wxWebKitCtrl::GetPageSource(){
-    if ( !m_webView )
-        return wxT("");
     
     if (CanGetPageSource()){
         WebDataSource* dataSource = [[m_webView mainFrame] dataSource];
         return wxStringWithNSString( [[dataSource representation] documentSource] );
     }
     
+    return wxT("");
 }
 
 void wxWebKitCtrl::SetPageSource(wxString& source, const wxString& baseUrl){
@@ -262,7 +262,7 @@ void wxWebKitCtrl::OnSize(wxSizeEvent &event){
     wxWindow* parent = GetParent();
     bool inNotebook = false;
     int x = 0;
-    int y = 18; 
+    int y = 18;
     while(parent != NULL)
     {
         // keep adding the position until we hit the notebook
@@ -293,7 +293,7 @@ void wxWebKitCtrl::OnSize(wxSizeEvent &event){
 }
 
 void wxWebKitCtrl::MacVisibilityChanged(){
-    bool isHidden = !IsControlVisible( (HIViewRef)*m_peer);
+    bool isHidden = !IsControlVisible( m_peer->GetControlRef());
     [m_webView setHidden:isHidden];
 }
 
@@ -373,4 +373,4 @@ void wxWebKitCtrl::MacVisibilityChanged(){
 }
 @end
 
-#endif //wxUSE_WEBKIT
\ No newline at end of file
+#endif //wxUSE_WEBKIT