Implement GetValue() and SetValue() and send an event when clicked
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@22995 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -53,17 +53,27 @@ wxCheckBox::~wxCheckBox()
|
|||||||
DisassociateNSButton(m_cocoaNSView);
|
DisassociateNSButton(m_cocoaNSView);
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxCheckBox::SetValue(bool)
|
void wxCheckBox::SetValue(bool value)
|
||||||
{
|
{
|
||||||
|
if(value)
|
||||||
|
[GetNSButton() setState: NSOnState];
|
||||||
|
else
|
||||||
|
[GetNSButton() setState: NSOffState];
|
||||||
}
|
}
|
||||||
|
|
||||||
bool wxCheckBox::GetValue() const
|
bool wxCheckBox::GetValue() const
|
||||||
{
|
{
|
||||||
return false;
|
int state = [GetNSButton() state];
|
||||||
|
wxASSERT(state!=NSMixedState);
|
||||||
|
return state==NSOnState;
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxCheckBox::Cocoa_wxNSButtonAction(void)
|
void wxCheckBox::Cocoa_wxNSButtonAction(void)
|
||||||
{
|
{
|
||||||
wxLogDebug("Checkbox");
|
wxLogDebug("Checkbox");
|
||||||
|
wxCommandEvent event(wxEVT_COMMAND_CHECKBOX_CLICKED, GetId());
|
||||||
|
InitCommandEvent(event); // event.SetEventObject(this);
|
||||||
|
event.SetInt(GetValue());
|
||||||
|
Command(event);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user