]> git.saurik.com Git - wxWidgets.git/blame - src/osx/bmpbuttn_osx.cpp
Applied #15375 to stop event-sending in generic wxSpinCtrl ctor (eco)
[wxWidgets.git] / src / osx / bmpbuttn_osx.cpp
CommitLineData
e53b3d16
SC
1/////////////////////////////////////////////////////////////////////////////
2// Name: src/osx/bmpbuttn_osx.cpp
3// Purpose: wxBitmapButton
4// Author: Stefan Csomor
5// Modified by:
6// Created: 1998-01-01
e53b3d16
SC
7// Copyright: (c) Stefan Csomor
8// Licence: wxWindows licence
9/////////////////////////////////////////////////////////////////////////////
10
11#include "wx/wxprec.h"
12
13#if wxUSE_BMPBUTTON
14
15#include "wx/bmpbuttn.h"
16#include "wx/image.h"
17
18#ifndef WX_PRECOMP
19 #include "wx/dcmemory.h"
20#endif
21
e53b3d16
SC
22#include "wx/osx/private.h"
23
24//---------------------------------------------------------------------------
25
26bool wxBitmapButton::Create( wxWindow *parent,
2352862a
VZ
27 wxWindowID id,
28 const wxBitmap& bitmap,
e53b3d16
SC
29 const wxPoint& pos,
30 const wxSize& size,
31 long style,
32 const wxValidator& validator,
33 const wxString& name )
34{
d15694e8
SC
35 DontCreatePeer();
36
8e4c2912
VZ
37 if ( !wxBitmapButtonBase::Create(parent, id, pos, size, style,
38 validator, name) )
e53b3d16
SC
39 return false;
40
41 if ( style & wxBU_AUTODRAW )
42 {
43 m_marginX =
44 m_marginY = wxDEFAULT_BUTTON_MARGIN;
45 }
46 else
47 {
48 m_marginX =
49 m_marginY = 0;
50 }
51
2352862a 52 m_bitmaps[State_Normal] = bitmap;
e53b3d16 53
22756322 54 SetPeer(wxWidgetImpl::CreateBitmapButton( this, parent, id, bitmap, pos, size, style, GetExtraStyle() ));
e53b3d16
SC
55
56 MacPostControlCreate( pos, size );
57
58 return true;
59}
60
e53b3d16
SC
61wxSize wxBitmapButton::DoGetBestSize() const
62{
2352862a 63 wxSize best(m_marginX, m_marginY);
e53b3d16 64
2352862a
VZ
65 best *= 2;
66
67 if ( GetBitmapLabel().IsOk() )
e53b3d16 68 {
2352862a 69 best += GetBitmapLabel().GetSize();
e53b3d16
SC
70 }
71
72 return best;
73}
74
2352862a 75#endif // wxUSE_BMPBUTTON