AUI Framework  master
Cross-platform base for C++ UI apps
Loading...
Searching...
No Matches
UIMatcher Class Reference

Public Member Functions#

 UIMatcher (const _< IMatcher > &matcher)
 
ASet< _< AView > > toSet () const
 
AVector< _< AView > > toVector () const
 
_< AViewone () const
 
UIMatcherincludeInvisibleViews ()
 
template<class Action>
UIMatcherperform (Action &&action)
 
UIMatcher findNearestTo (UIMatcher matcher)
 Finds the nearest view to the specified one.
 
template<class Assertion>
UIMatchercheck (Assertion &&assertion, const char *msg="no msg")
 
UIMatcher parent () const
 
UIMatcher allChildren () const
 
UIMatcher operator| (const UIMatcher &matcher) const
 
UIMatcher operator& (const UIMatcher &matcher) const
 

Static Public Member Functions#

static UIMatchercurrent ()
 

Member Function Documentation#

◆ findNearestTo()#

UIMatcher UIMatcher::findNearestTo ( UIMatcher matcher)
inline

Finds the nearest view to the bottom right corner of the specified view. The bottom right corner is chosen in order to simulate human eye scanning (which is from top-left to bottom-right).

Useful when finding fields by their labels:

_new<ALabel>("Login"),
_new<ATextField>(),
_new<ALabel>("Password"),
_new<ATextField>(),
...
By::type<ATextField>().findNearestTo(By::text("Login")) // <- matches the first ATextField
By::type<ATextField>().findNearestTo(By::text("Password")) // <- matches the second ATextField
Editable field with text to receive a text input from the user.
Definition ATextField.h:24
UIMatcher findNearestTo(UIMatcher matcher)
Finds the nearest view to the specified one.
Definition UIMatcher.h:113
Parameters
matcherUIMatcher of a view to find the nearest to. The UIMatcher is expected to match only one view.
Returns
the nearest view