#include "wx/tglbtn.h"
#include "wx/osx/private.h"
-// Button
+#include "wx/bmpbuttn.h" // for wxDEFAULT_BUTTON_MARGIN
// ----------------------------------------------------------------------------
// macros
// ----------------------------------------------------------------------------
IMPLEMENT_DYNAMIC_CLASS(wxToggleButton, wxControl)
-DEFINE_EVENT_TYPE(wxEVT_COMMAND_TOGGLEBUTTON_CLICKED)
+wxDEFINE_EVENT( wxEVT_COMMAND_TOGGLEBUTTON_CLICKED, wxCommandEvent );
// ============================================================================
// implementation
ProcessCommand(event);
}
-bool wxToggleButton::HandleClicked( double timestampsec )
+bool wxToggleButton::OSXHandleClicked( double timestampsec )
{
wxCommandEvent event(wxEVT_COMMAND_TOGGLEBUTTON_CLICKED, m_windowId);
event.SetInt(GetValue());
m_bitmap = label;
+ m_marginX =
+ m_marginY = wxDEFAULT_BUTTON_MARGIN;
+
if ( !wxControl::Create(parent, id, pos, size, style, validator, name) )
return false;
{
if (!m_bitmap.IsOk())
return wxSize(20,20);
-
- return wxSize ( m_bitmap.GetWidth()+6, m_bitmap.GetHeight()+6 ) ;
+
+ wxSize best;
+ best.x = m_bitmap.GetWidth() + 2 * m_marginX;
+ best.y = m_bitmap.GetHeight() + 2 * m_marginY;
+
+ return best;
}
void wxBitmapToggleButton::SetValue(bool val)
ProcessCommand(event);
}
-bool wxBitmapToggleButton::HandleClicked( double timestampsec )
+bool wxBitmapToggleButton::OSXHandleClicked( double timestampsec )
{
wxCommandEvent event(wxEVT_COMMAND_TOGGLEBUTTON_CLICKED, m_windowId);
event.SetInt(GetValue());