clan::ViewTree Class Referenceabstract

Base class for managing a tree of views. More...

#include <view_tree.h>

+ Inheritance diagram for clan::ViewTree:

Public Member Functions

 ViewTree ()
 
virtual ~ViewTree ()
 
std::shared_ptr< Viewadd_child ()
 
void add_child (const std::shared_ptr< View > &view)
 Add a child view.
 
template<typename T, typename... Types>
std::shared_ptr< T > add_child (Types &&... args)
 
virtual Canvas canvas () const =0
 Gets the current canvas used to render.
 
virtual DisplayWindow display_window ()=0
 
Viewfocus_view () const
 The view receiving keyboard events or nullptr if no view has the focus.
 
const std::shared_ptr< View > & root_view () const
 Retrieves the root of the view tree.
 
void set_root_view (std::shared_ptr< View > root_view)
 Sets a new root view controller for the view tree.
 

Protected Member Functions

virtual Pointf client_to_screen_pos (const Pointf &pos)=0
 Map from client to screen coordinates.
 
void dispatch_activation_change (ActivationChangeType type)
 Dispatch activation change event to all views.
 
void render (Canvas &canvas, const Rectf &margin_box)
 Renders view into the specified canvas.
 
virtual Pointf screen_to_client_pos (const Pointf &pos)=0
 Map from screen to client coordinates.
 
void set_focus_view (View *view)
 Set or clears the focus.
 
virtual void set_needs_render ()=0
 Signals that the root view needs to be rendered again.
 

Friends

class PositionedLayout
 
class View
 
class ViewController
 
class ViewImpl
 

Detailed Description

Base class for managing a tree of views.

Constructor & Destructor Documentation

◆ ViewTree()

clan::ViewTree::ViewTree ( )

Referenced by screen_to_client_pos().

◆ ~ViewTree()

virtual clan::ViewTree::~ViewTree ( )
virtual

Member Function Documentation

◆ add_child() [1/3]

std::shared_ptr< View > clan::ViewTree::add_child ( )
inline

References add_child().

Referenced by add_child(), and add_child().

◆ add_child() [2/3]

void clan::ViewTree::add_child ( const std::shared_ptr< View > & view)
inline

Add a child view.

References root_view().

◆ add_child() [3/3]

template<typename T, typename... Types>
std::shared_ptr< T > clan::ViewTree::add_child ( Types &&... args)
inline

References add_child().

◆ canvas()

virtual Canvas clan::ViewTree::canvas ( ) const
pure virtual

Gets the current canvas used to render.

Implemented in clan::TextureWindow, and clan::TopLevelWindow.

Referenced by render().

◆ client_to_screen_pos()

virtual Pointf clan::ViewTree::client_to_screen_pos ( const Pointf & pos)
protectedpure virtual

Map from client to screen coordinates.

Implemented in clan::TextureWindow, and clan::TopLevelWindow.

◆ dispatch_activation_change()

void clan::ViewTree::dispatch_activation_change ( ActivationChangeType type)
protected

Dispatch activation change event to all views.

◆ display_window()

virtual DisplayWindow clan::ViewTree::display_window ( )
pure virtual

Gets the display window used

This may return a null DisplayWindow

Implemented in clan::TextureWindow, and clan::TopLevelWindow.

◆ focus_view()

View * clan::ViewTree::focus_view ( ) const

The view receiving keyboard events or nullptr if no view has the focus.

References View.

◆ render()

void clan::ViewTree::render ( Canvas & canvas,
const Rectf & margin_box )
protected

Renders view into the specified canvas.

References canvas().

◆ root_view()

const std::shared_ptr< View > & clan::ViewTree::root_view ( ) const

Retrieves the root of the view tree.

Referenced by add_child(), and set_root_view().

◆ screen_to_client_pos()

virtual Pointf clan::ViewTree::screen_to_client_pos ( const Pointf & pos)
protectedpure virtual

Map from screen to client coordinates.

Implemented in clan::TextureWindow, and clan::TopLevelWindow.

References ViewTree().

◆ set_focus_view()

void clan::ViewTree::set_focus_view ( View * view)
protected

Set or clears the focus.

References View.

◆ set_needs_render()

virtual void clan::ViewTree::set_needs_render ( )
protectedpure virtual

Signals that the root view needs to be rendered again.

Implemented in clan::TextureWindow, and clan::TopLevelWindow.

◆ set_root_view()

void clan::ViewTree::set_root_view ( std::shared_ptr< View > root_view)

Sets a new root view controller for the view tree.

References root_view().

Friends And Related Symbol Documentation

◆ PositionedLayout

friend class PositionedLayout
friend

References PositionedLayout.

Referenced by PositionedLayout.

◆ View

friend class View
friend

References View.

Referenced by focus_view(), set_focus_view(), and View.

◆ ViewController

friend class ViewController
friend

References ViewController.

Referenced by ViewController.

◆ ViewImpl

friend class ViewImpl
friend

References ViewImpl.

Referenced by ViewImpl.


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