]> git.saurik.com Git - wxWidgets.git/blobdiff - src/common/btncmn.cpp
Call wxTLW::SetDefaultItem() from wxButtonBase::SetDefault() instead of doing
[wxWidgets.git] / src / common / btncmn.cpp
diff --git a/src/common/btncmn.cpp b/src/common/btncmn.cpp
new file mode 100644 (file)
index 0000000..92e8103
--- /dev/null
@@ -0,0 +1,44 @@
+///////////////////////////////////////////////////////////////////////////////
+// Name:        src/common/btncmn.cpp
+// Purpose:     implementation of wxButtonBase
+// Author:      Vadim Zeitlin
+// Created:     2007-04-08
+// RCS-ID:      $Id$
+// Copyright:   (c) 2007 Vadim Zeitlin <vadim@wxwindows.org>
+// Licence:     wxWindows licence
+///////////////////////////////////////////////////////////////////////////////
+
+// ============================================================================
+// declarations
+// ============================================================================
+
+// ----------------------------------------------------------------------------
+// headers
+// ----------------------------------------------------------------------------
+
+// for compilers that support precompilation, includes "wx.h".
+#include "wx/wxprec.h"
+
+#ifdef __BORLANDC__
+    #pragma hdrstop
+#endif
+
+#ifndef WX_PRECOMP
+    #include "wx/button.h"
+    #include "wx/toplevel.h"
+#endif //WX_PRECOMP
+
+// ============================================================================
+// implementation
+// ============================================================================
+
+wxWindow *wxButtonBase::SetDefault()
+{
+    wxTopLevelWindow * const
+        tlw = wxDynamicCast(wxGetTopLevelParent(this), wxTopLevelWindow);
+
+    wxCHECK_MSG( tlw, NULL, _T("button without top level window?") );
+
+    return tlw->SetDefaultItem(this);
+}
+