]> git.saurik.com Git - wxWidgets.git/blame - src/osx/bmpbuttn_osx.cpp
Let wxMSW report wxDataViewCustomRenderer::LeftClick() report the click position...
[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
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
23IMPLEMENT_DYNAMIC_CLASS(wxBitmapButton, wxButton)
24
411a1c35 25
e53b3d16
SC
26#include "wx/osx/private.h"
27
28//---------------------------------------------------------------------------
29
30bool wxBitmapButton::Create( wxWindow *parent,
2352862a
VZ
31 wxWindowID id,
32 const wxBitmap& bitmap,
e53b3d16
SC
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
8e4c2912
VZ
41 if ( !wxBitmapButtonBase::Create(parent, id, pos, size, style,
42 validator, name) )
e53b3d16
SC
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
2352862a 56 m_bitmaps[State_Normal] = bitmap;
e53b3d16
SC
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
e53b3d16
SC
65wxSize wxBitmapButton::DoGetBestSize() const
66{
2352862a 67 wxSize best(m_marginX, m_marginY);
e53b3d16 68
2352862a
VZ
69 best *= 2;
70
71 if ( GetBitmapLabel().IsOk() )
e53b3d16 72 {
2352862a 73 best += GetBitmapLabel().GetSize();
e53b3d16
SC
74 }
75
76 return best;
77}
78
2352862a 79#endif // wxUSE_BMPBUTTON