X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/f6bcfd974ef26faf6f91a62cac09827e09463fd1..038072e2f1eaf2bf32d748a71234d767ebba8919:/src/msw/button.cpp diff --git a/src/msw/button.cpp b/src/msw/button.cpp index d58fda1ac6..24d5340b6e 100644 --- a/src/msw/button.cpp +++ b/src/msw/button.cpp @@ -28,6 +28,8 @@ #pragma hdrstop #endif +#if wxUSE_BUTTON + #ifndef WX_PRECOMP #include "wx/button.h" #include "wx/brush.h" @@ -76,6 +78,9 @@ bool wxButton::Create(wxWindow *parent, 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; @@ -123,15 +128,6 @@ bool wxButton::Create(wxWindow *parent, 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); - } - } } // ---------------------------------------------------------------------------- @@ -161,7 +157,7 @@ wxSize wxButton::DoGetBestSize() const } /* static */ -wxSize wxButton::GetDefaultSize() +wxSize wxButtonBase::GetDefaultSize() { static wxSize s_sizeBtn; @@ -192,20 +188,20 @@ wxSize wxButton::GetDefaultSize() 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); @@ -255,7 +251,7 @@ void wxButton::Command(wxCommandEvent & event) // event/message handlers // ---------------------------------------------------------------------------- -bool wxButton::MSWCommand(WXUINT param, WXWORD id) +bool wxButton::MSWCommand(WXUINT param, WXWORD WXUNUSED(id)) { bool processed = FALSE; switch ( param ) @@ -524,3 +520,6 @@ bool wxButton::MSWOnDraw(WXDRAWITEMSTRUCT *wxdis) } #endif // __WIN32__ + +#endif // wxUSE_BUTTON +