X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/a756f210019dd5b51331b7181c816d3882146a30..81c9effa8462662263c3b4eac2cfae1ef5caae2c:/src/msw/button.cpp?ds=sidebyside diff --git a/src/msw/button.cpp b/src/msw/button.cpp index 62da82af8e..5cb83273d7 100644 --- a/src/msw/button.cpp +++ b/src/msw/button.cpp @@ -68,66 +68,47 @@ bool wxButton::Create(wxWindow *parent, const wxValidator& validator, const wxString& name) { - if ( !CreateBase(parent, id, pos, size, style, validator, name) ) + if ( !CreateControl(parent, id, pos, size, style, validator, name) ) return FALSE; - parent->AddChild((wxButton *)this); + return MSWCreateControl(_T("BUTTON"), label, pos, size, style); +} - m_backgroundColour = parent->GetBackgroundColour(); - m_foregroundColour = parent->GetForegroundColour(); +wxButton::~wxButton() +{ +} - long msStyle = WS_VISIBLE | WS_TABSTOP | WS_CHILD /* | WS_CLIPSIBLINGS */ ; +// ---------------------------------------------------------------------------- +// flags +// ---------------------------------------------------------------------------- - if ( m_windowStyle & wxCLIP_SIBLINGS ) - msStyle |= WS_CLIPSIBLINGS; +WXDWORD wxButton::MSWGetStyle(long style, WXDWORD *exstyle) const +{ + // buttons never have an external border, they draw their own one + WXDWORD msStyle = wxControl::MSWGetStyle + ( + (style & ~wxBORDER_MASK) | wxBORDER_NONE, exstyle + ); + + // we must use WS_CLIPSIBLINGS with the buttons or they would draw over + // each other in any resizeable dialog which has more than one button in + // the bottom + msStyle |= WS_CLIPSIBLINGS; #ifdef __WIN32__ - if(m_windowStyle & wxBU_LEFT) + // don't use "else if" here: weird as it is, but you may combine wxBU_LEFT + // and wxBU_RIGHT to get BS_CENTER! + if ( style & wxBU_LEFT ) msStyle |= BS_LEFT; - if(m_windowStyle & wxBU_RIGHT) + if ( style & wxBU_RIGHT ) msStyle |= BS_RIGHT; - if(m_windowStyle & wxBU_TOP) + if ( style & wxBU_TOP ) msStyle |= BS_TOP; - if(m_windowStyle & wxBU_BOTTOM) + if ( style & wxBU_BOTTOM ) msStyle |= BS_BOTTOM; -#endif - - m_hWnd = (WXHWND)CreateWindowEx - ( - MakeExtendedStyle(m_windowStyle), - wxT("BUTTON"), - label, - msStyle, - 0, 0, 0, 0, - GetWinHwnd(parent), - (HMENU)m_windowId, - wxGetInstance(), - NULL - ); - - if (m_hWnd == 0) - { - wxString msg; -#ifdef __WIN16__ - msg.Printf(wxT("CreateWindowEx failed")); -#else - msg.Printf(wxT("CreateWindowEx failed with error number %ld"), (long) GetLastError()); -#endif - wxFAIL_MSG(msg); - } - - // Subclass again for purposes of dialog editing mode - SubclassWin(m_hWnd); - - SetFont(parent->GetFont()); - - SetSize(pos.x, pos.y, size.x, size.y); - - return TRUE; -} +#endif // __WIN32__ -wxButton::~wxButton() -{ + return msStyle; } // ----------------------------------------------------------------------------