]> git.saurik.com Git - wxWidgets.git/blame - src/osx/bmpbuttn_osx.cpp
fix for GTK assert after r72696, a draw/expose_event signal may also be attached...
[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
b5b208a1 7// RCS-ID: $Id$
e53b3d16
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
e53b3d16
SC
23#include "wx/osx/private.h"
24
25//---------------------------------------------------------------------------
26
27bool wxBitmapButton::Create( wxWindow *parent,
2352862a
VZ
28 wxWindowID id,
29 const wxBitmap& bitmap,
e53b3d16
SC
30 const wxPoint& pos,
31 const wxSize& size,
32 long style,
33 const wxValidator& validator,
34 const wxString& name )
35{
d15694e8
SC
36 DontCreatePeer();
37
8e4c2912
VZ
38 if ( !wxBitmapButtonBase::Create(parent, id, pos, size, style,
39 validator, name) )
e53b3d16
SC
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
2352862a 53 m_bitmaps[State_Normal] = bitmap;
e53b3d16 54
22756322 55 SetPeer(wxWidgetImpl::CreateBitmapButton( this, parent, id, bitmap, pos, size, style, GetExtraStyle() ));
e53b3d16
SC
56
57 MacPostControlCreate( pos, size );
58
59 return true;
60}
61
e53b3d16
SC
62wxSize wxBitmapButton::DoGetBestSize() const
63{
2352862a 64 wxSize best(m_marginX, m_marginY);
e53b3d16 65
2352862a
VZ
66 best *= 2;
67
68 if ( GetBitmapLabel().IsOk() )
e53b3d16 69 {
2352862a 70 best += GetBitmapLabel().GetSize();
e53b3d16
SC
71 }
72
73 return best;
74}
75
2352862a 76#endif // wxUSE_BMPBUTTON