]> git.saurik.com Git - wxWidgets.git/blame_incremental - src/osx/bmpbuttn_osx.cpp
Applied #15375 to stop event-sending in generic wxSpinCtrl ctor (eco)
[wxWidgets.git] / src / osx / bmpbuttn_osx.cpp
... / ...
CommitLineData
1/////////////////////////////////////////////////////////////////////////////
2// Name: src/osx/bmpbuttn_osx.cpp
3// Purpose: wxBitmapButton
4// Author: Stefan Csomor
5// Modified by:
6// Created: 1998-01-01
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
22#include "wx/osx/private.h"
23
24//---------------------------------------------------------------------------
25
26bool wxBitmapButton::Create( wxWindow *parent,
27 wxWindowID id,
28 const wxBitmap& bitmap,
29 const wxPoint& pos,
30 const wxSize& size,
31 long style,
32 const wxValidator& validator,
33 const wxString& name )
34{
35 DontCreatePeer();
36
37 if ( !wxBitmapButtonBase::Create(parent, id, pos, size, style,
38 validator, name) )
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
52 m_bitmaps[State_Normal] = bitmap;
53
54 SetPeer(wxWidgetImpl::CreateBitmapButton( this, parent, id, bitmap, pos, size, style, GetExtraStyle() ));
55
56 MacPostControlCreate( pos, size );
57
58 return true;
59}
60
61wxSize wxBitmapButton::DoGetBestSize() const
62{
63 wxSize best(m_marginX, m_marginY);
64
65 best *= 2;
66
67 if ( GetBitmapLabel().IsOk() )
68 {
69 best += GetBitmapLabel().GetSize();
70 }
71
72 return best;
73}
74
75#endif // wxUSE_BMPBUTTON