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

A component a renderer loaded in a custom node's place (spec 5 §10): a bundle's verified QML or a host component, given the props the document binds and handing back the events it raises. More...

#include <backend.hpp>

Inheritance diagram for morph::qt_quick::CustomWidget:
morph::ui::Widget morph::ui::testing::detail::FakeLeaf< CustomWidget > morph::ui::testing::detail::FakeCustom

Public Member Functions

virtual void setTextProp (std::string_view name, std::string_view value)=0
 Sets a text prop: string, and int, exact and json, which cross as text so that no value loses precision.
virtual void setBoolProp (std::string_view name, bool value)=0
 Sets a bool prop.
virtual void setNumberProp (std::string_view name, double value)=0
 Sets a number prop: the one kind of value that crosses as a double.
virtual void setOnEvent (std::function< void(std::string event, std::string payload)> onEvent)=0
 Hands over the handler of the component's events.
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 component a renderer loaded in a custom node's place (spec 5 §10): a bundle's verified QML or a host component, given the props the document binds and handing back the events it raises.

Definition at line 773 of file backend.hpp.

Member Function Documentation

◆ setTextProp()

virtual void morph::ui::CustomWidget::setTextProp ( std::string_view name,
std::string_view value )
pure virtual

Sets a text prop: string, and int, exact and json, which cross as text so that no value loses precision.

Parameters
nameThe prop.
valueIts text.

◆ setBoolProp()

virtual void morph::ui::CustomWidget::setBoolProp ( std::string_view name,
bool value )
pure virtual

Sets a bool prop.

Parameters
nameThe prop.
valueIts value.

◆ setNumberProp()

virtual void morph::ui::CustomWidget::setNumberProp ( std::string_view name,
double value )
pure virtual

Sets a number prop: the one kind of value that crosses as a double.

Parameters
nameThe prop.
valueIts value.

◆ setOnEvent()

virtual void morph::ui::CustomWidget::setOnEvent ( std::function< void(std::string event, std::string payload)> onEvent)
pure virtual

Hands over the handler of the component's events.

Parameters
onEventCalled with the event's name and its payload as text (a key as i:<int64> or s:<text>, anything else as the component wrote it); empty does nothing.

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