31 #include "../View/view.h"
32 #include "../Events/activation_change_event.h"
60 const std::shared_ptr<View> &
root_view()
const;
71 template<
typename T,
typename... Types>
74 auto child = std::make_shared<T>(std::forward<Types>(args)...);
81 return add_child<View>();
107 std::unique_ptr<ViewTreeImpl> impl;
virtual CanvasPtr canvas() const =0
Gets the current canvas used to render.
void dispatch_activation_change(ActivationChangeType type)
Dispatch activation change event to all views.
2D (x,y) point structure - Float
Definition: point.h:68
friend class ViewController
Definition: view_tree.h:111
Base class for managing a tree of views.
Definition: view_tree.h:42
friend class PositionedLayout
Definition: view_tree.h:112
std::shared_ptr< DisplayWindow > DisplayWindowPtr
Definition: canvas.h:41
std::shared_ptr< T > add_child(Types &&...args)
Definition: view_tree.h:72
void add_child(const std::shared_ptr< View > &view)
Add a child view.
Definition: view_tree.h:66
void set_focus_view(View *view)
Set or clears the focus.
virtual Pointf screen_to_client_pos(const Pointf &pos)=0
Map from screen to client coordinates.
2D (left,top,right,bottom) rectangle structure - Float
Definition: rect.h:505
ActivationChangeType
Window activation change.
Definition: activation_change_event.h:36
std::shared_ptr< View > add_child()
Definition: view_tree.h:79
virtual void set_needs_render()=0
Signals that the root view needs to be rendered again.
const std::shared_ptr< View > & root_view() const
Retrieves the root of the view tree.
View for an area of the user interface.
Definition: view.h:68
View * focus_view() const
The view receiving keyboard events or nullptr if no view has the focus.
void set_root_view(std::shared_ptr< View > root_view)
Sets a new root view controller for the view tree.
std::shared_ptr< Canvas > CanvasPtr
Definition: canvas.h:126
friend class ViewImpl
Definition: view_tree.h:110
void render(const CanvasPtr &canvas, const Rectf &margin_box)
Renders view into the specified canvas.
virtual DisplayWindowPtr display_window()=0
Definition: Application/application.h:35
virtual Pointf client_to_screen_pos(const Pointf &pos)=0
Map from client to screen coordinates.