]>
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
,
31 const wxBitmap
& bitmap
,
35 const wxValidator
& validator
,
36 const wxString
& name
)
38 m_macIsUserPane
= false;
40 if ( !wxBitmapButtonBase::Create(parent
, id
, pos
, size
, style
,
44 if ( style
& wxBU_AUTODRAW
)
47 m_marginY
= wxDEFAULT_BUTTON_MARGIN
;
55 m_bitmaps
[State_Normal
] = bitmap
;
57 m_peer
= wxWidgetImpl::CreateBitmapButton( this, parent
, id
, bitmap
, pos
, size
, style
, GetExtraStyle() );
59 MacPostControlCreate( pos
, size
);
64 void wxBitmapButton::DoSetBitmap(const wxBitmap
& bitmap
, State which
)
66 wxBitmapButtonBase::DoSetBitmap(bitmap
, which
);
68 // we don't support any other states currently
69 if ( which
== State_Normal
)
71 m_peer
->SetBitmap( bitmap
);
75 wxSize
wxBitmapButton::DoGetBestSize() const
77 wxSize
best(m_marginX
, m_marginY
);
81 if ( GetBitmapLabel().IsOk() )
83 best
+= GetBitmapLabel().GetSize();
89 #endif // wxUSE_BMPBUTTON