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

A fake DropZoneWidget: properties accept ([.ext,…]), multiple. More...

#include <recording_backend.hpp>

Inheritance diagram for morph::ui::testing::detail::FakeDropZone:
morph::ui::testing::detail::FakeContainer< DropZoneWidget > morph::ui::testing::detail::FakeLeaf< DropZoneWidget > morph::ui::DropZoneWidget morph::ui::ContainerWidget morph::ui::Widget

Public Member Functions

void setAccept (std::vector< std::string > const &extensions) override
 Sets the extensions it takes; called once.
void setMultiple (bool multiple) override
 Sets whether a drop may carry more than one file; called once.
void setOnDrop (std::function< void(std::vector< std::string >)> onDrop) override
 Sets what a drop it takes calls. A drop with a file outside the accepted extensions, or with several files when only one is taken, is refused whole and calls nothing.
bool takes (std::vector< std::string > const &paths) const
 Whether the zone takes a drop of paths: one file unless several are allowed, each with an accepted extension.
Public Member Functions inherited from morph::ui::testing::detail::FakeContainer< DropZoneWidget >
void moveChild (Widget &child, std::size_t index) override
 Moves a child among its siblings and logs it.
Public Member Functions inherited from morph::ui::testing::detail::FakeLeaf< DropZoneWidget >
 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< DropZoneWidget >
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 DropZoneWidget: properties accept ([.ext,…]), multiple.

Definition at line 1308 of file recording_backend.hpp.

Member Function Documentation

◆ setAccept()

void morph::ui::testing::detail::FakeDropZone::setAccept ( std::vector< std::string > const & extensions)
inlineoverridevirtual

Sets the extensions it takes; called once.

Parameters
extensionsSuch as ".csv", compared without regard to case; empty takes every file.

Implements morph::ui::DropZoneWidget.

Definition at line 1311 of file recording_backend.hpp.

◆ setMultiple()

void morph::ui::testing::detail::FakeDropZone::setMultiple ( bool multiple)
inlineoverridevirtual

Sets whether a drop may carry more than one file; called once.

Parameters
multipleWhether several files are taken at once.

Implements morph::ui::DropZoneWidget.

Definition at line 1315 of file recording_backend.hpp.

◆ setOnDrop()

void morph::ui::testing::detail::FakeDropZone::setOnDrop ( std::function< void(std::vector< std::string >)> onDrop)
inlineoverridevirtual

Sets what a drop it takes calls. A drop with a file outside the accepted extensions, or with several files when only one is taken, is refused whole and calls nothing.

Parameters
onDropThe handler, given the paths in the order dropped; empty does nothing.

Implements morph::ui::DropZoneWidget.

Definition at line 1319 of file recording_backend.hpp.

◆ takes()

bool morph::ui::testing::detail::FakeDropZone::takes ( std::vector< std::string > const & paths) const
inlinenodiscard

Whether the zone takes a drop of paths: one file unless several are allowed, each with an accepted extension.

Parameters
pathsThe paths dropped; not empty.
Returns
True when the drop is taken.

Definition at line 1327 of file recording_backend.hpp.


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