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