Allow wxTopLevelWindowCocoa::SetDefaultItem(NULL)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@51476 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -352,9 +352,11 @@ wxString wxTopLevelWindowCocoa::GetTitle() const
|
|||||||
wxWindow* wxTopLevelWindowCocoa::SetDefaultItem(wxWindow *win)
|
wxWindow* wxTopLevelWindowCocoa::SetDefaultItem(wxWindow *win)
|
||||||
{
|
{
|
||||||
wxWindow *old = wxTopLevelWindowBase::SetDefaultItem(win);
|
wxWindow *old = wxTopLevelWindowBase::SetDefaultItem(win);
|
||||||
NSView *newView = win->GetNSView();
|
|
||||||
|
|
||||||
NSCell *newCell;
|
NSCell *newCell;
|
||||||
|
if(win != NULL)
|
||||||
|
{
|
||||||
|
NSView *newView = win->GetNSView();
|
||||||
// newView does not have to be an NSControl, we only cast to NSControl*
|
// newView does not have to be an NSControl, we only cast to NSControl*
|
||||||
// to silence the warning about cell not being implemented.
|
// to silence the warning about cell not being implemented.
|
||||||
if(newView != nil && [newView respondsToSelector:@selector(cell)])
|
if(newView != nil && [newView respondsToSelector:@selector(cell)])
|
||||||
@@ -366,6 +368,9 @@ wxWindow* wxTopLevelWindowCocoa::SetDefaultItem(wxWindow *win)
|
|||||||
{ // It's not an NSButtonCell, set the default to nil.
|
{ // It's not an NSButtonCell, set the default to nil.
|
||||||
newCell = nil;
|
newCell = nil;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
newCell = nil;
|
||||||
|
|
||||||
[GetNSWindow() setDefaultButtonCell:(NSButtonCell*)newCell];
|
[GetNSWindow() setDefaultButtonCell:(NSButtonCell*)newCell];
|
||||||
return old;
|
return old;
|
||||||
|
Reference in New Issue
Block a user