adding wrapping possibility for native tlws
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@63969 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -1002,12 +1002,14 @@ class wxNonOwnedWindowCarbonImpl : public wxNonOwnedWindowImpl
|
||||
{
|
||||
public :
|
||||
wxNonOwnedWindowCarbonImpl( wxNonOwnedWindow* nonownedwnd) ;
|
||||
|
||||
wxNonOwnedWindowCarbonImpl();
|
||||
virtual ~wxNonOwnedWindowCarbonImpl();
|
||||
|
||||
virtual void WillBeDestroyed() ;
|
||||
void Create( wxWindow* parent, const wxPoint& pos, const wxSize& size,
|
||||
long style, long extraStyle, const wxString& name ) ;
|
||||
void Create( wxWindow* parent, WXWindow nativeWindow );
|
||||
|
||||
WXWindow GetWXWindow() const;
|
||||
void Raise();
|
||||
|
@@ -209,6 +209,7 @@ public :
|
||||
virtual void WillBeDestroyed() ;
|
||||
void Create( wxWindow* parent, const wxPoint& pos, const wxSize& size,
|
||||
long style, long extraStyle, const wxString& name ) ;
|
||||
void Create( wxWindow* parent, WXWindow nativeWindow );
|
||||
|
||||
WXWindow GetWXWindow() const;
|
||||
void Raise();
|
||||
|
@@ -796,6 +796,8 @@ public :
|
||||
|
||||
// static creation methods, must be implemented by all toolkits
|
||||
|
||||
static wxNonOwnedWindowImpl* CreateNonOwnedWindow( wxNonOwnedWindow* wxpeer, wxWindow* parent, WXWindow native) ;
|
||||
|
||||
static wxNonOwnedWindowImpl* CreateNonOwnedWindow( wxNonOwnedWindow* wxpeer, wxWindow* parent, const wxPoint& pos, const wxSize& size,
|
||||
long style, long extraStyle, const wxString& name ) ;
|
||||
|
||||
|
@@ -55,6 +55,8 @@ public:
|
||||
long style = 0,
|
||||
const wxString& name = wxPanelNameStr);
|
||||
|
||||
bool Create(wxWindow *parent, WXWindow nativeWindow);
|
||||
|
||||
virtual ~wxNonOwnedWindow();
|
||||
|
||||
virtual wxPoint GetClientAreaOrigin() const;
|
||||
|
@@ -263,6 +263,8 @@ public:
|
||||
|
||||
virtual bool OSXHandleClicked( double timestampsec );
|
||||
virtual bool OSXHandleKeyEvent( wxKeyEvent& event );
|
||||
|
||||
bool IsNativeWindowWrapper() const { return m_isNativeWindowWrapper; }
|
||||
protected:
|
||||
// For controls like radio buttons which are genuinely composite
|
||||
wxList m_subControls;
|
||||
@@ -298,6 +300,8 @@ protected:
|
||||
wxWindow* m_growBox ;
|
||||
wxString m_label ;
|
||||
|
||||
bool m_isNativeWindowWrapper;
|
||||
|
||||
// set to true if we do a sharp clip at the content area of this window
|
||||
// must be dynamic as eg a panel normally is not clipping precisely, but if
|
||||
// it becomes the target window of a scrolled window it has to...
|
||||
|
@@ -1134,7 +1134,7 @@ wxNonOwnedWindowCarbonImpl::~wxNonOwnedWindowCarbonImpl()
|
||||
m_macEventHandler = NULL ;
|
||||
}
|
||||
|
||||
if ( m_macWindow )
|
||||
if ( m_macWindow && !m_wxPeer->IsNativeWindowWrapper())
|
||||
DisposeWindow( m_macWindow );
|
||||
|
||||
FullScreenData *data = (FullScreenData *) m_macFullScreenData ;
|
||||
@@ -1190,6 +1190,13 @@ void wxNonOwnedWindowCarbonImpl::MacInstallTopLevelWindowEventHandler()
|
||||
wxNonOwnedWindowInstallTopLevelWindowEventHandler(MAC_WXHWND(m_macWindow),(EventHandlerRef *)&m_macEventHandler,this);
|
||||
}
|
||||
|
||||
void wxNonOwnedWindowCarbonImpl::Create(
|
||||
wxWindow* parent,
|
||||
WXWindow nativeWindow )
|
||||
{
|
||||
m_macWindow = nativeWindow;
|
||||
}
|
||||
|
||||
void wxNonOwnedWindowCarbonImpl::Create(
|
||||
wxWindow* parent,
|
||||
const wxPoint& pos,
|
||||
@@ -1689,3 +1696,11 @@ wxNonOwnedWindowImpl* wxNonOwnedWindowImpl::CreateNonOwnedWindow( wxNonOwnedWind
|
||||
now->Create( parent, pos, size, style , extraStyle, name );
|
||||
return now;
|
||||
}
|
||||
|
||||
wxNonOwnedWindowImpl* wxNonOwnedWindowImpl::CreateNonOwnedWindow( wxNonOwnedWindow* wxpeer, wxWindow* parent, WXWindow nativeWindow )
|
||||
{
|
||||
wxNonOwnedWindowCarbonImpl* now = new wxNonOwnedWindowCarbonImpl( wxpeer );
|
||||
now->Create( parent, nativeWindow );
|
||||
return now;
|
||||
}
|
||||
|
||||
|
@@ -188,7 +188,13 @@ static pascal OSStatus wxMacWindowControlEventHandler( EventHandlerCallRef handl
|
||||
OSStatus err = cEvent.GetParameter<CGContextRef>(kEventParamCGContextRef, &cgContext) ;
|
||||
if ( err != noErr )
|
||||
{
|
||||
wxFAIL_MSG("Unable to retrieve CGContextRef");
|
||||
// for non-composite drawing, since we don't support it ourselves, send it through the
|
||||
// the default handler
|
||||
// CallNextEventHandler( handler,event ) ;
|
||||
// result = noErr ;
|
||||
if ( allocatedRgn )
|
||||
CFRelease( allocatedRgn ) ;
|
||||
break;
|
||||
}
|
||||
|
||||
thisWindow->MacSetCGContextRef( cgContext ) ;
|
||||
@@ -1515,6 +1521,8 @@ wxWidgetImplType* wxWidgetImpl::CreateContentView( wxNonOwnedWindow* now )
|
||||
}
|
||||
|
||||
// the root control level handler
|
||||
if ( !now->IsNativeWindowWrapper() )
|
||||
contentview->InstallEventHandler() ;
|
||||
|
||||
return contentview;
|
||||
}
|
||||
|
@@ -360,16 +360,22 @@ wxNonOwnedWindowCocoaImpl::wxNonOwnedWindowCocoaImpl()
|
||||
}
|
||||
|
||||
wxNonOwnedWindowCocoaImpl::~wxNonOwnedWindowCocoaImpl()
|
||||
{
|
||||
if ( !m_wxPeer->IsNativeWindowWrapper() )
|
||||
{
|
||||
[m_macWindow setImplementation:nil];
|
||||
[m_macWindow setDelegate:nil];
|
||||
[m_macWindow release];
|
||||
}
|
||||
}
|
||||
|
||||
void wxNonOwnedWindowCocoaImpl::WillBeDestroyed()
|
||||
{
|
||||
if ( !m_wxPeer->IsNativeWindowWrapper() )
|
||||
{
|
||||
[m_macWindow setDelegate:nil];
|
||||
}
|
||||
}
|
||||
|
||||
void wxNonOwnedWindowCocoaImpl::Create( wxWindow* WXUNUSED(parent), const wxPoint& pos, const wxSize& size,
|
||||
long style, long extraStyle, const wxString& WXUNUSED(name) )
|
||||
@@ -493,6 +499,10 @@ long style, long extraStyle, const wxString& WXUNUSED(name) )
|
||||
}
|
||||
}
|
||||
|
||||
void wxNonOwnedWindowCocoaImpl::Create( wxWindow* WXUNUSED(parent), WXWindow nativeWindow )
|
||||
{
|
||||
m_macWindow = nativeWindow;
|
||||
}
|
||||
|
||||
WXWindow wxNonOwnedWindowCocoaImpl::GetWXWindow() const
|
||||
{
|
||||
@@ -787,6 +797,13 @@ bool wxNonOwnedWindowCocoaImpl::IsModified() const
|
||||
return [m_macWindow isDocumentEdited];
|
||||
}
|
||||
|
||||
wxNonOwnedWindowImpl* wxNonOwnedWindowImpl::CreateNonOwnedWindow( wxNonOwnedWindow* wxpeer, wxWindow* parent, WXWindow nativeWindow)
|
||||
{
|
||||
wxNonOwnedWindowCocoaImpl* now = new wxNonOwnedWindowCocoaImpl( wxpeer );
|
||||
now->Create( parent, nativeWindow );
|
||||
return now;
|
||||
}
|
||||
|
||||
wxNonOwnedWindowImpl* wxNonOwnedWindowImpl::CreateNonOwnedWindow( wxNonOwnedWindow* wxpeer, wxWindow* parent, const wxPoint& pos, const wxSize& size,
|
||||
long style, long extraStyle, const wxString& name )
|
||||
{
|
||||
|
@@ -2084,10 +2084,18 @@ wxWidgetImpl* wxWidgetImpl::CreateUserPane( wxWindowMac* wxpeer, wxWindowMac* WX
|
||||
wxWidgetImpl* wxWidgetImpl::CreateContentView( wxNonOwnedWindow* now )
|
||||
{
|
||||
NSWindow* tlw = now->GetWXWindow();
|
||||
wxNSView* v = [[wxNSView alloc] initWithFrame:[[tlw contentView] frame]];
|
||||
|
||||
wxWidgetCocoaImpl* c = new wxWidgetCocoaImpl( now, v, true );
|
||||
wxWidgetCocoaImpl* c = NULL;
|
||||
if ( now->IsNativeWindowWrapper() )
|
||||
{
|
||||
c = new wxWidgetCocoaImpl( now, [tlw contentView], true );
|
||||
}
|
||||
else
|
||||
{
|
||||
wxNSView* v = [[wxNSView alloc] initWithFrame:[[tlw contentView] frame]];
|
||||
c = new wxWidgetCocoaImpl( now, v, true );
|
||||
c->InstallEventHandler();
|
||||
[tlw setContentView:v];
|
||||
}
|
||||
return c;
|
||||
}
|
||||
|
@@ -98,6 +98,7 @@ wxNonOwnedWindow *wxNonOwnedWindow::s_macDeactivateWindow = NULL;
|
||||
void wxNonOwnedWindow::Init()
|
||||
{
|
||||
m_nowpeer = NULL;
|
||||
m_isNativeWindowWrapper = false;
|
||||
}
|
||||
|
||||
bool wxNonOwnedWindow::Create(wxWindow *parent,
|
||||
@@ -107,9 +108,6 @@ bool wxNonOwnedWindow::Create(wxWindow *parent,
|
||||
long style,
|
||||
const wxString& name)
|
||||
{
|
||||
// init our fields
|
||||
Init();
|
||||
|
||||
m_windowStyle = style;
|
||||
|
||||
SetName( name );
|
||||
@@ -150,6 +148,19 @@ bool wxNonOwnedWindow::Create(wxWindow *parent,
|
||||
return true;
|
||||
}
|
||||
|
||||
bool wxNonOwnedWindow::Create(wxWindow *parent, WXWindow nativeWindow)
|
||||
{
|
||||
m_nowpeer = wxNonOwnedWindowImpl::CreateNonOwnedWindow(this, parent, nativeWindow );
|
||||
m_isNativeWindowWrapper = true;
|
||||
wxAssociateWindowWithWXWindow( m_nowpeer->GetWXWindow() , this ) ;
|
||||
m_peer = wxWidgetImpl::CreateContentView(this);
|
||||
|
||||
if ( parent )
|
||||
parent->AddChild(this);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
wxNonOwnedWindow::~wxNonOwnedWindow()
|
||||
{
|
||||
SendDestroyEvent();
|
||||
|
@@ -206,6 +206,7 @@ void wxWindowMac::Init()
|
||||
m_macIsUserPane = true;
|
||||
m_clipChildren = false ;
|
||||
m_cachedClippedRectValid = false ;
|
||||
m_isNativeWindowWrapper = false;
|
||||
}
|
||||
|
||||
wxWindowMac::~wxWindowMac()
|
||||
|
Reference in New Issue
Block a user