]> git.saurik.com Git - wxWidgets.git/blame - src/mac/carbon/radiobut.cpp
stupid double declaration of GetClippingBox due to the bad (lack of) usage of wxCoord...
[wxWidgets.git] / src / mac / carbon / 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
18#if !USE_SHARED_LIBRARY
19IMPLEMENT_DYNAMIC_CLASS(wxRadioButton, wxControl)
20#endif
21
1dd52151
UJ
22#include <wx/mac/uma.h>
23
e9576ca5
SC
24bool wxRadioButton::Create(wxWindow *parent, wxWindowID id,
25 const wxString& label,
26 const wxPoint& pos,
27 const wxSize& size, long style,
28 const wxValidator& validator,
29 const wxString& name)
30{
1dd52151
UJ
31 Rect bounds ;
32 Str255 title ;
33
34 m_cycle=NULL;
35
36 MacPreControlCreate( parent , id , label , pos , size ,style, validator , name , &bounds , title ) ;
e9576ca5 37
1dd52151
UJ
38 m_macControl = UMANewControl( parent->GetMacRootWindow() , &bounds , title , true , 0 , 0 , 1,
39 kControlRadioButtonProc , (long) this ) ;
40
41 MacPostControlCreate() ;
e9576ca5 42
1dd52151 43 return TRUE;
e9576ca5
SC
44}
45
1dd52151 46void wxRadioButton::SetValue(bool val)
e9576ca5 47{
1dd52151
UJ
48 int i;
49 wxRadioButton *cycle;
50
51 ::SetControlValue( m_macControl , val ) ;
52
53 if (val) {
54 cycle=this->NextInCycle();
55 if (cycle!=NULL) {
56 while (cycle!=this) {
57 cycle->SetValue(false);
58 cycle=cycle->NextInCycle();
59 }
60 }
61 }
e9576ca5
SC
62}
63
e9576ca5
SC
64bool wxRadioButton::GetValue() const
65{
1dd52151 66 return ::GetControlValue( m_macControl ) ;
e9576ca5
SC
67}
68
69void wxRadioButton::Command (wxCommandEvent & event)
70{
1dd52151 71 SetValue ( (event.GetInt() != 0) );
e9576ca5
SC
72 ProcessCommand (event);
73}
74
1dd52151
UJ
75void wxRadioButton::MacHandleControlClick( ControlHandle control , SInt16 controlpart )
76{
77 SetValue(true) ;
78}
79
80wxRadioButton *wxRadioButton::AddInCycle(wxRadioButton *cycle)
81{
82 wxRadioButton *next,*current;
83
84 if (cycle==NULL) {
85 m_cycle=this;
86 return(this);
87 }
88 else {
89 current=cycle;
90 while ((next=current->m_cycle)!=cycle) current=current->m_cycle;
91 m_cycle=cycle;
92 current->m_cycle=this;
93 return(cycle);
94 }
95}
e9576ca5 96