Use WXNSView just like wxWindow does when creating a wxControl. There are
already wxControl subclasses such as wxStaticBox not using primary views which derive from NSControl so wxControl has to support this already. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/branches/WX_2_8_BRANCH@49140 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -22,6 +22,7 @@
|
|||||||
#include "wx/cocoa/string.h"
|
#include "wx/cocoa/string.h"
|
||||||
#include "wx/cocoa/trackingrectmanager.h"
|
#include "wx/cocoa/trackingrectmanager.h"
|
||||||
#include "wx/cocoa/objc/objc_uniquifying.h"
|
#include "wx/cocoa/objc/objc_uniquifying.h"
|
||||||
|
#include "wx/cocoa/objc/NSView.h"
|
||||||
|
|
||||||
#import <AppKit/NSControl.h>
|
#import <AppKit/NSControl.h>
|
||||||
#import <AppKit/NSCell.h>
|
#import <AppKit/NSCell.h>
|
||||||
@@ -210,13 +211,11 @@ bool wxControl::Create(wxWindow *parent, wxWindowID winid,
|
|||||||
return false;
|
return false;
|
||||||
wxLogTrace(wxTRACE_COCOA,wxT("Created control with id=%d"),GetId());
|
wxLogTrace(wxTRACE_COCOA,wxT("Created control with id=%d"),GetId());
|
||||||
m_cocoaNSView = NULL;
|
m_cocoaNSView = NULL;
|
||||||
SetNSControl([[WX_GET_OBJC_CLASS(wxNonControlNSControl) alloc] initWithFrame: MakeDefaultNSRect(size)]);
|
SetNSControl([[WX_GET_OBJC_CLASS(WXNSView) alloc] initWithFrame: MakeDefaultNSRect(size)]);
|
||||||
// NOTE: YES we want to release this (to match the alloc).
|
// NOTE: YES we want to release this (to match the alloc).
|
||||||
// DoAddChild(this) will retain us again since addSubView doesn't.
|
// DoAddChild(this) will retain us again since addSubView doesn't.
|
||||||
[m_cocoaNSView release];
|
[m_cocoaNSView release];
|
||||||
|
|
||||||
[GetNSControl() sizeToFit];
|
|
||||||
|
|
||||||
if(m_parent)
|
if(m_parent)
|
||||||
m_parent->CocoaAddChild(this);
|
m_parent->CocoaAddChild(this);
|
||||||
SetInitialFrameRect(pos,size);
|
SetInitialFrameRect(pos,size);
|
||||||
@@ -273,7 +272,8 @@ bool wxControl::ProcessCommand(wxCommandEvent& event)
|
|||||||
|
|
||||||
void wxControl::CocoaSetEnabled(bool enable)
|
void wxControl::CocoaSetEnabled(bool enable)
|
||||||
{
|
{
|
||||||
[GetNSControl() setEnabled: enable];
|
if([GetNSControl() respondsToSelector:@selector(setEnabled:)])
|
||||||
|
[GetNSControl() setEnabled: enable];
|
||||||
}
|
}
|
||||||
|
|
||||||
/*static*/ void wxControl::CocoaSetLabelForObject(const wxString& label, struct objc_object *aView)
|
/*static*/ void wxControl::CocoaSetLabelForObject(const wxString& label, struct objc_object *aView)
|
||||||
|
Reference in New Issue
Block a user