#pragma hdrstop
#endif
+#if wxUSE_BUTTON
+
#ifndef WX_PRECOMP
#include "wx/button.h"
#include "wx/brush.h"
long msStyle = WS_VISIBLE | WS_TABSTOP | WS_CHILD /* | WS_CLIPSIBLINGS */ ;
+ if ( m_windowStyle & wxCLIP_SIBLINGS )
+ msStyle |= WS_CLIPSIBLINGS;
+
#ifdef __WIN32__
if(m_windowStyle & wxBU_LEFT)
msStyle |= BS_LEFT;
wxButton::~wxButton()
{
- wxPanel *panel = wxDynamicCast(GetParent(), wxPanel);
- if ( panel )
- {
- if ( panel->GetDefaultItem() == this )
- {
- // don't leave the panel with invalid default item
- panel->SetDefaultItem(NULL);
- }
- }
}
// ----------------------------------------------------------------------------
}
/* static */
-wxSize wxButton::GetDefaultSize()
+wxSize wxButtonBase::GetDefaultSize()
{
static wxSize s_sizeBtn;
void wxButton::SetDefault()
{
wxWindow *parent = GetParent();
- wxButton *btnOldDefault = NULL;
- wxPanel *panel = wxDynamicCast(parent, wxPanel);
- if ( panel )
+ wxButton *btnOldDefault;
+ if ( parent )
{
- btnOldDefault = panel->GetDefaultItem();
- panel->SetDefaultItem(this);
- }
+ wxWindow *winOldDefault = parent->SetDefaultItem(this);
+ btnOldDefault = wxDynamicCast(winOldDefault, wxButton);
- if ( parent )
+ ::SendMessage(GetWinHwnd(parent), DM_SETDEFID, m_windowId, 0L);
+ }
+ else // is a button without parent really normal?
{
- SendMessage(GetWinHwnd(parent), DM_SETDEFID, m_windowId, 0L);
+ btnOldDefault = NULL;
}
- if ( btnOldDefault )
+ if ( btnOldDefault && btnOldDefault != this )
{
// remove the BS_DEFPUSHBUTTON style from the other button
long style = GetWindowLong(GetHwndOf(btnOldDefault), GWL_STYLE);
}
#endif // __WIN32__
+
+#endif // wxUSE_BUTTON
+