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

A message across the top of a region, with an optional action button and an optional dismissal. More...

#include <backend.hpp>

Inheritance diagram for morph::ui::BannerWidget:
morph::ui::Widget morph::ui::testing::detail::FakeLeaf< BannerWidget > morph::ui::testing::detail::FakeBanner

Public Member Functions

virtual void setTone (Tone tone)=0
 Sets what the message conveys.
virtual void setText (std::string_view text)=0
 Replaces the message.
virtual void setActionLabel (std::string_view label)=0
 Replaces the action button's caption.
virtual void setOnAction (Action onAction)=0
 Sets what activating the action button calls.
virtual void setDismissible (bool dismissible)=0
 Sets whether the user can dismiss the banner; called once, before the banner is shown.
virtual void setOnDismiss (Action onDismiss)=0
 Sets what a dismissal calls. A dismissal leaves the banner shown: the application hides it.
Public Member Functions inherited from morph::ui::Widget
 Widget (Widget const &)=delete
Widget & operator= (Widget const &)=delete
 Widget (Widget &&)=delete
Widget & operator= (Widget &&)=delete
virtual void setVisible (bool visible)=0
 Shows or hides the widget and everything inside it.
virtual void setEnabled (bool enabled)=0
 Enables or disables input on the widget and everything inside it.
virtual void setLayout (LayoutHints const &hints)=0
 Sets the size request.
virtual void setDragKey (std::optional< Key > const &key)=0
 Makes the widget draggable, carrying key, or not draggable.
virtual void setDropHandler (std::function< bool(Key const &)> accepts, std::function< void(Key)> onDrop)=0
 Makes the widget a drop target.
virtual void setAccessibleName (std::string_view name)=0
 Sets the name assistive technology reads for the widget.
virtual void setAccessibleRole (std::string_view role)=0
 Sets the role assistive technology announces for the widget.
virtual void setTestId (std::string_view testId)=0
 Sets the stable identifier an automated test finds the widget by.
virtual void setTooltip (std::string_view text)=0
 Sets the text shown while the pointer rests on the widget.
virtual void setSurface (std::string_view surface)=0
 Styles the widget and everything inside it with a named token set of the theme.
virtual void setKeys (std::vector< std::string > const &chords, std::function< void(std::string)> onChord)=0
 Declares the keyboard chords the widget handles while focus is inside it.
virtual void focus ()=0
 Moves keyboard focus to the widget.
virtual void setOnHover (std::function< void()> onHover)
 Calls onHover each time the pointer comes to rest over the widget. A backend without a pointer, or one that does not report hovering, keeps the default, which never calls it: hovering is a hint, such as a prefetch, never something a widget relies on.

Detailed Description

A message across the top of a region, with an optional action button and an optional dismissal.

Definition at line 586 of file backend.hpp.

Member Function Documentation

◆ setTone()

virtual void morph::ui::BannerWidget::setTone ( Tone tone)
pure virtual

Sets what the message conveys.

Parameters
toneThe tone, mapped to the backend's theme.

Implemented in morph::ui::testing::detail::FakeBanner.

◆ setText()

virtual void morph::ui::BannerWidget::setText ( std::string_view text)
pure virtual

Replaces the message.

Parameters
textThe message, UTF-8.

Implemented in morph::ui::testing::detail::FakeBanner.

◆ setActionLabel()

virtual void morph::ui::BannerWidget::setActionLabel ( std::string_view label)
pure virtual

Replaces the action button's caption.

Parameters
labelThe caption, UTF-8; empty shows no button.

Implemented in morph::ui::testing::detail::FakeBanner.

◆ setOnAction()

virtual void morph::ui::BannerWidget::setOnAction ( Action onAction)
pure virtual

Sets what activating the action button calls.

Parameters
onActionThe handler; empty does nothing.

Implemented in morph::ui::testing::detail::FakeBanner.

◆ setDismissible()

virtual void morph::ui::BannerWidget::setDismissible ( bool dismissible)
pure virtual

Sets whether the user can dismiss the banner; called once, before the banner is shown.

Parameters
dismissibleWhether to offer the dismissal.

Implemented in morph::ui::testing::detail::FakeBanner.

◆ setOnDismiss()

virtual void morph::ui::BannerWidget::setOnDismiss ( Action onDismiss)
pure virtual

Sets what a dismissal calls. A dismissal leaves the banner shown: the application hides it.

Parameters
onDismissThe handler; empty does nothing.

Implemented in morph::ui::testing::detail::FakeBanner.


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