macOS wxWidgetImpl constructor with flags
replacing bools with int flag
This commit is contained in:
@@ -50,8 +50,7 @@ class WXDLLIMPEXP_FWD_CORE wxDialog;
|
|||||||
class WXDLLIMPEXP_CORE wxWidgetCocoaImpl : public wxWidgetImpl
|
class WXDLLIMPEXP_CORE wxWidgetCocoaImpl : public wxWidgetImpl
|
||||||
{
|
{
|
||||||
public :
|
public :
|
||||||
wxWidgetCocoaImpl( wxWindowMac* peer , WXWidget w, bool isRootControl, bool isUserPane, bool wantsUserKey ) ;
|
wxWidgetCocoaImpl( wxWindowMac* peer , WXWidget w, int flags = 0 ) ;
|
||||||
wxWidgetCocoaImpl( wxWindowMac* peer , WXWidget w, bool isRootControl = false, bool isUserPane = false ) ;
|
|
||||||
wxWidgetCocoaImpl() ;
|
wxWidgetCocoaImpl() ;
|
||||||
~wxWidgetCocoaImpl();
|
~wxWidgetCocoaImpl();
|
||||||
|
|
||||||
|
@@ -216,8 +216,16 @@ protected :
|
|||||||
class WXDLLIMPEXP_CORE wxWidgetImpl : public wxObject
|
class WXDLLIMPEXP_CORE wxWidgetImpl : public wxObject
|
||||||
{
|
{
|
||||||
public :
|
public :
|
||||||
|
enum WidgetFlags
|
||||||
|
{
|
||||||
|
Widget_IsRoot = 0x0001,
|
||||||
|
Widget_IsUserPane = 0x0002,
|
||||||
|
Widget_UserKeyEvents = 0x0004,
|
||||||
|
Widget_UserMouseEvents = 0x0008,
|
||||||
|
};
|
||||||
|
|
||||||
wxWidgetImpl( wxWindowMac* peer , bool isRootControl, bool isUserPane, bool wantsUserKey );
|
wxWidgetImpl( wxWindowMac* peer , bool isRootControl, bool isUserPane, bool wantsUserKey );
|
||||||
wxWidgetImpl( wxWindowMac* peer , bool isRootControl = false, bool isUserPane = false );
|
wxWidgetImpl( wxWindowMac* peer , int flags = 0 );
|
||||||
wxWidgetImpl();
|
wxWidgetImpl();
|
||||||
virtual ~wxWidgetImpl();
|
virtual ~wxWidgetImpl();
|
||||||
|
|
||||||
@@ -225,15 +233,14 @@ public :
|
|||||||
|
|
||||||
bool IsRootControl() const { return m_isRootControl; }
|
bool IsRootControl() const { return m_isRootControl; }
|
||||||
|
|
||||||
// is a completely control that has all events handled in wx code, no built-ins
|
// is a custom control that has all events handled in wx code, no built-ins
|
||||||
bool IsUserPane() const { return m_isUserPane; }
|
bool IsUserPane() const { return m_isUserPane; }
|
||||||
|
|
||||||
// we are doing keyboard handling in wx code, other events might be handled natively
|
// we are doing keyboard handling in wx code, other events might be handled natively
|
||||||
virtual bool HasUserKeyHandling() const { return m_wantsUserKey; }
|
virtual bool HasUserKeyHandling() const { return m_wantsUserKey; }
|
||||||
|
|
||||||
// we are doing mouse handling in wx code, other events might be handled natively
|
// we are doing mouse handling in wx code, other events might be handled natively
|
||||||
// right now this is always in sync with HasUserKeyHandling
|
virtual bool HasUserMouseHandling() const { return m_wantsUserMouse; }
|
||||||
virtual bool HasUserMouseHandling() const { return m_wantsUserKey; }
|
|
||||||
|
|
||||||
wxWindowMac* GetWXPeer() const { return m_wxPeer; }
|
wxWindowMac* GetWXPeer() const { return m_wxPeer; }
|
||||||
|
|
||||||
@@ -582,6 +589,7 @@ protected :
|
|||||||
bool m_isRootControl;
|
bool m_isRootControl;
|
||||||
bool m_isUserPane;
|
bool m_isUserPane;
|
||||||
bool m_wantsUserKey;
|
bool m_wantsUserKey;
|
||||||
|
bool m_wantsUserMouse;
|
||||||
wxWindowMac* m_wxPeer;
|
wxWindowMac* m_wxPeer;
|
||||||
bool m_needsFocusRect;
|
bool m_needsFocusRect;
|
||||||
bool m_needsFrame;
|
bool m_needsFrame;
|
||||||
|
@@ -37,7 +37,7 @@ wxBitmap WXDLLIMPEXP_CORE wxOSXCreateSystemBitmap(const wxString& id, const wxSt
|
|||||||
class WXDLLIMPEXP_CORE wxWidgetIPhoneImpl : public wxWidgetImpl
|
class WXDLLIMPEXP_CORE wxWidgetIPhoneImpl : public wxWidgetImpl
|
||||||
{
|
{
|
||||||
public :
|
public :
|
||||||
wxWidgetIPhoneImpl( wxWindowMac* peer , WXWidget w, bool isRootControl = false, bool isUserPane = false ) ;
|
wxWidgetIPhoneImpl( wxWindowMac* peer , WXWidget w, int flags = 0 ) ;
|
||||||
wxWidgetIPhoneImpl() ;
|
wxWidgetIPhoneImpl() ;
|
||||||
~wxWidgetIPhoneImpl();
|
~wxWidgetIPhoneImpl();
|
||||||
|
|
||||||
|
@@ -167,7 +167,7 @@ bool wxGLCanvas::DoCreate(wxWindow *parent,
|
|||||||
NSRect r = wxOSXGetFrameForControl( this, pos , size ) ;
|
NSRect r = wxOSXGetFrameForControl( this, pos , size ) ;
|
||||||
wxNSCustomOpenGLView* v = [[wxNSCustomOpenGLView alloc] initWithFrame:r];
|
wxNSCustomOpenGLView* v = [[wxNSCustomOpenGLView alloc] initWithFrame:r];
|
||||||
|
|
||||||
wxWidgetCocoaImpl* c = new wxWidgetCocoaImpl( this, v, false, false, true /* wants key events */ );
|
wxWidgetCocoaImpl* c = new wxWidgetCocoaImpl( this, v, wxWidgetImpl::Widget_UserKeyEvents | wxWidgetImpl::Widget_UserMouseEvents );
|
||||||
SetPeer(c);
|
SetPeer(c);
|
||||||
MacPostControlCreate(pos, size) ;
|
MacPostControlCreate(pos, size) ;
|
||||||
return true;
|
return true;
|
||||||
|
@@ -2512,24 +2512,8 @@ void wxOSXCocoaClassAddWXMethods(Class c, wxOSXSkipOverrides skipFlags)
|
|||||||
|
|
||||||
wxIMPLEMENT_DYNAMIC_CLASS(wxWidgetCocoaImpl , wxWidgetImpl);
|
wxIMPLEMENT_DYNAMIC_CLASS(wxWidgetCocoaImpl , wxWidgetImpl);
|
||||||
|
|
||||||
wxWidgetCocoaImpl::wxWidgetCocoaImpl( wxWindowMac* peer , WXWidget w, bool isRootControl, bool isUserPane, bool wantsKey ) :
|
wxWidgetCocoaImpl::wxWidgetCocoaImpl( wxWindowMac* peer , WXWidget w, int flags ) :
|
||||||
wxWidgetImpl( peer, isRootControl, isUserPane, wantsKey )
|
wxWidgetImpl( peer, flags )
|
||||||
{
|
|
||||||
Init();
|
|
||||||
m_osxView = w;
|
|
||||||
|
|
||||||
// check if the user wants to create the control initially hidden
|
|
||||||
if ( !peer->IsShown() )
|
|
||||||
SetVisibility(false);
|
|
||||||
|
|
||||||
// gc aware handling
|
|
||||||
if ( m_osxView )
|
|
||||||
CFRetain(m_osxView);
|
|
||||||
[m_osxView release];
|
|
||||||
}
|
|
||||||
|
|
||||||
wxWidgetCocoaImpl::wxWidgetCocoaImpl( wxWindowMac* peer , WXWidget w, bool isRootControl, bool isUserPane ) :
|
|
||||||
wxWidgetImpl( peer, isRootControl, isUserPane )
|
|
||||||
{
|
{
|
||||||
Init();
|
Init();
|
||||||
m_osxView = w;
|
m_osxView = w;
|
||||||
@@ -3834,7 +3818,7 @@ wxWidgetImpl* wxWidgetImpl::CreateUserPane( wxWindowMac* wxpeer, wxWindowMac* WX
|
|||||||
NSRect r = wxOSXGetFrameForControl( wxpeer, pos , size ) ;
|
NSRect r = wxOSXGetFrameForControl( wxpeer, pos , size ) ;
|
||||||
wxNSView* v = [[wxNSView alloc] initWithFrame:r];
|
wxNSView* v = [[wxNSView alloc] initWithFrame:r];
|
||||||
|
|
||||||
wxWidgetCocoaImpl* c = new wxWidgetCocoaImpl( wxpeer, v, false, true );
|
wxWidgetCocoaImpl* c = new wxWidgetCocoaImpl( wxpeer, v, Widget_IsUserPane );
|
||||||
return c;
|
return c;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -3846,7 +3830,7 @@ wxWidgetImpl* wxWidgetImpl::CreateContentView( wxNonOwnedWindow* now )
|
|||||||
if ( now->IsNativeWindowWrapper() )
|
if ( now->IsNativeWindowWrapper() )
|
||||||
{
|
{
|
||||||
NSView* cv = [tlw contentView];
|
NSView* cv = [tlw contentView];
|
||||||
c = new wxWidgetCocoaImpl( now, cv, true );
|
c = new wxWidgetCocoaImpl( now, cv, Widget_IsRoot );
|
||||||
if ( cv != nil )
|
if ( cv != nil )
|
||||||
{
|
{
|
||||||
// increase ref count, because the impl destructor will decrement it again
|
// increase ref count, because the impl destructor will decrement it again
|
||||||
@@ -3858,7 +3842,7 @@ wxWidgetImpl* wxWidgetImpl::CreateContentView( wxNonOwnedWindow* now )
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
wxNSView* v = [[wxNSView alloc] initWithFrame:[[tlw contentView] frame]];
|
wxNSView* v = [[wxNSView alloc] initWithFrame:[[tlw contentView] frame]];
|
||||||
c = new wxWidgetCocoaImpl( now, v, true );
|
c = new wxWidgetCocoaImpl( now, v, Widget_IsRoot );
|
||||||
c->InstallEventHandler();
|
c->InstallEventHandler();
|
||||||
[tlw setContentView:v];
|
[tlw setContentView:v];
|
||||||
}
|
}
|
||||||
|
@@ -354,7 +354,7 @@ wxWidgetImpl* wxWidgetImpl::CreateContentView( wxNonOwnedWindow* now )
|
|||||||
[contentview setController:controller];
|
[contentview setController:controller];
|
||||||
[contentview setHidden:YES];
|
[contentview setHidden:YES];
|
||||||
|
|
||||||
wxWidgetIPhoneImpl* impl = new wxWidgetIPhoneImpl( now, contentview, true );
|
wxWidgetIPhoneImpl* impl = new wxWidgetIPhoneImpl( now, contentview, Widget_IsRoot );
|
||||||
impl->InstallEventHandler();
|
impl->InstallEventHandler();
|
||||||
|
|
||||||
if ([toplevelwindow respondsToSelector:@selector(setRootViewController:)])
|
if ([toplevelwindow respondsToSelector:@selector(setRootViewController:)])
|
||||||
|
@@ -334,8 +334,8 @@ void wxOSXIPhoneClassAddWXMethods(Class c)
|
|||||||
|
|
||||||
wxIMPLEMENT_DYNAMIC_CLASS(wxWidgetIPhoneImpl , wxWidgetImpl);
|
wxIMPLEMENT_DYNAMIC_CLASS(wxWidgetIPhoneImpl , wxWidgetImpl);
|
||||||
|
|
||||||
wxWidgetIPhoneImpl::wxWidgetIPhoneImpl( wxWindowMac* peer , WXWidget w, bool isRootControl, bool isUserPane ) :
|
wxWidgetIPhoneImpl::wxWidgetIPhoneImpl( wxWindowMac* peer , WXWidget w, int flags ) :
|
||||||
wxWidgetImpl( peer, isRootControl, isUserPane ), m_osxView(w)
|
wxWidgetImpl( peer, flags ), m_osxView(w)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -821,7 +821,7 @@ wxWidgetImpl* wxWidgetImpl::CreateUserPane( wxWindowMac* wxpeer, wxWindowMac* WX
|
|||||||
sv.clipsToBounds = YES;
|
sv.clipsToBounds = YES;
|
||||||
sv.contentMode = UIViewContentModeRedraw;
|
sv.contentMode = UIViewContentModeRedraw;
|
||||||
sv.clearsContextBeforeDrawing = NO;
|
sv.clearsContextBeforeDrawing = NO;
|
||||||
wxWidgetIPhoneImpl* c = new wxWidgetIPhoneImpl( wxpeer, v, false, true );
|
wxWidgetIPhoneImpl* c = new wxWidgetIPhoneImpl( wxpeer, v, Widget_IsUserPane );
|
||||||
return c;
|
return c;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -2741,11 +2741,13 @@ void wxWidgetImpl::RemoveAssociation(WXWidget control)
|
|||||||
|
|
||||||
wxIMPLEMENT_ABSTRACT_CLASS(wxWidgetImpl, wxObject);
|
wxIMPLEMENT_ABSTRACT_CLASS(wxWidgetImpl, wxObject);
|
||||||
|
|
||||||
wxWidgetImpl::wxWidgetImpl( wxWindowMac* peer , bool isRootControl, bool isUserPane )
|
wxWidgetImpl::wxWidgetImpl( wxWindowMac* peer , int flags )
|
||||||
{
|
{
|
||||||
Init();
|
Init();
|
||||||
m_isRootControl = isRootControl;
|
m_isRootControl = flags & Widget_IsRoot;
|
||||||
m_wantsUserKey = m_isUserPane = isUserPane;
|
m_isUserPane = flags & Widget_IsUserPane;
|
||||||
|
m_wantsUserKey = m_isUserPane || (flags & Widget_UserKeyEvents);
|
||||||
|
m_wantsUserMouse = m_isUserPane || (flags & Widget_UserMouseEvents);
|
||||||
m_wxPeer = peer;
|
m_wxPeer = peer;
|
||||||
m_shouldSendEvents = true;
|
m_shouldSendEvents = true;
|
||||||
}
|
}
|
||||||
@@ -2773,6 +2775,8 @@ wxWidgetImpl::~wxWidgetImpl()
|
|||||||
void wxWidgetImpl::Init()
|
void wxWidgetImpl::Init()
|
||||||
{
|
{
|
||||||
m_isRootControl = false;
|
m_isRootControl = false;
|
||||||
|
m_wantsUserKey = false;
|
||||||
|
m_wantsUserMouse = false;
|
||||||
m_wxPeer = NULL;
|
m_wxPeer = NULL;
|
||||||
m_needsFocusRect = false;
|
m_needsFocusRect = false;
|
||||||
m_needsFrame = true;
|
m_needsFrame = true;
|
||||||
|
Reference in New Issue
Block a user