void Clickable::Touch(const TouchInput &input) { if (!IsEnabled()) { dragging_ = false; down_ = false; return; } if (input.flags & TOUCH_DOWN) { if (bounds_.Contains(input.x, input.y)) { if (IsFocusMovementEnabled()) SetFocusedView(this); dragging_ = true; down_ = true; } else { down_ = false; dragging_ = false; } } else if (input.flags & TOUCH_MOVE) { if (dragging_) down_ = bounds_.Contains(input.x, input.y); } if (input.flags & TOUCH_UP) { if ((input.flags & TOUCH_CANCEL) == 0 && dragging_ && bounds_.Contains(input.x, input.y)) { Click(); } down_ = false; downCountDown_ = 0; dragging_ = false; } }
bool View::SetFocus() { if (IsFocusMovementEnabled()) { if (CanBeFocused()) { SetFocusedView(this); return true; } } return false; }
void StickyChoice::Touch(const TouchInput &input) { dragging_ = false; if (!IsEnabled()) { down_ = false; return; } if (input.flags & TOUCH_DOWN) { if (bounds_.Contains(input.x, input.y)) { if (IsFocusMovementEnabled()) SetFocusedView(this); down_ = true; Click(); } } }