The main system of the component. More...
Public Member Functions | |
System () noexcept | |
virtual | ~System () |
bool | initialize () |
bool | createDefaultTheme () const |
WindowingSystem * | getWindowingSystem () const |
Clipboard * | getClipboard () const |
Notificator * | getNotificator () const |
ComponentManager * | getComponentManager () const |
CursorManager * | getCursorManager () const |
FontManager * | getFontManager () const |
ImageManager * | getImageManager () const |
InputSystem * | getInputSystem () const |
LogManager * | getLogManager () const |
ThemeManager * | getThemeManager () 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 () |
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.
|
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.
|
virtual |
Destructor.
bool nkWinUi::System::initialize | ( | ) |
Initialization of the component. Has to be called before being able to use the component.
bool nkWinUi::System::createDefaultTheme | ( | ) | const |
Creates the default theme. Part of the initialization routine.
WindowingSystem* nkWinUi::System::getWindowingSystem | ( | ) | const |
Clipboard* nkWinUi::System::getClipboard | ( | ) | const |
Notificator* nkWinUi::System::getNotificator | ( | ) | const |
ComponentManager* nkWinUi::System::getComponentManager | ( | ) | const |
CursorManager* nkWinUi::System::getCursorManager | ( | ) | const |
FontManager* nkWinUi::System::getFontManager | ( | ) | const |
ImageManager* nkWinUi::System::getImageManager | ( | ) | const |
InputSystem* nkWinUi::System::getInputSystem | ( | ) | const |
LogManager* nkWinUi::System::getLogManager | ( | ) | const |
ThemeManager* nkWinUi::System::getThemeManager | ( | ) | const |
std::function<bool ()> nkWinUi::System::getRunCallback | ( | ) | const |
bool nkWinUi::System::isInitialized | ( | ) | const |
runRoutine nkWinUi::System::getRunCallback | ( | ) | const |
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.
callback | The callback to use. |
void nkWinUi::System::run | ( | ) |
Enters the running loop, until the program is ended.
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.
void nkWinUi::System::prepareForShutdown | ( | ) |
Prepares the component for shutdown. Has to be calkled before shutdown().
void nkWinUi::System::shutdown | ( | ) |
Shuts the component, typically when the program ends.
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.