#include "wx/wx.h"
#endif
+#if wxUSE_WEBKIT
+
#ifdef __WXCOCOA__
#include "wx/cocoa/autorelease.h"
#else
#include "wx/html/webkit.h"
#include "wx/notebook.h"
-//#include "wx/html/wklisten.h"
// ----------------------------------------------------------------------------
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_macControl );
+ HIWebViewCreate( m_peer->GetControlRefAddr() );
- m_webView = (WebView*) HIWebViewGetWebView( (HIViewRef) m_macControl );
+ m_webView = (WebView*) HIWebViewGetWebView( m_peer->GetControlRef() );
MacPostControlCreate(pos, size);
-
- HIViewSetVisible( (HIViewRef) m_macControl, true );
+ HIViewSetVisible( m_peer->GetControlRef(), true );
+ [m_webView setHidden:false];
#endif
// Register event listener interfaces
}
void wxWebKitCtrl::OnSize(wxSizeEvent &event){
+ // This is a nasty hack because WebKit does not seem to recognize a Tabs control as its parent.
+ // Therefore, coordinates must be relative to the left-hand side of the screen, rather than
+ // relative to the Tabs control.
wxWindow* parent = GetParent();
bool inNotebook = false;
- int x, y;
+ int x = 0;
+ int y = 18;
while(parent != NULL)
{
+ // keep adding the position until we hit the notebook
+ if (!inNotebook){
+ x += parent->GetPosition().x;
+ y += parent->GetPosition().y;
+ }
+
+ if ( parent->GetClassInfo()->GetClassName() == wxT("wxSplitterWindow") ){
+ x += 3;
+ }
+
if( parent->IsKindOf( CLASSINFO( wxNotebook ) ) ){
- NSRect bounds = [m_webView frame];
- bounds.origin.x += parent->GetPosition().x;
- bounds.origin.y += 18;
- [m_webView setFrame:bounds];
- break;
+ inNotebook = true;
}
parent = parent->GetParent();
}
+ if (inNotebook){
+ NSRect bounds = [m_webView frame];
+ bounds.origin.x += x;
+ bounds.origin.y += y;
+ [m_webView setFrame:bounds];
+ }
+
[m_webView display];
event.Skip();
}
void wxWebKitCtrl::MacVisibilityChanged(){
- bool isHidden = !IsControlVisible( (HIViewRef)m_macControl);
+ bool isHidden = !IsControlVisible( m_peer->GetControlRef());
[m_webView setHidden:isHidden];
}
}
}
@end
+
+#endif //wxUSE_WEBKIT