]>
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 // Copyright: (c) Stefan Csomor
7 // Licence: wxWindows licence
8 /////////////////////////////////////////////////////////////////////////////
10 #include "wx/wxprec.h"
12 #include "wx/anybutton.h"
16 #include "wx/toplevel.h"
17 #include "wx/dcclient.h"
18 #include "wx/stattext.h"
21 #include "wx/stockitem.h"
23 #include "wx/osx/private.h"
25 BEGIN_EVENT_TABLE(wxAnyButton
, wxControl
)
26 EVT_ENTER_WINDOW(wxAnyButton::OnEnterWindow
)
27 EVT_LEAVE_WINDOW(wxAnyButton::OnLeaveWindow
)
30 void wxAnyButton::SetLabel(const wxString
& label
)
32 if ( HasFlag(wxBU_NOTEXT
) )
34 // just store the label internally but don't really use it for the
41 wxAnyButtonBase::SetLabel(label
);
44 wxBitmap
wxAnyButton::DoGetBitmap(State which
) const
46 return m_bitmaps
[which
];
49 void wxAnyButton::DoSetBitmap(const wxBitmap
& bitmap
, State which
)
51 m_bitmaps
[which
] = bitmap
;
53 if ( which
== State_Normal
)
54 GetPeer()->SetBitmap(bitmap
);
55 else if ( which
== State_Pressed
)
57 wxButtonImpl
* bi
= dynamic_cast<wxButtonImpl
*> (GetPeer());
59 bi
->SetPressedBitmap(bitmap
);
64 void wxAnyButton::DoSetBitmapPosition(wxDirection dir
)
66 GetPeer()->SetBitmapPosition(dir
);
70 #if wxUSE_MARKUP && wxOSX_USE_COCOA
72 bool wxAnyButton::DoSetLabelMarkup(const wxString
& markup
)
74 if ( !wxAnyButtonBase::DoSetLabelMarkup(markup
) )
77 GetPeer()->SetLabelMarkup(markup
);
82 #endif // wxUSE_MARKUP && wxOSX_USE_COCOA
84 void wxAnyButton::OnEnterWindow( wxMouseEvent
& WXUNUSED(event
))
86 if ( DoGetBitmap( State_Current
).IsOk() )
87 GetPeer()->SetBitmap( DoGetBitmap( State_Current
) );
90 void wxAnyButton::OnLeaveWindow( wxMouseEvent
& WXUNUSED(event
))
92 if ( DoGetBitmap( State_Current
).IsOk() )
93 GetPeer()->SetBitmap( DoGetBitmap( State_Normal
) );