morph 0.1.0
Asynchronous bridge between GUI thread and business models
Loading...
Searching...
No Matches
morph::ui::testing::detail::FakeButton Class Referencefinal

A fake ButtonWidget: properties label, emphasis, icon, style and selected. More...

#include <recording_backend.hpp>

Inheritance diagram for morph::ui::testing::detail::FakeButton:
morph::ui::testing::detail::FakeLeaf< ButtonWidget > morph::ui::ButtonWidget morph::ui::Widget

Public Member Functions

void setLabel (std::string_view label) override
 Replaces the caption.
void setOnClick (Action onClick) override
 Sets what activation calls (Enter, Space or a click).
void setEmphasis (ButtonEmphasis emphasis) override
 Sets how much the button stands out. The mount calls it only for another value than Normal.
void setIcon (std::string_view icon) override
 Sets the icon drawn beside the caption; called once, and only for a button that has one.
void setStyle (ButtonStyle style) override
 Sets how the button is drawn. A new button is a push button; the mount calls it once, only for Item.
void setSelected (bool selected) override
 Marks a list entry as the current one, or clears the mark. A new button is not selected; the mount calls it only for an Item, when bound or true.
Public Member Functions inherited from morph::ui::testing::detail::FakeLeaf< ButtonWidget >
 FakeLeaf (std::shared_ptr< RecordStore > store, std::string kind, ContainerWidget const *parent, PropList initial={})
 Records the new widget, appended to parent, and logs its creation.
 ~FakeLeaf () override
 Forgets the widget and logs its destruction; its remaining children become roots.
FakeLeaf & operator= (FakeLeaf const &)=delete
void setVisible (bool visible) override
 Records property visible.
void setEnabled (bool enabled) override
 Records property enabled.
void setLayout (LayoutHints const &hints) override
 Records property layout, as formatLayout gives it.
void setDragKey (std::optional< Key > const &key) override
 Records property dragKey and keeps the key for RecordingBackend::drag.
void setDropHandler (std::function< bool(Key const &)> accepts, std::function< void(Key)> onDrop) override
 Records property drop=handler and keeps both handlers for RecordingBackend::drag.
void setAccessibleName (std::string_view name) override
 Records property a11yName.
void setAccessibleRole (std::string_view role) override
 Records property a11yRole.
void setTestId (std::string_view testId) override
 Records property testId.
void setTooltip (std::string_view text) override
 Records property tooltip.
void setSurface (std::string_view surface) override
 Records property surface.
void setKeys (std::vector< std::string > const &chords, std::function< void(std::string)> onChord) override
 Records property keys, the chords joined by commas, and keeps the chords and the handler for RecordingBackend::press.
void focus () override
 Moves the backend's recorded focus here, and logs focus.
void setOnHover (std::function< void()> onHover) override
 Keeps the handler for RecordingBackend::hover.
Public Member Functions inherited from morph::ui::Widget
 Widget (Widget const &)=delete
Widget & operator= (Widget const &)=delete
 Widget (Widget &&)=delete
Widget & operator= (Widget &&)=delete

Additional Inherited Members

Protected Member Functions inherited from morph::ui::testing::detail::FakeLeaf< ButtonWidget >
void set (std::string_view name, std::string value)
 Records a property set through a setter.
Callbacks & callbacks ()
 This widget's handlers.
RecordStore & store () const noexcept
 The store this widget records into.
std::shared_ptr< RecordStore > const & sharedStore () const noexcept
 The store, shared: what a part this widget makes (an overlay's footer) records into.
int id () const noexcept
 This widget's id.

Detailed Description

A fake ButtonWidget: properties label, emphasis, icon, style and selected.

Definition at line 890 of file recording_backend.hpp.

Member Function Documentation

◆ setLabel()

void morph::ui::testing::detail::FakeButton::setLabel ( std::string_view label)
inlineoverridevirtual

Replaces the caption.

Parameters
labelThe caption, UTF-8.

Implements morph::ui::ButtonWidget.

Definition at line 893 of file recording_backend.hpp.

◆ setOnClick()

void morph::ui::testing::detail::FakeButton::setOnClick ( Action onClick)
inlineoverridevirtual

Sets what activation calls (Enter, Space or a click).

Parameters
onClickThe handler; empty does nothing.

Implements morph::ui::ButtonWidget.

Definition at line 894 of file recording_backend.hpp.

◆ setEmphasis()

void morph::ui::testing::detail::FakeButton::setEmphasis ( ButtonEmphasis emphasis)
inlineoverridevirtual

Sets how much the button stands out. The mount calls it only for another value than Normal.

Parameters
emphasisThe emphasis.

Implements morph::ui::ButtonWidget.

Definition at line 895 of file recording_backend.hpp.

◆ setIcon()

void morph::ui::testing::detail::FakeButton::setIcon ( std::string_view icon)
inlineoverridevirtual

Sets the icon drawn beside the caption; called once, and only for a button that has one.

Parameters
iconThe name of an icon in the theme's icon set.

Implements morph::ui::ButtonWidget.

Definition at line 896 of file recording_backend.hpp.

◆ setStyle()

void morph::ui::testing::detail::FakeButton::setStyle ( ButtonStyle style)
inlineoverridevirtual

Sets how the button is drawn. A new button is a push button; the mount calls it once, only for Item.

Parameters
styleThe style.

Implements morph::ui::ButtonWidget.

Definition at line 897 of file recording_backend.hpp.

◆ setSelected()

void morph::ui::testing::detail::FakeButton::setSelected ( bool selected)
inlineoverridevirtual

Marks a list entry as the current one, or clears the mark. A new button is not selected; the mount calls it only for an Item, when bound or true.

Parameters
selectedWhether it is the current one.

Implements morph::ui::ButtonWidget.

Definition at line 898 of file recording_backend.hpp.


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