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

Widget manager class. More...

#include <widget.h>

Public Member Functions

 widget_manager (form &fm)
 Widget manager constructor. More...
 
 ~widget_manager ()
 Widget manager destructor.
 
bool enable (const std::string &path, std::string &error)
 Enable a widget. More...
 
bool disable (const std::string &path, std::string &error)
 Disable a widget. More...
 
bool show (const std::string &path, std::string &error)
 Show a widget. More...
 
bool hide (const std::string &path, std::string &error)
 Hide a widget. More...
 
void close (const std::string &path)
 Close a widget. More...
 
void select (const std::string &path)
 Select a widget. More...
 
bool refresh (const std::string &path, std::string &error)
 Refresh a widget. More...
 

Detailed Description

Widget manager class.

Constructor & Destructor Documentation

◆ widget_manager()

liblec::lecui::widget_manager::widget_manager ( form fm)

Widget manager constructor.

Parameters
fmThe form whose widgets we would like to manage.

Member Function Documentation

◆ close()

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

Close a widget.

Parameters
pathThe full path to the widget, e.g. "home_page/username".

Avoid closing a widget from within its own handler to avoid access violation errors. Also make sure to never keep 'dangling widget references' because attempting to use those references after this method is called will result in access violation errors as well. Make sure to employ proper logic. As a failsafe, the widget is not closed immediately when this method is called. Rather a special timer is scheduled internally to close the widget. After this, the widget is closed as soon as possible, typically soon after the current handler exits. Note that a call to form::update() is not necessary after this method is called because it sends this call internally. Note that a call to form::update() is not necessary after this method is called because it sends this call internally.

◆ disable()

bool liblec::lecui::widget_manager::disable ( const std::string &  path,
std::string &  error 
)

Disable a widget.

Parameters
pathThe full path to the widget, e.g. "home_page/username".
errorError information.
Returns
Returns true if successful, else false.

Note that a call to form::update() is not necessary after this method is called because it sends this call internally.

◆ enable()

bool liblec::lecui::widget_manager::enable ( const std::string &  path,
std::string &  error 
)

Enable a widget.

Parameters
pathThe full path to the widget, e.g. "home_page/username".
errorError information.
Returns
Returns true if successful, else false.

Note that a call to form::update() is not necessary after this method is called because it sends this call internally.

◆ hide()

bool liblec::lecui::widget_manager::hide ( const std::string &  path,
std::string &  error 
)

Hide a widget.

Parameters
pathThe full path to the widget, e.g. "home_page/username".
errorError information.
Returns
Returns true if successful, else false.

Note that a call to form::update() is not necessary after this method is called because it sends this call internally.

◆ refresh()

bool liblec::lecui::widget_manager::refresh ( const std::string &  path,
std::string &  error 
)

Refresh a widget.

Parameters
pathThe full path to the widget, e.g. "home_page/username".
errorError information.
Returns
Returns true if successful, else false.

This method causes all the widget's graphic resources to be recreated. This is useful if you need a resource being used by the widget, e.g. a .png file being used by an image_view, freed immediately after the widget's properties are changed. A call to form::reload() would do this but it's a lot more expensive since it refreshes every widget in every page, and a call to form::update() would only free the resource after the next time a paint operation is done. Note that a call to form::update() is not necessary after this method is called because it sends this call internally.

◆ select()

void liblec::lecui::widget_manager::select ( const std::string &  path)

Select a widget.

Parameters
pathThe full path to the widget, e.g. "home_page/username".

Any previous selection within the page is removed. Note that a call to form::update() is not necessary after this method is called because it sends this call internally.

◆ show()

bool liblec::lecui::widget_manager::show ( const std::string &  path,
std::string &  error 
)

Show a widget.

Parameters
pathThe full path to the widget, e.g. "home_page/username".
errorError information.
Returns
Returns true if successful, else false.

Note that a call to form::update() is not necessary after this method is called because it sends this call internally.


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