Implement wxButton::SetDefault to call SetDefaultItem on the top-level window.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/branches/WX_2_8_BRANCH@48529 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
David Elliott
2007-09-03 17:17:35 +00:00
parent 1ebca144e6
commit aadb49f665
2 changed files with 12 additions and 0 deletions

View File

@@ -59,6 +59,7 @@ public:
wxString GetLabel() const; wxString GetLabel() const;
void SetLabel(const wxString& label); void SetLabel(const wxString& label);
wxSize DoGetBestSize() const; wxSize DoGetBestSize() const;
virtual void SetDefault();
}; };
#endif #endif

View File

@@ -15,6 +15,7 @@
#ifndef WX_PRECOMP #ifndef WX_PRECOMP
#include "wx/log.h" #include "wx/log.h"
#include "wx/toplevel.h"
#endif #endif
#include "wx/stockitem.h" #include "wx/stockitem.h"
@@ -105,6 +106,16 @@ wxSize wxButton::DoGetBestSize() const
return size; return size;
} }
void wxButton::SetDefault()
{
wxTopLevelWindow * const
tlw = wxDynamicCast(wxGetTopLevelParent(this), wxTopLevelWindow);
wxCHECK_RET( tlw != NULL, _T("button without top level window?") );
tlw->SetDefaultItem(this);
}
static NSRect MakeNSButtonDefaultRect() static NSRect MakeNSButtonDefaultRect()
{ {
// create at (10.0,10.0) with size 20.0x20.0 (just bogus values) // create at (10.0,10.0) with size 20.0x20.0 (just bogus values)