allow checkboxes to be force-toggled

This commit is contained in:
Siddharth 2013-10-27 10:58:16 +05:30
parent 37cd71b2a4
commit 4ebb62aa98
2 changed files with 7 additions and 2 deletions

View File

@ -383,9 +383,13 @@ void PopupHeader::Draw(UIContext &dc) {
dc.Draw()->DrawImageStretch(dc.theme->whiteImage, bounds_.x, bounds_.y2()-2, bounds_.x2(), bounds_.y2(), dc.theme->popupTitle.fgColor);
}
EventReturn CheckBox::OnClicked(EventParams &e) {
void CheckBox::Toggle(){
if (toggle_)
*toggle_ = !(*toggle_);
};
EventReturn CheckBox::OnClicked(EventParams &e) {
Toggle();
return EVENT_CONTINUE; // It's safe to keep processing events.
}

View File

@ -600,7 +600,8 @@ public:
virtual void Draw(UIContext &dc);
EventReturn OnClicked(EventParams &e);
//allow external agents to toggle the checkbox
void Toggle();
private:
bool *toggle_;
std::string text_;