// Created: 08.02.01
// RCS-ID: $Id: tglbtn.cpp 54129 2008-06-11 19:30:52Z SC $
// Copyright: (c) Stefan Csomor
-// License: wxWindows license
+// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
// ============================================================================
#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
const wxString& name)
{
m_macIsUserPane = FALSE ;
-
+
if ( !wxControl::Create(parent, id, pos, size, style, validator, name) )
return false;
-
+
m_labelOrig = m_label = label ;
m_peer = wxWidgetImpl::CreateToggleButton( this, parent, id, label, pos, size, style, GetExtraStyle() ) ;
MacPostControlCreate(pos,size) ;
-
+
return TRUE;
}
wxSize wxToggleButton::DoGetBestSize() const
{
- int wBtn = 70 ;
+ int wBtn = 70 ;
int hBtn = 20 ;
int lBtn = m_label.Length() * 8 + 12 ;
- if (lBtn > wBtn)
+ if (lBtn > wBtn)
wBtn = lBtn;
return wxSize ( wBtn , hBtn ) ;
ProcessCommand(event);
}
-bool wxToggleButton::HandleClicked( double timestampsec )
+bool wxToggleButton::OSXHandleClicked( double WXUNUSED(timestampsec) )
{
wxCommandEvent event(wxEVT_COMMAND_TOGGLEBUTTON_CLICKED, m_windowId);
event.SetInt(GetValue());
const wxString& name)
{
m_macIsUserPane = FALSE ;
-
+
m_bitmap = label;
-
+
m_marginX =
m_marginY = wxDEFAULT_BUTTON_MARGIN;
-
+
if ( !wxControl::Create(parent, id, pos, size, style, validator, name) )
return false;
-
+
m_peer = wxWidgetImpl::CreateBitmapToggleButton( this, parent, id, label, pos, size, style, GetExtraStyle() ) ;
MacPostControlCreate(pos,size) ;
-
+
return TRUE;
}
ProcessCommand(event);
}
-bool wxBitmapToggleButton::HandleClicked( double timestampsec )
+bool wxBitmapToggleButton::OSXHandleClicked( double WXUNUSED(timestampsec) )
{
wxCommandEvent event(wxEVT_COMMAND_TOGGLEBUTTON_CLICKED, m_windowId);
event.SetInt(GetValue());