|
GUIFramework 1.1.0
Framework for desktop GUI applications in C++.
|
Singleton with GUIFramework settings and some functionality. More...
#include <GUIFramework.h>
Classes | |
| struct | hotkeyData |
Public Member Functions | |
| std::unique_ptr< threading::Future > | addTask (const std::function< void()> &task, const std::function< void()> &callback=nullptr) |
| Add task to thread pool. Thread safe method. | |
| std::unique_ptr< threading::Future > | addTask (const std::function< void()> &task, std::function< void()> &&callback) |
| Add task to thread pool. Thread safe method. | |
| std::unique_ptr< threading::Future > | addTask (std::function< void()> &&task, const std::function< void()> &callback=nullptr) |
| Add task to thread pool. Thread safe method. | |
| std::unique_ptr< threading::Future > | addTask (std::function< void()> &&task, std::function< void()> &&callback) |
| Add task to thread pool. Thread safe method. | |
| size_t | registerHotkey (hotkeys::keys key, const std::function< void()> &onClick, const std::vector< hotkeys::additionalKeys > &additionalKeys={}) |
| Only works in thread, that call runMainLoop from WindowHolder. Thread safe register hotkey. | |
| size_t | registerHotkey (hotkeys::keys key, const std::string &functionName, const std::string &moduleName, const std::vector< hotkeys::additionalKeys > &additionalKeys={}) |
| Only works in thread, that call runMainLoop from WindowHolder. Thread safe register hotkey. | |
| bool | unregisterHotkey (size_t hotkeyId) |
| Thread safe unregister hotkey. | |
| bool | unregisterHotkey (uint32_t key, const std::vector< hotkeys::additionalKeys > &additionalKeys={}) |
| Thread safe unregister hotkey. | |
| std::vector< hotkeyData > | getRegisteredHotkeys () |
| Thread safe get hotkeys. | |
| void | loadModule (const std::string &moduleName, const std::filesystem::path &pathToModule) |
| Load module with some sort of data. | |
| void | unloadModule (const std::string &moduleName) |
| Unload module. | |
| bool | isExist (BaseComponent *component) |
| Check if component created. If component destroyed after you call findComponent, you may have not valid pointer. | |
| std::vector< json::utility::jsonObject > | serializeHotkeys () |
| Serialize hotkeys. | |
| void | deserializeHotkeys (const json::utility::jsonObject &description) |
| Deserialize hotkeys. | |
| bool | isModulesLoaded () const |
| Check if modules are loaded. You can call getCantLoadedModules() to check if loaded modules have failed. | |
| void | changeLocalization (const std::string &language) const |
| Change localization for all components. | |
| const std::unordered_map< size_t, smartPointerType< utility::BaseComponentCreator > > & | getCreators () const |
| Get all current registered creators. | |
| const std::unordered_map< size_t, smartPointerType< interfaces::IDeserializer > > & | getDeserializers () const |
| Get all current registered deserializers. | |
| const json::JSONParser & | getJSONSettings () const |
| Get settings from gui_framework.json. | |
| const std::unordered_map< std::string, HMODULE, localization::utility::StringViewHash, localization::utility::StringViewEqual > & | getModules () const |
| Get all loaded modules. | |
| const std::unordered_map< std::string, std::string > & | getModulesPaths () const |
| Get all loaded modules paths. | |
| std::vector< std::string > | getCantLoadedModules () |
| List of all exceptions in load modules process. | |
| HMODULE | operator[] (const std::string &moduleName) const |
| Get handle to specific module. | |
| template<typename T = BaseComponent> | |
| T * | findComponent (HWND handle) |
| Thread safe. | |
| template<typename T = BaseComponent> | |
| T * | findComponent (const std::wstring &componentName) |
| Thread safe. | |
| template<std::derived_from< BaseComponent > T, std::derived_from< utility::BaseComponentCreator > CreatorT, typename... Args> | |
| void | addCreator (Args &&... args) |
| Add derived from BaseComponentCreator creator. | |
| template<std::derived_from< BaseComponent > T, std::derived_from< interfaces::IDeserializer > DeserializerT, typename... Args> | |
| void | addDeserializer (Args &&... args) |
| Add derived from IDeserializer deserializer. | |
Static Public Member Functions | |
| static GUIFramework & | get () |
| Singleton instance access. | |
| static void | runOnUIThread (const std::function< void()> &function) |
| Run function in UI thread. Functions processed only when window in main UI thread has focus. | |
| static void | runOnUIThread (std::function< void()> &&function) |
| Run function in UI thread. Functions processed only when window in main UI thread has focus. | |
| static void | restartApplication (int exitCode=0) |
| Restart application with given exit code. | |
| static DWORD | getUIThreadId () |
| Getter for UI thread id. | |
| static std::string | getGUIFrameworkVersion () |
| Get current GUIFramework version. | |
Friends | |
| class | BaseComponent |
| class | WindowHolder |
| class | BaseDialogBox |
| class | BaseMainWindow |
| struct | std::default_delete< GUIFramework > |
Singleton with GUIFramework settings and some functionality.
Definition at line 23 of file GUIFramework.h.
| void gui_framework::GUIFramework::addCreator | ( | Args &&... | args | ) |
Add derived from BaseComponentCreator creator.
Definition at line 323 of file GUIFramework.h.
| void gui_framework::GUIFramework::addDeserializer | ( | Args &&... | args | ) |
Add derived from IDeserializer deserializer.
Definition at line 329 of file GUIFramework.h.
| std::unique_ptr< threading::Future > gui_framework::GUIFramework::addTask | ( | const std::function< void()> & | task, |
| const std::function< void()> & | callback = nullptr ) |
Add task to thread pool. Thread safe method.
| task | Task function |
| callback | After execution task callback function |
| std::runtime_error | Can't find threadsCount setting in gui_framework.json |
| std::unique_ptr< threading::Future > gui_framework::GUIFramework::addTask | ( | const std::function< void()> & | task, |
| std::function< void()> && | callback ) |
Add task to thread pool. Thread safe method.
| task | Task function |
| callback | After execution task callback function |
| std::runtime_error | Can't find threadsCount setting in gui_framework.json |
| std::unique_ptr< threading::Future > gui_framework::GUIFramework::addTask | ( | std::function< void()> && | task, |
| const std::function< void()> & | callback = nullptr ) |
Add task to thread pool. Thread safe method.
| task | Task function |
| callback | After execution task callback function |
| std::runtime_error | Can't find threadsCount setting in gui_framework.json |
| std::unique_ptr< threading::Future > gui_framework::GUIFramework::addTask | ( | std::function< void()> && | task, |
| std::function< void()> && | callback ) |
Add task to thread pool. Thread safe method.
| task | Task function |
| callback | After execution task callback function |
| std::runtime_error | Can't find threadsCount setting in gui_framework.json |
| void gui_framework::GUIFramework::changeLocalization | ( | const std::string & | language | ) | const |
Change localization for all components.
| language | New language |
Definition at line 950 of file GUIFramework.cpp.
| void gui_framework::GUIFramework::deserializeHotkeys | ( | const json::utility::jsonObject & | description | ) |
Deserialize hotkeys.
| description | Description of holder window with 'hotkeys' object |
Definition at line 921 of file GUIFramework.cpp.
| T * gui_framework::GUIFramework::findComponent | ( | const std::wstring & | componentName | ) |
Thread safe.
| componentName |
Definition at line 313 of file GUIFramework.h.
| T * gui_framework::GUIFramework::findComponent | ( | HWND | handle | ) |
Thread safe.
| handle |
Definition at line 303 of file GUIFramework.h.
|
static |
Singleton instance access.
| json::exceptions::CantFindValueException | Unable to find setting in gui_framework.json on first GUIFramework::get() call @excepiton std::runtime_error Can't find gui_framework.json |
| vector< string > gui_framework::GUIFramework::getCantLoadedModules | ( | ) |
List of all exceptions in load modules process.
Definition at line 989 of file GUIFramework.cpp.
| const unordered_map< size_t, smartPointerType< utility::BaseComponentCreator > > & gui_framework::GUIFramework::getCreators | ( | ) | const |
Get all current registered creators.
Definition at line 964 of file GUIFramework.cpp.
| const unordered_map< size_t, smartPointerType< interfaces::IDeserializer > > & gui_framework::GUIFramework::getDeserializers | ( | ) | const |
Get all current registered deserializers.
Definition at line 969 of file GUIFramework.cpp.
|
static |
Get current GUIFramework version.
Definition at line 697 of file GUIFramework.cpp.
| const json::JSONParser & gui_framework::GUIFramework::getJSONSettings | ( | ) | const |
Get settings from gui_framework.json.
Definition at line 974 of file GUIFramework.cpp.
| const unordered_map< string, HMODULE, localization::utility::StringViewHash, localization::utility::StringViewEqual > & gui_framework::GUIFramework::getModules | ( | ) | const |
| const unordered_map< string, string > & gui_framework::GUIFramework::getModulesPaths | ( | ) | const |
| vector< GUIFramework::hotkeyData > gui_framework::GUIFramework::getRegisteredHotkeys | ( | ) |
|
static |
| bool gui_framework::GUIFramework::isExist | ( | BaseComponent * | component | ) |
Check if component created. If component destroyed after you call findComponent, you may have not valid pointer.
| component | Value from |
Definition at line 880 of file GUIFramework.cpp.
| bool gui_framework::GUIFramework::isModulesLoaded | ( | ) | const |
Check if modules are loaded. You can call getCantLoadedModules() to check if loaded modules have failed.
Definition at line 943 of file GUIFramework.cpp.
| void gui_framework::GUIFramework::loadModule | ( | const std::string & | moduleName, |
| const std::filesystem::path & | pathToModule ) |
Load module with some sort of data.
| moduleName | Name of that module |
| pathToModule | Path to that module @excepiton FileDoesNotExist |
| CantLoadModule |
| HMODULE gui_framework::GUIFramework::operator[] | ( | const std::string & | moduleName | ) | const |
Get handle to specific module.
| moduleName |
| std::out_of_range |
Definition at line 996 of file GUIFramework.cpp.
| size_t gui_framework::GUIFramework::registerHotkey | ( | hotkeys::keys | key, |
| const std::function< void()> & | onClick, | ||
| const std::vector< hotkeys::additionalKeys > & | additionalKeys = {} ) |
Only works in thread, that call runMainLoop from WindowHolder. Thread safe register hotkey.
| key | Value from keys enum or https://docs.microsoft.com/en-us/windows/win32/inputdev/virtual-key-codes |
| onClick | Function to call |
| additionalKeys |
| size_t gui_framework::GUIFramework::registerHotkey | ( | hotkeys::keys | key, |
| const std::string & | functionName, | ||
| const std::string & | moduleName, | ||
| const std::vector< hotkeys::additionalKeys > & | additionalKeys = {} ) |
Only works in thread, that call runMainLoop from WindowHolder. Thread safe register hotkey.
| key | Value from keys enum or https://docs.microsoft.com/en-us/windows/win32/inputdev/virtual-key-codes |
| functionName | Name of function to call |
| moduleName | Name of module where function store |
| additionalKeys |
| CantFindFunctionFromModuleException | |
| std::out_of_range | Can't find moduleName in loaded modules |
|
static |
Restart application with given exit code.
| exitCode | Exit code for previous application |
| GetLastErrorException |
Definition at line 660 of file GUIFramework.cpp.
|
static |
Run function in UI thread. Functions processed only when window in main UI thread has focus.
| function | Function that will run in UI thread |
|
static |
Run function in UI thread. Functions processed only when window in main UI thread has focus.
| function | Function that will run in UI thread |
| vector< json::utility::jsonObject > gui_framework::GUIFramework::serializeHotkeys | ( | ) |
Serialize hotkeys.
Definition at line 885 of file GUIFramework.cpp.
| void gui_framework::GUIFramework::unloadModule | ( | const std::string & | moduleName | ) |
Unload module.
| moduleName | Name of module to unload |
Definition at line 866 of file GUIFramework.cpp.
| bool gui_framework::GUIFramework::unregisterHotkey | ( | size_t | hotkeyId | ) |
Thread safe unregister hotkey.
| hotkeyId | Return value from registerHotkey |
Definition at line 789 of file GUIFramework.cpp.
| bool gui_framework::GUIFramework::unregisterHotkey | ( | uint32_t | key, |
| const std::vector< hotkeys::additionalKeys > & | additionalKeys = {} ) |
Thread safe unregister hotkey.
| key | Value from https://docs.microsoft.com/en-us/windows/win32/inputdev/virtual-key-codes |
| additionalKeys |
Definition at line 811 of file GUIFramework.cpp.
|
friend |
Definition at line 294 of file GUIFramework.h.
|
friend |
Definition at line 296 of file GUIFramework.h.
|
friend |
Definition at line 297 of file GUIFramework.h.
|
friend |
Definition at line 297 of file GUIFramework.h.
|
friend |
Definition at line 295 of file GUIFramework.h.