]>
git.saurik.com Git - wxWidgets.git/blob - src/osx/bmpbuttn_osx.cpp
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: src/osx/bmpbuttn_osx.cpp
3 // Purpose: wxBitmapButton
4 // Author: Stefan Csomor
7 // RCS-ID: $Id: bmpbuttn.cpp 54820 2008-07-29 20:04:11Z SC $
8 // Copyright: (c) Stefan Csomor
9 // Licence: wxWindows licence
10 /////////////////////////////////////////////////////////////////////////////
12 #include "wx/wxprec.h"
16 #include "wx/bmpbuttn.h"
20 #include "wx/dcmemory.h"
23 IMPLEMENT_DYNAMIC_CLASS(wxBitmapButton
, wxButton
)
25 #include "wx/osx/private.h"
27 //---------------------------------------------------------------------------
29 bool wxBitmapButton::Create( wxWindow
*parent
,
30 wxWindowID id
, const wxBitmap
& bitmap
,
34 const wxValidator
& validator
,
35 const wxString
& name
)
37 m_macIsUserPane
= false;
39 // since bitmapbuttonbase is subclass of button calling wxBitmapButtonBase::Create
40 // essentially creates an additional button
41 if ( !wxControl::Create( parent
, id
, pos
, size
, style
, validator
, name
) )
44 if ( style
& wxBU_AUTODRAW
)
47 m_marginY
= wxDEFAULT_BUTTON_MARGIN
;
57 m_peer
= wxWidgetImpl::CreateBitmapButton( this, parent
, id
, bitmap
, pos
, size
, style
, GetExtraStyle() );
59 MacPostControlCreate( pos
, size
);
64 void wxBitmapButton::SetBitmapLabel( const wxBitmap
& bitmap
)
68 m_peer
->SetBitmap( bitmap
);
71 wxSize
wxBitmapButton::DoGetBestSize() const
75 best
.x
= 2 * m_marginX
;
76 best
.y
= 2 * m_marginY
;
77 if ( m_bmpNormal
.Ok() )
79 best
.x
+= m_bmpNormal
.GetWidth();
80 best
.y
+= m_bmpNormal
.GetHeight();