Ejemplo n.º 1
0
EventReturn RatingChoice::OnChoiceClick(EventParams &e) {
	// Unstick the other choices that weren't clicked.
	int total = TotalChoices();
	for (int i = 0; i < total; i++) {
		auto v = group_->GetViewByIndex(i);
		if (v != e.v) {
			static_cast<StickyChoice *>(v)->Release();
		} else {
			*value_ = i;
		}
	}

	EventParams e2;
	e2.v = e.v;
	e2.a = *value_;
	// Dispatch immediately (we're already on the UI thread as we're in an event handler).
	OnChoice.Dispatch(e2);
	return EVENT_DONE;
}