class ContestMember

Defined at line 37 of file ../../src/ui/a11y/lib/gesture_manager/arena/contest_member.h

Represents a |GestureRecognizer|'s participation in a contest.

Recognizers add themselves to the arena via |GestureArena::Add(GestureRecognizer*)|, and receive

a |ContestMember| in |OnContestStarted|.

Recognizers receive updates for a gesture as long as they hold their |ContestMember| instance and

have not been defeated. They must release their |ContestMember| when they no longer want events.

Recognizers may call |Accept()| when they want to claim a win or |Reject()| when they want to

cede the arena. Only the first call to |Accept()| or |Reject()| has any effect.

If a |ContestMember| is released while still contending, it automatically rejects.

Contest resolution does not occur until all members have claimed a win or declared defeat. When

resolution occurs the highest priority claimant is awarded the win. All other claimants are

informed of their loss.

The contest is reset after the winner releases its |ContestMember| or if

all members declare defeat. A subsequent interaction will start a new contest and new

|ContestMember| instances will be issued to all recognizers. Any defeated |ContestMember|s still

held have no effect. It is recommended that recognizers reset their state and release their

|ContestMember| on defeat.

In the future, we may support dispatching multiple wins to recognizers that claim multiple wins

while a longer-running recognizer eventually declares defeat. E.g., 2 single taps and a long

press recognized after a 3x1 tap recognizer rejects due to the long press.

Public Methods

void Accept ()

Claims a win in this contest. Resolution does not occur until all members have claimed a win

or declared defeat, at which point the corresponding |GestureRecognizer| method will be called.

void Reject ()

Declares defeat in this contest. The recognizer receives a call to |OnDefeat()| before this

returns.

void ~ContestMember ()

Defined at line 47 of file ../../src/ui/a11y/lib/gesture_manager/arena/contest_member.h

Enumerations

enum Status
Name Value
kUndecided 0
kAccepted 1
kRejected 2

While these states are not exposed on the |ContestMember| interface, they are useful for

implementations and for testing.

Defined at line 41 of file ../../src/ui/a11y/lib/gesture_manager/arena/contest_member.h