- SetValue( !GetValue() ) ;
- wxCommandEvent event(wxEVT_COMMAND_CHECKBOX_CLICKED, m_windowId );
- event.SetInt(GetValue());
- event.SetEventObject(this);
- ProcessCommand(event);
+ return (wxCheckBoxState)m_peer->GetValue() ;
+}
+
+void wxCheckBox::DoSet3StateValue(wxCheckBoxState val)
+{
+ m_peer->SetValue( val ) ;
+}
+
+wxInt32 wxCheckBox::MacControlHit( WXEVENTHANDLERREF WXUNUSED(handler) , WXEVENTREF WXUNUSED(event) )
+{
+ wxCheckBoxState origState, newState;
+
+ newState = origState = Get3StateValue();
+
+ switch (origState)
+ {
+ case wxCHK_UNCHECKED:
+ newState = wxCHK_CHECKED;
+ break;
+
+ case wxCHK_CHECKED:
+ // If the style flag to allow the user setting the undetermined state is set,
+ // then set the state to undetermined; otherwise set state to unchecked.
+ newState = Is3rdStateAllowedForUser() ? wxCHK_UNDETERMINED : wxCHK_UNCHECKED;
+ break;
+
+ case wxCHK_UNDETERMINED:
+ newState = wxCHK_UNCHECKED;
+ break;
+
+ default:
+ break;
+ }
+
+ if (newState != origState)
+ {
+ Set3StateValue( newState );
+
+ wxCommandEvent event( wxEVT_COMMAND_CHECKBOX_CLICKED, m_windowId );
+ event.SetInt( newState );
+ event.SetEventObject( this );
+ ProcessCommand( event );
+ }
+
+ return noErr;