Making wxUSE_WEBKIT for optionally building wxWebKitCtrl.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@27629 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Kevin Ollivier
2004-06-04 16:07:28 +00:00
parent 393c836c33
commit 5b8f917c30
3 changed files with 27 additions and 5 deletions

View File

@@ -16,6 +16,8 @@
#pragma interface "webkit.h" #pragma interface "webkit.h"
#endif #endif
#if wxUSE_WEBKIT
#if !defined(__WXMAC__) && !defined(__WXCOCOA__) #if !defined(__WXMAC__) && !defined(__WXCOCOA__)
#error "wxWebKitCtrl not implemented for this platform" #error "wxWebKitCtrl not implemented for this platform"
#endif #endif
@@ -127,4 +129,6 @@ END_DECLARE_EVENT_TYPES()
(wxWebKitStateChangedEventFunction) & func, \ (wxWebKitStateChangedEventFunction) & func, \
(wxObject *) NULL ), (wxObject *) NULL ),
#endif // wxUSE_WEBKIT
#endif // _WX_WEBKIT_H_ #endif // _WX_WEBKIT_H_

View File

@@ -768,6 +768,11 @@
// smaller library. // smaller library.
#define wxUSE_HTML 1 #define wxUSE_HTML 1
// wxWebKit is a wrapper for Apple's WebKit framework, use it if you want to embed
// the Safari browser control
// 0 by default because of Jaguar compatibility problems
#define wxUSE_WEBKIT 0
// OpenGL canvas // OpenGL canvas
#define wxUSE_GLCANVAS 0 #define wxUSE_GLCANVAS 0

View File

@@ -13,6 +13,8 @@
#pragma implementation "webkit.h" #pragma implementation "webkit.h"
#endif #endif
#if wxUSE_WEBKIT
// For compilers that support precompilation, includes "wx.h". // For compilers that support precompilation, includes "wx.h".
#include "wx/wxprec.h" #include "wx/wxprec.h"
@@ -31,7 +33,6 @@
#include "wx/html/webkit.h" #include "wx/html/webkit.h"
#include "wx/notebook.h" #include "wx/notebook.h"
//#include "wx/html/wklisten.h"
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
@@ -150,8 +151,8 @@ bool wxWebKitCtrl::Create(wxWindow *parent,
m_webView = (WebView*) HIWebViewGetWebView( (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 setHidden:false];
#endif #endif
// Register event listener interfaces // Register event listener interfaces
@@ -255,17 +256,27 @@ void wxWebKitCtrl::SetPageSource(wxString& source, const wxString& baseUrl){
} }
void wxWebKitCtrl::OnSize(wxSizeEvent &event){ 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(); wxWindow* parent = GetParent();
bool inNotebook = false; bool inNotebook = false;
int x = 0; int x = 0;
int y = 18; int y = 18;
while(parent != NULL) while(parent != NULL)
{ {
x += parent->GetPosition().x; // keep adding the position until we hit the notebook
y += parent->GetPosition().y; if (!inNotebook){
x += parent->GetPosition().x;
y += parent->GetPosition().y;
}
if ( parent->GetClassInfo()->GetClassName() == wxT("wxSplitterWindow") ){
x += 3;
}
if( parent->IsKindOf( CLASSINFO( wxNotebook ) ) ){ if( parent->IsKindOf( CLASSINFO( wxNotebook ) ) ){
inNotebook = true; inNotebook = true;
break;
} }
parent = parent->GetParent(); parent = parent->GetParent();
} }
@@ -361,3 +372,5 @@ void wxWebKitCtrl::MacVisibilityChanged(){
} }
} }
@end @end
#endif //wxUSE_WEBKIT