morph 0.1.0
Asynchronous bridge between GUI thread and business models
Loading...
Searching...
No Matches
morph::ui::Navigator Class Reference

The catalog as a list a person opens screens from, with a title search and pinned shortcuts. More...

#include <navigator.hpp>

Public Member Functions

 Navigator (IViewBackend &backend, ContainerWidget *parent, NavigatorOptions options)
 The navigator, appended to parent.
 Navigator (Navigator const &)=delete
Navigator & operator= (Navigator const &)=delete
 Navigator (Navigator &&)=delete
Navigator & operator= (Navigator &&)=delete
StackWidget & root () noexcept
 The navigator's root widget, which the host places.
void focusSearch ()
 Moves keyboard focus to the search, as the navigator's shortcut does.
bool pin (std::string const &screenId)
 Pins a screen at the end of the pins.
bool unpin (std::string const &screenId)
 Removes a pin.
std::vector< std::string > const & pins () const noexcept
 The pins, in order.
void setCurrent (std::string_view screenId)
 Marks the entry of the screen that is open, and clears the mark of the one marked before. A pin is not marked.
std::string const & current () const noexcept
 The screen whose entry is marked.

Detailed Description

The catalog as a list a person opens screens from, with a title search and pinned shortcuts.

Entries are grouped by module, then group, in the order each first appears; each group has a heading. Each entry is a list item (ButtonStyle::Item) as wide as the navigator, and setCurrent marks the open screen's. An unavailable entry is listed disabled, with its reason as its tooltip. The search shows the entries one of whose titles contains the text, ignoring ASCII case, and the headings of the groups that still show one. Neither copyable nor movable; owned by the owner thread of its backend.

Test ids: navigator, navigator_search, navigator_pins, nav_<screen id>, pin_<screen id>, and navigator_group_<module>/<group> for a heading.

Definition at line 57 of file navigator.hpp.

Constructor & Destructor Documentation

◆ Navigator()

morph::ui::Navigator::Navigator ( IViewBackend & backend,
ContainerWidget * parent,
NavigatorOptions options )
inline

The navigator, appended to parent.

Parameters
backendThe backend its widgets are made with. Borrowed.
parentThe container it is appended to; null makes it a backend root.
optionsThe entries, the pins and the handlers.

Definition at line 63 of file navigator.hpp.

Member Function Documentation

◆ root()

StackWidget & morph::ui::Navigator::root ( )
inlinenodiscardnoexcept

The navigator's root widget, which the host places.

Returns
It.

Definition at line 92 of file navigator.hpp.

◆ focusSearch()

void morph::ui::Navigator::focusSearch ( )
inline

Moves keyboard focus to the search, as the navigator's shortcut does.

Definition at line 95 of file navigator.hpp.

◆ pin()

bool morph::ui::Navigator::pin ( std::string const & screenId)
inline

Pins a screen at the end of the pins.

Parameters
screenIdThe screen id.
Returns
Whether it was pinned: false for an unknown or already pinned screen, or when the pins are full.

Definition at line 100 of file navigator.hpp.

◆ unpin()

bool morph::ui::Navigator::unpin ( std::string const & screenId)
inline

Removes a pin.

Parameters
screenIdThe screen id.
Returns
Whether it was pinned.

Definition at line 112 of file navigator.hpp.

◆ pins()

std::vector< std::string > const & morph::ui::Navigator::pins ( ) const
inlinenodiscardnoexcept

The pins, in order.

Returns
Their screen ids.

Definition at line 122 of file navigator.hpp.

◆ setCurrent()

void morph::ui::Navigator::setCurrent ( std::string_view screenId)
inline

Marks the entry of the screen that is open, and clears the mark of the one marked before. A pin is not marked.

Parameters
screenIdThe open screen's id; one the navigator does not list, or empty, leaves no entry marked.

Definition at line 127 of file navigator.hpp.

◆ current()

std::string const & morph::ui::Navigator::current ( ) const
inlinenodiscardnoexcept

The screen whose entry is marked.

Returns
Its id; empty when none is.

Definition at line 144 of file navigator.hpp.


The documentation for this class was generated from the following file: