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

A titled frame around its children, optionally collapsible. More...

#include <backend.hpp>

Inheritance diagram for morph::ui::PanelWidget:
morph::ui::ContainerWidget morph::ui::Widget morph::ui::testing::detail::FakeLeaf< PanelWidget > morph::ui::testing::detail::FakeContainer< PanelWidget > morph::ui::testing::detail::FakePanel

Public Member Functions

virtual void setTitle (std::string_view title)=0
 Replaces the title.
virtual void setPadding (int padding)=0
 Sets the space between frame and content.
virtual void setCollapsible (bool collapsible)=0
 Sets whether the user can collapse the panel.
virtual void setHeader (Widget &header)=0
 Shows one of its children beside the title; called at most once. The header stays visible and usable while the panel is collapsed.
virtual void setCollapsed (bool collapsed)=0
 Collapses or expands the panel. A collapsed panel hides its content, which takes no input; its own collapse control still works. The header is not part of "its content" for this purpose: it stays shown and usable while collapsed. Never calls the onToggle handler.
virtual void setOnToggle (std::function< void(bool)> onToggle)=0
 Sets what a user collapse or expand calls, with the requested state.
Public Member Functions inherited from morph::ui::ContainerWidget
virtual void moveChild (Widget &child, std::size_t index)=0
 Moves child to position index: it is removed, then inserted before the child now at index.
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 titled frame around its children, optionally collapsible.

Definition at line 351 of file backend.hpp.

Member Function Documentation

◆ setTitle()

virtual void morph::ui::PanelWidget::setTitle ( std::string_view title)
pure virtual

Replaces the title.

Parameters
titleThe title, UTF-8.

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

◆ setPadding()

virtual void morph::ui::PanelWidget::setPadding ( int padding)
pure virtual

Sets the space between frame and content.

Parameters
paddingA spacing step, 0 to kMaxSpacingStep; the mount never passes another value.

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

◆ setCollapsible()

virtual void morph::ui::PanelWidget::setCollapsible ( bool collapsible)
pure virtual

Sets whether the user can collapse the panel.

Parameters
collapsibleWhether a collapse control is shown.

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

◆ setHeader()

virtual void morph::ui::PanelWidget::setHeader ( Widget & header)
pure virtual

Shows one of its children beside the title; called at most once. The header stays visible and usable while the panel is collapsed.

Parameters
headerA child of this widget.

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

◆ setCollapsed()

virtual void morph::ui::PanelWidget::setCollapsed ( bool collapsed)
pure virtual

Collapses or expands the panel. A collapsed panel hides its content, which takes no input; its own collapse control still works. The header is not part of "its content" for this purpose: it stays shown and usable while collapsed. Never calls the onToggle handler.

Parameters
collapsedWhether the content is hidden.

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

◆ setOnToggle()

virtual void morph::ui::PanelWidget::setOnToggle ( std::function< void(bool)> onToggle)
pure virtual

Sets what a user collapse or expand calls, with the requested state.

Parameters
onToggleThe handler; empty does nothing.

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


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