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