lecui 1.0.0-alpha.20
lecui C++ user interface library
Public Member Functions | Static Public Member Functions | List of all members
liblec::lecui::page_manager Class Reference

Page manager class. More...

#include <page.h>

Public Member Functions

 page_manager (form &fm)
 Page manager constructor. More...
 
 ~page_manager ()
 Class destructor.
 
bool exists (const std::string &alias)
 Check if a page exists. More...
 
containers::pageadd (const std::string &alias)
 Add a page to the form. More...
 
void show (const std::string &alias)
 Show a page. More...
 
void close (const std::string &path)
 Close a container. More...
 
std::string current ()
 Get the name of the currently displayed page. More...
 
std::string previous ()
 Get the name of the page that was displayed before the current page. More...
 

Static Public Member Functions

static containers::pageget (form &fm, const std::string &alias)
 Get the page container of an existing page. More...
 

Detailed Description

Page manager class.

Constructor & Destructor Documentation

◆ page_manager()

liblec::lecui::page_manager::page_manager ( form fm)

Page manager constructor.

Parameters
fmA reference to the form.

Member Function Documentation

◆ add()

containers::page & liblec::lecui::page_manager::add ( const std::string &  alias)

Add a page to the form.

Parameters
aliasThe in-form unique alias, e.g. "home_page".
Returns
A reference to the page container.

throws on failure, but ensure to not attempt to add a page that already exists. Use an if statement guard as follows: if (!exists()){ add(); }.

◆ close()

void liblec::lecui::page_manager::close ( const std::string &  path)

Close a container.

Parameters
pathThe full path to the container, e.g. "home_page/task_pane".

◆ current()

std::string liblec::lecui::page_manager::current ( )

Get the name of the currently displayed page.

Returns
The name of the page that is currently displayed, and an empty string if there is no page displayed.

◆ exists()

bool liblec::lecui::page_manager::exists ( const std::string &  alias)

Check if a page exists.

Parameters
aliasThe in-form unique alias, e.g. "home_page".
Returns
True if the page has been created, else false.

◆ get()

static containers::page & liblec::lecui::page_manager::get ( form fm,
const std::string &  alias 
)
static

Get the page container of an existing page.

Parameters
fmThe form the page is in.
aliasThe in-form unique alias, e.g. "home_page".
Returns
A reference to the page container.

Throws on failure. For faster coding and more readable code consider calling this static method through the helper macro provided (get_page), unless if already using an in-class page_manager instance.

◆ previous()

std::string liblec::lecui::page_manager::previous ( )

Get the name of the page that was displayed before the current page.

Returns
The name of the page that was displayed before the current one, and an empty string if the current page is the root.

◆ show()

void liblec::lecui::page_manager::show ( const std::string &  alias)

Show a page.

Parameters
aliasThe in-form unique alias, e.g. "home_page".

This method is only applicable to form pages and not panes and tab panes even though they are also containers. To manipulate the visibility of the other containers use the widget_manager::show method instead.


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