+void wxTopLevelWindowCocoa::SetTitle(const wxString& title)
+{
+ [m_cocoaNSWindow setTitle:wxNSStringWithWxString(title)];
+}
+
+wxString wxTopLevelWindowCocoa::GetTitle() const
+{
+ return wxStringWithNSString([m_cocoaNSWindow title]);
+}
+
+wxWindow* wxTopLevelWindowCocoa::SetDefaultItem(wxWindow *win)
+{
+ wxWindow *old = wxTopLevelWindowBase::SetDefaultItem(win);
+
+ NSCell *newCell;
+ if(win != NULL)
+ {
+ NSView *newView = win->GetNSView();
+ // newView does not have to be an NSControl, we only cast to NSControl*
+ // to silence the warning about cell not being implemented.
+ if(newView != nil && [newView respondsToSelector:@selector(cell)])
+ newCell = [(NSControl*)newView cell];
+ else
+ newCell = nil;
+
+ if(newCell != nil && ![newCell isKindOfClass:[NSButtonCell class]])
+ { // It's not an NSButtonCell, set the default to nil.
+ newCell = nil;
+ }
+ }
+ else
+ newCell = nil;
+
+ [GetNSWindow() setDefaultButtonCell:(NSButtonCell*)newCell];
+ return old;
+}
+