18 UnregisterClassW(className.data(), GetModuleHandleW(
nullptr));
27 GetWindowLongPtrW(handle, GWL_STYLE) | newStyle
37 GetWindowLongPtrW(handle, GWL_STYLE) & ~styleToRemove
41 string to_string(wstring_view stringToConvert, uint32_t codepage)
45 int size = WideCharToMultiByte
49 stringToConvert.data(),
59 throw json::exceptions::WrongEncodingException();
62 result.resize(
static_cast<size_t>(size) - 1);
64 if (!WideCharToMultiByte
68 stringToConvert.data(),
76 throw json::exceptions::WrongEncodingException();
82 wstring
to_wstring(
const string& stringToConvert, uint32_t codepage)
86 int size = MultiByteToWideChar
90 stringToConvert.data(),
98 throw json::exceptions::WrongEncodingException();
101 result.resize(
static_cast<size_t>(size) - 1);
103 if (!MultiByteToWideChar
107 stringToConvert.data(),
113 throw json::exceptions::WrongEncodingException();
121 return GetModuleHandleW(
nullptr);
126 ostringstream fixRawString;
129 fixRawString << pathFromRawString;
131 fixedPath = fixRawString.str();
133 erase(fixedPath,
'\"');
141 const HMODULE& module = instance.
getModules().at(moduleName);
156 const HMODULE& module = instance.
getModules().at(moduleName);
170 return (GetSystemMetrics(SM_CXSCREEN) - GetSystemMetrics(SM_CXBORDER) - width) / 2;
175 return (GetSystemMetrics(SM_CYSCREEN) - GetSystemMetrics(SM_CYBORDER) - height) / 2;
195 catch (
const json::exceptions::CantFindValueException&)
201 string extendedException(
const string& exceptionMessage, string_view fileName, string_view methodName,
int line)
207 return format(R
"({} in file "{}" in "{}" method on {} line)"sv, exceptionMessage, fileName.substr(fileName.rfind('\\') + 1), methodName, line);
210 catch (
const json::exceptions::CantFindValueException&)
215 return exceptionMessage;
Singleton with GUIFramework settings and some functionality.
const std::unordered_map< std::string, HMODULE, localization::utility::StringViewHash, localization::utility::StringViewEqual > & getModules() const
Get all loaded modules.
static GUIFramework & get()
Singleton instance access.
Throws by setOn... methods.
Throws by not implemented methods.
virtual const std::function< bool()> & getOnClose() const final
bool useOnClose(any topLevelWindow)
string extendedException(const string &exceptionMessage, string_view fileName, string_view methodName, int line)
void throwNotImplementedException(string_view methodName, string_view className)
const std::string usingNotImplementedExceptions
const std::string usingExtendedExceptions
wstring to_wstring(const string &stringToConvert, uint32_t codepage)
HMODULE getCurrentModule()
Get handle to current executable.
void loadFunctionFromModule(function< void()> &onClick, const string &functionName, const string &moduleName)
int getCenterY(int height)
Get center Y coordinate.
string getStringFromRawPath(const filesystem::path &pathFromRawString)
int getCenterX(int width)
Get center X coordinate.
void removeStyle(HWND handle, LONG_PTR styleToRemove)
Remove WinAPI style.
void unregisterClass(wstring_view className)
void loadEventCallbackFromModule(function< void(const wstring &)> &eventCallback, const string &functionName, const string &moduleName)
string getGUIFrameworkVersion()
Get current version of GUIFramework.
void appendStyle(HWND handle, LONG_PTR newStyle)
Append WinAPI style.
string to_string(wstring_view stringToConvert, uint32_t codepage)
void(*)() onClickSignature
Default on click signature.
void(*)(const std::wstring &) richEditCallbackSignature
Used in rich edit auto url detect events.