API Documentation
Public Member Functions | List of all members
nkWinUi::System Class Referencefinal

The main system of the component. More...

Inheritance diagram for nkWinUi::System:

Public Member Functions

 System () noexcept
 
virtual ~System ()
 
bool initialize ()
 
bool createDefaultTheme () const
 
WindowingSystemgetWindowingSystem () const
 
ClipboardgetClipboard () const
 
NotificatorgetNotificator () const
 
ComponentManagergetComponentManager () const
 
CursorManagergetCursorManager () const
 
FontManagergetFontManager () const
 
ImageManagergetImageManager () const
 
InputSystemgetInputSystem () const
 
LogManagergetLogManager () const
 
ThemeManagergetThemeManager () const
 
std::function< bool()> getRunCallback () const
 
bool isInitialized () const
 
runRoutine getRunCallback () const
 
void setRunCallback (std::function< bool()> callback)
 
void run ()
 
void tick ()
 
void prepareForShutdown ()
 
void shutdown ()
 
void notifyEvent ()
 

Detailed Description

The main system of the component.

Used to boot the component, and then automate some functionalities like the program loop. The system can be used as a Singleton, or as an isolated instance. For most cases, the Singleton usage should be sufficient. However, if another totally isolated system is needed for a limited lifetime or comfort, it can be instantiated elsewhere. Do note that depending on the WindowingSystem used, while the created resources will be isolated, the underlying used API might be in a common context depending on its limitations.

Constructor & Destructor Documentation

◆ System()

nkWinUi::System::System ( )
noexcept

Default constructor. This constructor can directly be used to instantiate an isolated system instance. The other way to get a system would be through its getInstance() method, which will then be the singleton instance. Both approach can be used freely, as any system created is fully autonomous. An isolated instance offers more control over where it is used and what has access to it, while the Singleton one is usable anywhere, making it easy to use.

◆ ~System()

virtual nkWinUi::System::~System ( )
virtual

Destructor.

Member Function Documentation

◆ initialize()

bool nkWinUi::System::initialize ( )

Initialization of the component. Has to be called before being able to use the component.

Returns
If the initialization process went smoothly (true) or not (false).

◆ createDefaultTheme()

bool nkWinUi::System::createDefaultTheme ( ) const

Creates the default theme. Part of the initialization routine.

Returns
If the initialization went smoothly (true) or not (false).

◆ getWindowingSystem()

WindowingSystem* nkWinUi::System::getWindowingSystem ( ) const
Returns
The active windowing system. Currently not exposed.

◆ getClipboard()

Clipboard* nkWinUi::System::getClipboard ( ) const
Returns
The clipboard compatible with this system.

◆ getNotificator()

Notificator* nkWinUi::System::getNotificator ( ) const
Returns
The notificator compatible with this system.

◆ getComponentManager()

ComponentManager* nkWinUi::System::getComponentManager ( ) const
Returns
The component manager compatible with this system.
Remarks
The returned instance will be the equivalent of ComponentManager::getInstance() if the System is also the instance from System::getInstance(). Else, it will be a fully isolated instance, only accessible through this getter.

◆ getCursorManager()

CursorManager* nkWinUi::System::getCursorManager ( ) const
Returns
The cursor manager compatible with this system.
Remarks
The returned instance will be the equivalent of CursorManager::getInstance() if the System is also the instance from System::getInstance(). Else, it will be a fully isolated instance, only accessible through this getter.

◆ getFontManager()

FontManager* nkWinUi::System::getFontManager ( ) const
Returns
The font manager compatible with this system.
Remarks
The returned instance will be the equivalent of FontManager::getInstance() if the System is also the instance from System::getInstance(). Else, it will be a fully isolated instance, only accessible through this getter.

◆ getImageManager()

ImageManager* nkWinUi::System::getImageManager ( ) const
Returns
The image manager compatible with this system.
Remarks
The returned instance will be the equivalent of ImageManager::getInstance() if the System is also the instance from System::getInstance(). Else, it will be a fully isolated instance, only accessible through this getter.

◆ getInputSystem()

InputSystem* nkWinUi::System::getInputSystem ( ) const
Returns
The input system compatible with this system.
Remarks
The returned instance will be the equivalent of InputSystem::getInstance() if the System is also the instance from System::getInstance(). Else, it will be a fully isolated instance, only accessible through this getter.

◆ getLogManager()

LogManager* nkWinUi::System::getLogManager ( ) const
Returns
The log manager compatible with this system.
Remarks
The returned instance will be the equivalent of LogManager::getInstance() if the System is also the instance from System::getInstance(). Else, it will be a fully isolated instance, only accessible through this getter.

◆ getThemeManager()

ThemeManager* nkWinUi::System::getThemeManager ( ) const
Returns
The theme manager compatible with this system.
Remarks
The returned instance will be the equivalent of ThemeManager::getInstance() if the System is also the instance from System::getInstance(). Else, it will be a fully isolated instance, only accessible through this getter.

◆ getRunCallback() [1/2]

std::function<bool ()> nkWinUi::System::getRunCallback ( ) const
Returns
The currently used run callback.

◆ isInitialized()

bool nkWinUi::System::isInitialized ( ) const
Returns
If the component is correctly initialized (true) or not (false).

◆ getRunCallback() [2/2]

runRoutine nkWinUi::System::getRunCallback ( ) const
Returns
The currently set run callback.

◆ setRunCallback()

void nkWinUi::System::setRunCallback ( std::function< bool()>  callback)

Sets the callback for the running loop. This callback is called when the run() function is used, whenever the loop has done a tick.

Parameters
callbackThe callback to use.

◆ run()

void nkWinUi::System::run ( )

Enters the running loop, until the program is ended.

◆ tick()

void nkWinUi::System::tick ( )

If the running loop has to be run by external code, this function can be called within that function to tick the windowing system. Ticking comprises event handling, for instance.

◆ prepareForShutdown()

void nkWinUi::System::prepareForShutdown ( )

Prepares the component for shutdown. Has to be calkled before shutdown().

◆ shutdown()

void nkWinUi::System::shutdown ( )

Shuts the component, typically when the program ends.

◆ notifyEvent()

void nkWinUi::System::notifyEvent ( )

Fire an empty message to force an event down the system. Can be used in the running context to force a tick to occur, as depending on the windowing system it can wait for events before ticking.


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