/////////////////////////////////////////////////////////////////////////////
-// Name: radiobut.cpp
+// Name: src/osx/radiobut.cpp
// Purpose: wxRadioButton
// Author: AUTHOR
// Modified by: JS Lair (99/11/15) adding the cyclic group notion for radiobox
// Created: ??/??/98
-// RCS-ID: $Id: radiobut.cpp 54129 2008-06-11 19:30:52Z SC $
+// RCS-ID: $Id$
// Copyright: (c) AUTHOR
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#include "wx/radiobut.h"
#include "wx/osx/private.h"
-IMPLEMENT_DYNAMIC_CLASS(wxRadioButton, wxControl)
-
-
bool wxRadioButton::Create( wxWindow *parent,
wxWindowID id,
const wxString& label,
long style,
const wxValidator& validator,
const wxString& name )
-{
- m_macIsUserPane = false;
-
+{
+ DontCreatePeer();
+
if ( !wxControl::Create( parent, id, pos, size, style, validator, name ) )
return false;
m_labelOrig = m_label = label;
- m_peer = wxWidgetImpl::CreateRadioButton( this, parent, id, label, pos, size, style, GetExtraStyle() );
+ SetPeer(wxWidgetImpl::CreateRadioButton( this, parent, id, label, pos, size, style, GetExtraStyle() ));
MacPostControlCreate( pos, size );
void wxRadioButton::SetValue(bool val)
{
wxRadioButton *cycle;
- if (m_peer->GetValue() == val)
+ if (GetPeer()->GetValue() == val)
return;
- m_peer->SetValue( val );
+ GetPeer()->SetValue( val );
if (val)
{
cycle = this->NextInCycle();
bool wxRadioButton::GetValue() const
{
- return m_peer->GetValue();
+ return GetPeer()->GetValue() != 0;
}
void wxRadioButton::Command(wxCommandEvent& event)
ProcessCommand( event );
}
-bool wxRadioButton::HandleClicked( double timestampsec )
+bool wxRadioButton::OSXHandleClicked( double WXUNUSED(timestampsec) )
{
- // if already set -> no action
- if (GetValue())
- return true;
+ if ( !GetPeer()->ButtonClickDidStateChange() )
+ {
+ // if already set -> no action
+ if (GetValue())
+ return true;
+ }
wxRadioButton *cycle;
cycle = this->NextInCycle();
SetValue( true );
- wxCommandEvent event2( wxEVT_COMMAND_RADIOBUTTON_SELECTED, m_windowId );
+ wxCommandEvent event2( wxEVT_RADIOBUTTON, m_windowId );
event2.SetEventObject( this );
event2.SetInt( true );
ProcessCommand( event2 );
}
void wxRadioButton::RemoveFromCycle()
-{
+{
if ((m_cycle == NULL) || (m_cycle == this))
return;