GUIFramework 1.1.0
Framework for desktop GUI applications in C++.
Loading...
Searching...
No Matches
BaseMainWindow.h
Go to the documentation of this file.
1#pragma once
2
4
5namespace gui_framework
6{
11 {
12 public:
13 struct Function
14 {
15 std::function<void()> callable;
16 std::string functionName;
17 std::string moduleName;
18
19 Function(const std::function<void()>& callable);
20
21 Function(const std::string& functionName, const std::string& moduleName);
22
23 ~Function() = default;
24 };
25
26 private:
27 NOTIFYICONDATAW tray;
28 HMENU trayPopupMenu;
29 uint32_t trayId;
30 std::vector<std::pair<uint32_t, Function>> popupMenuItems;
31 int clicks;
32 uint16_t trayIconResource;
33 bool alwaysShowTrayIcon;
34
35 protected:
36 virtual void onDestroyEvent();
37
38 virtual void createMarkup();
39
40 virtual LRESULT windowMessagesHandle(HWND handle, UINT message, WPARAM wparam, LPARAM lparam, bool& isUsed) override;
41
42 public:
49 BaseMainWindow(const std::wstring& className, const std::wstring& titleName, const utility::ComponentSettings& settings, const std::string& windowFunctionName, uint16_t trayIconResource, bool alwaysShowTray = false, bool maximize = false, bool minimize = false, const std::string& moduleName = "", uint16_t smallIconResource = NULL, uint16_t largeIconResource = NULL);
50
51 void initTray(uint16_t trayIconResource, bool alwaysShowTrayIcon);
52
56 bool addTrayMenuItem(const std::wstring& text, const std::function<void()>& onClick, uint32_t* menuItemId = nullptr);
57
61 bool addTrayMenuItem(const std::wstring& text, const std::string& functionName, const std::string& moduleName, uint32_t* menuItemId = nullptr);
62
66 bool removeTrayMenuItem(const std::wstring& text);
67
72 void sendTrayMessage(uint32_t id);
73
74 virtual size_t getHash() const override;
75
76 virtual json::JSONBuilder getStructure() const override;
77
78 virtual ~BaseMainWindow();
79
80 friend class WindowHolder;
81 };
82}
#define GUI_FRAMEWORK_API
Setup for main application window.
bool addTrayMenuItem(const std::wstring &text, const std::string &functionName, const std::string &moduleName, uint32_t *menuItemId=nullptr)
Add tray menu text item. Works only if non NULL value passed in trayIconResource in contructor.
bool addTrayMenuItem(const std::wstring &text, const std::function< void()> &onClick, uint32_t *menuItemId=nullptr)
Add tray menu text item. Works only if non NULL value passed in trayIconResource in contructor.
Base class for separate windows.
Provides runMainLoop for top level window.
Function(const std::string &functionName, const std::string &moduleName)
Function(const std::function< void()> &callable)