Lomse library. API documentation  0.30.0
Presenter Class Reference

#include <lomse_presenter.h>

Inheritance diagram for Presenter:

Detailed Description

The Presenter is a facade object responsible for maintaining the life cycle and relationships between the objects in the Lomse MVC model: Views, Interactors and the Document.

All these objects are created when invoking one of the LomseDoorway::new_document() or LomseDoorway::open_document() methods.

The Presenter, returned by previous methods, gives acess to the Document and to the Interactors associated to the existing View objects for the Document.

See Rendering documents overview.

Public Member Functions

virtual ~Presenter ()
 
int get_num_interactors ()
 
SpInteractor get_interactor_shared_ptr (int iIntor)
 
WpInteractor get_interactor (int iIntor)
 
SpDocument get_document_shared_ptr ()
 
WpDocument get_document_weak_ptr ()
 
Document * get_document_raw_ptr ()
 
ADocument get_document ()
 
void set_user_data (void *pData)
 
void * get_user_data ()
 

Constructor & Destructor Documentation

◆ ~Presenter()

virtual Presenter::~Presenter ( )
virtual

Destructor

Attention
As Presenter ownership is transferred to the user application, you have to take care of deleting the Presenter when no longer needed. Deleting the Presenter will automatically cause deletion of all MVC involved objects: the Document, all existing Views and their Interactors, selection sets, undo/redo stack, etc.

Member Function Documentation

◆ get_document()

ADocument Presenter::get_document ( )
inline

Returns an ADocument object for interacting with the internal model.

◆ get_document_raw_ptr()

Document* Presenter::get_document_raw_ptr ( )
inline

Returns the raw pointer to the Document associated to this Presenter.

◆ get_document_shared_ptr()

SpDocument Presenter::get_document_shared_ptr ( )
inline

Returns a shared pointer to the Document associated to this Presenter.

◆ get_document_weak_ptr()

WpDocument Presenter::get_document_weak_ptr ( )

Returns a shared pointer to the Document associated to this Presenter.

◆ get_interactor()

WpInteractor Presenter::get_interactor ( int  iIntor)

Returns a weak pointer to the specified Interactor index.

Parameters
iIntoris the number of the desired Interactor. It must be 0 for the first interactor, and it must be lower than the value returned by method get_num_interactors(); otherwise an exception will be thrown.

◆ get_interactor_shared_ptr()

SpInteractor Presenter::get_interactor_shared_ptr ( int  iIntor)

Returns a shared pointer to the specified Interactor index.

Parameters
iIntoris the number of the desired Interactor. It must be 0 for the first interactor, and it must be lower than the value returned by method get_num_interactors(); otherwise an exception will be thrown.

◆ get_num_interactors()

int Presenter::get_num_interactors ( )
inline

Returns the number of Interactors associated to the Presenter, at least 1. There exist as many Interactors as document Views.

◆ get_user_data()

void* Presenter::get_user_data ( )
inline

Returns a pointer to the user data associated with this Presenter (if any).

Returns
A pointer to the user data, or nullptr if no data saved.

◆ set_user_data()

void Presenter::set_user_data ( void *  pData)
inline

Associates the given untyped application data pointer with this Presenter.

Parameters
pDataThe application data to associate with the Presenter.

This method is a commodity for your application, in case you would like to save some data associated to Presenter objects, e.g., for Document identification or other.

Attention
Your application has the ownership of the associated data. Therefore, this data will not be deleted when the Presenter is deleted.