]>
git.saurik.com Git - wxWidgets.git/blob - src/osx/anybutton_osx.cpp
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: src/osx/anybutton_osx.cpp
3 // Purpose: wxAnyButton
4 // Author: Stefan Csomor
5 // Created: 1998-01-01 (extracted from button_osx.cpp)
6 // RCS-ID: $Id: anybutton_osx.cpp 67280 2011-03-22 14:17:38Z DS $
7 // Copyright: (c) Stefan Csomor
8 // Licence: wxWindows licence
9 /////////////////////////////////////////////////////////////////////////////
11 #include "wx/wxprec.h"
13 #include "wx/anybutton.h"
17 #include "wx/toplevel.h"
18 #include "wx/dcclient.h"
19 #include "wx/stattext.h"
22 #include "wx/stockitem.h"
24 #include "wx/osx/private.h"
26 BEGIN_EVENT_TABLE(wxAnyButton
, wxControl
)
27 EVT_ENTER_WINDOW(wxAnyButton::OnEnterWindow
)
28 EVT_LEAVE_WINDOW(wxAnyButton::OnLeaveWindow
)
31 void wxAnyButton::SetLabel(const wxString
& label
)
33 if ( HasFlag(wxBU_NOTEXT
) )
35 // just store the label internally but don't really use it for the
42 wxAnyButtonBase::SetLabel(label
);
45 wxBitmap
wxAnyButton::DoGetBitmap(State which
) const
47 return m_bitmaps
[which
];
50 void wxAnyButton::DoSetBitmap(const wxBitmap
& bitmap
, State which
)
52 m_bitmaps
[which
] = bitmap
;
54 if ( which
== State_Normal
)
55 GetPeer()->SetBitmap(bitmap
);
56 else if ( which
== State_Pressed
)
58 wxButtonImpl
* bi
= dynamic_cast<wxButtonImpl
*> (GetPeer());
60 bi
->SetPressedBitmap(bitmap
);
65 void wxAnyButton::DoSetBitmapPosition(wxDirection dir
)
67 GetPeer()->SetBitmapPosition(dir
);
71 #if wxUSE_MARKUP && wxOSX_USE_COCOA
73 bool wxAnyButton::DoSetLabelMarkup(const wxString
& markup
)
75 if ( !wxAnyButtonBase::DoSetLabelMarkup(markup
) )
78 GetPeer()->SetLabelMarkup(markup
);
83 #endif // wxUSE_MARKUP && wxOSX_USE_COCOA
85 void wxAnyButton::OnEnterWindow( wxMouseEvent
& WXUNUSED(event
))
87 if ( DoGetBitmap( State_Current
).IsOk() )
88 GetPeer()->SetBitmap( DoGetBitmap( State_Current
) );
91 void wxAnyButton::OnLeaveWindow( wxMouseEvent
& WXUNUSED(event
))
93 if ( DoGetBitmap( State_Current
).IsOk() )
94 GetPeer()->SetBitmap( DoGetBitmap( State_Normal
) );