no changes, just removed apparently unneeded wxMacBitmapButton class
[wxWidgets.git] / src / osx / bmpbuttn_osx.cpp
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: src/osx/bmpbuttn_osx.cpp
3 // Purpose: wxBitmapButton
4 // Author: Stefan Csomor
5 // Modified by:
6 // Created: 1998-01-01
7 // RCS-ID: $Id: bmpbuttn.cpp 54820 2008-07-29 20:04:11Z SC $
8 // Copyright: (c) Stefan Csomor
9 // Licence: wxWindows licence
10 /////////////////////////////////////////////////////////////////////////////
11
12 #include "wx/wxprec.h"
13
14 #if wxUSE_BMPBUTTON
15
16 #include "wx/bmpbuttn.h"
17 #include "wx/image.h"
18
19 #ifndef WX_PRECOMP
20 #include "wx/dcmemory.h"
21 #endif
22
23 IMPLEMENT_DYNAMIC_CLASS(wxBitmapButton, wxButton)
24
25 #include "wx/osx/private.h"
26
27 //---------------------------------------------------------------------------
28
29 bool wxBitmapButton::Create( wxWindow *parent,
30 wxWindowID id,
31 const wxBitmap& bitmap,
32 const wxPoint& pos,
33 const wxSize& size,
34 long style,
35 const wxValidator& validator,
36 const wxString& name )
37 {
38 m_macIsUserPane = false;
39
40 if ( !wxControl::Create( parent, id, pos, size, style | wxBU_NOTEXT,
41 validator, name ) )
42 return false;
43
44 if ( style & wxBU_AUTODRAW )
45 {
46 m_marginX =
47 m_marginY = wxDEFAULT_BUTTON_MARGIN;
48 }
49 else
50 {
51 m_marginX =
52 m_marginY = 0;
53 }
54
55 m_bitmaps[State_Normal] = bitmap;
56
57 m_peer = wxWidgetImpl::CreateBitmapButton( this, parent, id, bitmap, pos, size, style, GetExtraStyle() );
58
59 MacPostControlCreate( pos, size );
60
61 return true;
62 }
63
64 void wxBitmapButton::SetBitmapLabel( const wxBitmap& bitmap )
65 {
66 InvalidateBestSize();
67
68 m_peer->SetBitmap( bitmap );
69 }
70
71 wxSize wxBitmapButton::DoGetBestSize() const
72 {
73 wxSize best(m_marginX, m_marginY);
74
75 best *= 2;
76
77 if ( GetBitmapLabel().IsOk() )
78 {
79 best += GetBitmapLabel().GetSize();
80 }
81
82 return best;
83 }
84
85 #endif // wxUSE_BMPBUTTON