26 #if defined(_WIN32) && defined(HR_ENGINE_SHARED) 28 # define MR_DllDeclare __declspec( dllexport ) 30 # define MR_DllDeclare __declspec( dllimport ) 33 # define MR_DllDeclare 55 SUPER(display, layoutFlags), focusedChild(nullptr) { }
58 SUPER(display, size, clip, layoutFlags), focusedChild(nullptr) { }
65 return focusedChild->OnAction();
73 return focusedChild->OnNavigate(nav);
79 void OnChildRequestedFocus(
UiViewModel &child)
override;
84 void FocusPrevFrom(children_t::iterator startingPoint,
86 void FocusNextFrom(children_t::iterator startingPoint,
91 void DropFocus()
override;
97 template<
class T,
class... Args>
98 typename std::enable_if<std::is_base_of<UiViewModel, T>::value,
99 std::shared_ptr<T>>::type
102 return SUPER::NewChild<T>(std::forward<Args>(args)...);
107 typename std::enable_if<std::is_base_of<UiViewModel, T>::value,
112 if (child.get() == focusedChild) {
114 focusedChild =
nullptr;
117 return SUPER::RemoveChild(child);
122 typename std::enable_if<std::is_base_of<UiViewModel, T>::value,
127 return SUPER::ReorderChild(child, idx);
130 void Clear()
override;
132 void Reserve(
size_t capacity)
override { SUPER::Reserve(capacity); }
std::enable_if< std::is_base_of< UiViewModel, T >::value, std::shared_ptr< T > >::type NewChild(Args &&...args)
Create and append a new child widget to the end of the list.
Definition: Container.h:100
Container(Display &display, uiLayoutFlags_t layoutFlags=0)
Definition: Container.h:54
virtual ~Container()
Definition: Container.h:59
Base class for UI (2D) components.
Definition: UiViewModel.h:56
UiViewModel * focusedChild
Definition: Container.h:135
bool OnNavigate(const Control::Nav &nav) override
Definition: Container.h:70
Base class for widgets that contain other widgets.
Definition: BaseContainer.h:63
void Reserve(size_t capacity) override
Increase the capacity of the of this container.
Definition: Container.h:132
MR_UInt32 uiLayoutFlags_t
Definition: UiLayoutFlags.h:53
Base class for display managers.
Definition: Display.h:73
std::enable_if< std::is_base_of< UiViewModel, T >::value, std::shared_ptr< T > >::type ReorderChild(const std::shared_ptr< T > &child, size_t idx)
Move a widget to a different position in the list.
Definition: Container.h:125
Container(Display &display, const Vec2 &size, bool clip=true, uiLayoutFlags_t layoutFlags=0)
Definition: Container.h:56
#define MR_DllDeclare
Definition: Container.h:33
An invisible container for other UI widgets.
Definition: Container.h:49
A navigation direction.
Definition: Nav.h:45
std::enable_if< std::is_base_of< UiViewModel, T >::value, std::shared_ptr< T > >::type RemoveChild(const std::shared_ptr< T > &child)
Remove a child element.
Definition: Container.h:110
int idx
Definition: SdlDisplay.cpp:254
Definition: Announcement.h:24
bool OnAction() override
Definition: Container.h:62