]> git.saurik.com Git - wxWidgets.git/blame - src/mac/radiobut.cpp
wxFileSystem now compiles if wxUSE_HTML (required by wxHTML)
[wxWidgets.git] / src / mac / radiobut.cpp
CommitLineData
e9576ca5
SC
1/////////////////////////////////////////////////////////////////////////////
2// Name: radiobut.cpp
3// Purpose: wxRadioButton
4// Author: AUTHOR
1dd52151 5// Modified by: JS Lair (99/11/15) adding the cyclic groupe notion for radiobox
e9576ca5
SC
6// Created: ??/??/98
7// RCS-ID: $Id$
8// Copyright: (c) AUTHOR
9// Licence: wxWindows licence
10/////////////////////////////////////////////////////////////////////////////
11
12#ifdef __GNUG__
13#pragma implementation "radiobut.h"
14#endif
15
16#include "wx/radiobut.h"
17
e9576ca5 18IMPLEMENT_DYNAMIC_CLASS(wxRadioButton, wxControl)
e9576ca5 19
1dd52151
UJ
20#include <wx/mac/uma.h>
21
e9576ca5
SC
22bool wxRadioButton::Create(wxWindow *parent, wxWindowID id,
23 const wxString& label,
24 const wxPoint& pos,
25 const wxSize& size, long style,
26 const wxValidator& validator,
27 const wxString& name)
28{
1dd52151
UJ
29 Rect bounds ;
30 Str255 title ;
31
32 m_cycle=NULL;
33
34 MacPreControlCreate( parent , id , label , pos , size ,style, validator , name , &bounds , title ) ;
e9576ca5 35
1dd52151
UJ
36 m_macControl = UMANewControl( parent->GetMacRootWindow() , &bounds , title , true , 0 , 0 , 1,
37 kControlRadioButtonProc , (long) this ) ;
38
39 MacPostControlCreate() ;
e9576ca5 40
1dd52151 41 return TRUE;
e9576ca5
SC
42}
43
1dd52151 44void wxRadioButton::SetValue(bool val)
e9576ca5 45{
1dd52151
UJ
46 int i;
47 wxRadioButton *cycle;
48
49 ::SetControlValue( m_macControl , val ) ;
50
51 if (val) {
52 cycle=this->NextInCycle();
53 if (cycle!=NULL) {
54 while (cycle!=this) {
55 cycle->SetValue(false);
56 cycle=cycle->NextInCycle();
57 }
58 }
59 }
e9576ca5
SC
60}
61
e9576ca5
SC
62bool wxRadioButton::GetValue() const
63{
1dd52151 64 return ::GetControlValue( m_macControl ) ;
e9576ca5
SC
65}
66
67void wxRadioButton::Command (wxCommandEvent & event)
68{
1dd52151 69 SetValue ( (event.GetInt() != 0) );
e9576ca5
SC
70 ProcessCommand (event);
71}
72
1dd52151
UJ
73void wxRadioButton::MacHandleControlClick( ControlHandle control , SInt16 controlpart )
74{
75 SetValue(true) ;
76}
77
78wxRadioButton *wxRadioButton::AddInCycle(wxRadioButton *cycle)
79{
80 wxRadioButton *next,*current;
81
82 if (cycle==NULL) {
83 m_cycle=this;
84 return(this);
85 }
86 else {
87 current=cycle;
88 while ((next=current->m_cycle)!=cycle) current=current->m_cycle;
89 m_cycle=cycle;
90 current->m_cycle=this;
91 return(cycle);
92 }
93}
e9576ca5 94