X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/655719367ac5e131d9642e5783f3ecf64d1a3385..23f4f495a5f91414c633ccc27a137901d61b923f:/src/mac/classic/bmpbuttn.cpp?ds=sidebyside diff --git a/src/mac/classic/bmpbuttn.cpp b/src/mac/classic/bmpbuttn.cpp index f6ce4dd00c..be7783beb6 100644 --- a/src/mac/classic/bmpbuttn.cpp +++ b/src/mac/classic/bmpbuttn.cpp @@ -1,25 +1,26 @@ ///////////////////////////////////////////////////////////////////////////// -// Name: bmpbuttn.cpp +// Name: src/mac/classic/bmpbuttn.cpp // Purpose: wxBitmapButton // Author: Stefan Csomor // Modified by: // Created: 1998-01-01 // RCS-ID: $Id$ // Copyright: (c) Stefan Csomor -// Licence: wxWindows licence +// Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// -#ifdef __GNUG__ -#pragma implementation "bmpbuttn.h" -#endif +#include "wx/wxprec.h" + +#if wxUSE_BMPBUTTON -#include "wx/window.h" #include "wx/bmpbuttn.h" -#if !USE_SHARED_LIBRARY -IMPLEMENT_DYNAMIC_CLASS(wxBitmapButton, wxButton) +#ifndef WX_PRECOMP + #include "wx/window.h" #endif +IMPLEMENT_DYNAMIC_CLASS(wxBitmapButton, wxButton) + #include "wx/mac/uma.h" #include "wx/bitmap.h" @@ -36,7 +37,7 @@ bool wxBitmapButton::Create(wxWindow *parent, wxWindowID id, const wxBitmap& bit return false; m_bmpNormal = bitmap; - + if (style & wxBU_AUTODRAW) { m_marginX = wxDEFAULT_BUTTON_MARGIN; @@ -64,19 +65,19 @@ bool wxBitmapButton::Create(wxWindow *parent, wxWindowID id, const wxBitmap& bit Str255 title ; m_bmpNormal = bitmap; wxBitmapRefData * bmap = NULL ; - + if ( m_bmpNormal.Ok() ) bmap = (wxBitmapRefData*) ( m_bmpNormal.GetRefData()) ; - + MacPreControlCreate( parent , id , wxEmptyString , pos , wxSize( width , height ) ,style, validator , name , &bounds , title ) ; - m_macControl = ::NewControl( MAC_WXHWND(parent->MacGetRootWindow()) , &bounds , title , false , 0 , - kControlBehaviorOffsetContents + - ( bmap && bmap->m_bitmapType == kMacBitmapTypeIcon ? - kControlContentCIconHandle : kControlContentPictHandle ) , 0, + m_macControl = (WXWidget) ::NewControl( MAC_WXHWND(parent->MacGetRootWindow()) , &bounds , title , false , 0 , + kControlBehaviorOffsetContents + + ( bmap && bmap->m_bitmapType == kMacBitmapTypeIcon ? + kControlContentCIconHandle : kControlContentPictHandle ) , 0, (( style & wxBU_AUTODRAW ) ? kControlBevelButtonSmallBevelProc : kControlBevelButtonNormalBevelProc ), (long) this ) ; wxASSERT_MSG( (ControlHandle) m_macControl != NULL , wxT("No valid mac control") ) ; - + ControlButtonContentInfo info ; wxMacCreateBitmapButton( &info , m_bmpNormal ) ; if ( info.contentType != kControlNoContent ) @@ -85,12 +86,13 @@ bool wxBitmapButton::Create(wxWindow *parent, wxWindowID id, const wxBitmap& bit } MacPostControlCreate() ; - return TRUE; + return true; } void wxBitmapButton::SetBitmapLabel(const wxBitmap& bitmap) { m_bmpNormal = bitmap; + InvalidateBestSize(); ControlButtonContentInfo info ; wxMacCreateBitmapButton( &info , m_bmpNormal ) ; @@ -111,3 +113,5 @@ wxSize wxBitmapButton::DoGetBestSize() const } return best; } + +#endif // wxUSE_BMPBUTTON