]> git.saurik.com Git - wxWidgets.git/blob - src/osx/bmpbuttn_osx.cpp
Add wxTextCtrl::PositionToCoords() functions for wxMSW and wxGTK.
[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$
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 #include "wx/osx/private.h"
24
25 //---------------------------------------------------------------------------
26
27 bool wxBitmapButton::Create( wxWindow *parent,
28 wxWindowID id,
29 const wxBitmap& bitmap,
30 const wxPoint& pos,
31 const wxSize& size,
32 long style,
33 const wxValidator& validator,
34 const wxString& name )
35 {
36 DontCreatePeer();
37
38 if ( !wxBitmapButtonBase::Create(parent, id, pos, size, style,
39 validator, name) )
40 return false;
41
42 if ( style & wxBU_AUTODRAW )
43 {
44 m_marginX =
45 m_marginY = wxDEFAULT_BUTTON_MARGIN;
46 }
47 else
48 {
49 m_marginX =
50 m_marginY = 0;
51 }
52
53 m_bitmaps[State_Normal] = bitmap;
54
55 SetPeer(wxWidgetImpl::CreateBitmapButton( this, parent, id, bitmap, pos, size, style, GetExtraStyle() ));
56
57 MacPostControlCreate( pos, size );
58
59 return true;
60 }
61
62 wxSize wxBitmapButton::DoGetBestSize() const
63 {
64 wxSize best(m_marginX, m_marginY);
65
66 best *= 2;
67
68 if ( GetBitmapLabel().IsOk() )
69 {
70 best += GetBitmapLabel().GetSize();
71 }
72
73 return best;
74 }
75
76 #endif // wxUSE_BMPBUTTON