plusui-native-core 0.1.105 → 0.1.107
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/Core/.cache/clangd/index/api.hpp.016B34C8046EF490.idx +0 -0
- package/Core/.cache/clangd/index/app.cpp.1E6FAF043D496421.idx +0 -0
- package/Core/.cache/clangd/index/app.hpp.FA0E5D412C4E6148.idx +0 -0
- package/Core/.cache/clangd/index/browser.cpp.9461A2CAF129F1D9.idx +0 -0
- package/Core/.cache/clangd/index/browser.hpp.BE40AE80881B3107.idx +0 -0
- package/Core/.cache/clangd/index/clipboard.cpp.2399913537B2A7AD.idx +0 -0
- package/Core/.cache/clangd/index/clipboard.hpp.C1095DDACD7149E9.idx +0 -0
- package/Core/.cache/clangd/index/connect.cpp.518C66C7C28B30A9.idx +0 -0
- package/Core/.cache/clangd/index/connect.hpp.08E2F7CD13B78601.idx +0 -0
- package/Core/.cache/clangd/index/connection.hpp.849FAEF1523BF2C3.idx +0 -0
- package/Core/.cache/clangd/index/display.cpp.F6F6D932BF9F8D8E.idx +0 -0
- package/Core/.cache/clangd/index/display.hpp.0C1A9CAD11EE4404.idx +0 -0
- package/Core/.cache/clangd/index/filedrop.cpp.669B524B3C501C52.idx +0 -0
- package/Core/.cache/clangd/index/filedrop.hpp.48460099C3F35F2D.idx +0 -0
- package/Core/.cache/clangd/index/keyboard.cpp.DC6D34E4A4F798DD.idx +0 -0
- package/Core/.cache/clangd/index/keyboard.hpp.F016CB68D7DE5A46.idx +0 -0
- package/Core/.cache/clangd/index/keyboard_linux.cpp.B403FDCEA7A6CA53.idx +0 -0
- package/Core/.cache/clangd/index/menu.cpp.3059F08D8D2DF265.idx +0 -0
- package/Core/.cache/clangd/index/menu.hpp.8716DCCC573910D4.idx +0 -0
- package/Core/.cache/clangd/index/plusui.hpp.8CFCDFDC2E3F41DD.idx +0 -0
- package/Core/.cache/clangd/index/router.cpp.EAC9EAD34C59E573.idx +0 -0
- package/Core/.cache/clangd/index/router.hpp.2B06E2EE9998468D.idx +0 -0
- package/Core/.cache/clangd/index/stb_image.h.E26CF48FE089A0D3.idx +0 -0
- package/Core/.cache/clangd/index/tray.cpp.92F244E7E1D7F0EC.idx +0 -0
- package/Core/.cache/clangd/index/tray.hpp.0D881B0601BBBD25.idx +0 -0
- package/Core/.cache/clangd/index/webgpu.cpp.FC656FA8BE10FE15.idx +0 -0
- package/Core/.cache/clangd/index/webgpu.hpp.5AF1A5E9DF9E5AE0.idx +0 -0
- package/Core/.cache/clangd/index/window.cpp.191D8C9ADF874B22.idx +0 -0
- package/Core/.cache/clangd/index/window.hpp.B9811B43AA295697.idx +0 -0
- package/Core/.claude/settings.local.json +7 -0
- package/Core/CMakeLists.txt +1 -1
- package/Core/Features/API/app-api.ts +28 -28
- package/Core/Features/API/browser-api.ts +38 -38
- package/Core/Features/API/clipboard-api.ts +21 -21
- package/Core/Features/API/display-api.ts +33 -33
- package/Core/Features/API/keyboard-api.ts +33 -33
- package/Core/Features/API/menu-api.ts +39 -39
- package/Core/Features/API/router-api.ts +23 -23
- package/Core/Features/API/tray-api.ts +22 -22
- package/Core/Features/API/webgpu-api.ts +55 -55
- package/Core/Features/App/app.cpp +135 -102
- package/Core/Features/Browser/browser.cpp +227 -227
- package/Core/Features/Browser/browser.ts +161 -161
- package/Core/Features/Clipboard/clipboard.cpp +235 -235
- package/Core/Features/Display/display.cpp +212 -212
- package/Core/Features/FileDrop/filedrop.cpp +448 -324
- package/Core/Features/FileDrop/filedrop.css +421 -421
- package/Core/Features/FileDrop/filedrop.ts +0 -7
- package/Core/Features/Keyboard/keyboard_linux.cpp +4 -0
- package/Core/Features/Router/router.cpp +62 -62
- package/Core/Features/Router/router.ts +113 -113
- package/Core/Features/Tray/tray.cpp +437 -324
- package/Core/Features/WebGPU/webgpu.cpp +948 -948
- package/Core/Features/Window/webview.cpp +1009 -1009
- package/Core/Features/Window/webview.ts +516 -516
- package/Core/Features/Window/window.cpp +2240 -1986
- package/Core/include/plusui/api.hpp +237 -237
- package/Core/include/plusui/app.hpp +36 -34
- package/Core/include/plusui/browser.hpp +67 -67
- package/Core/include/plusui/clipboard.hpp +41 -41
- package/Core/include/plusui/connect.hpp +340 -340
- package/Core/include/plusui/connection.hpp +3 -3
- package/Core/include/plusui/display.hpp +90 -90
- package/Core/include/plusui/filedrop.hpp +92 -77
- package/Core/include/plusui/keyboard.hpp +112 -112
- package/Core/include/plusui/menu.hpp +153 -153
- package/Core/include/plusui/plusui +18 -18
- package/Core/include/plusui/router.hpp +42 -42
- package/Core/include/plusui/tray.hpp +94 -94
- package/Core/include/plusui/webgpu.hpp +434 -434
- package/Core/include/plusui/window.hpp +180 -177
- package/Core/scripts/generate-umbrella-header.mjs +77 -77
- package/Core/vendor/WebView2EnvironmentOptions.h +406 -406
- package/Core/vendor/webview.h +487 -487
- package/Core/vendor/webview2.h +52079 -52079
- package/README.md +19 -19
- package/package.json +1 -1
|
@@ -1,153 +1,153 @@
|
|
|
1
|
-
#ifndef PLUSUI_MENU_H
|
|
2
|
-
#define PLUSUI_MENU_H
|
|
3
|
-
|
|
4
|
-
#include <functional>
|
|
5
|
-
#include <map>
|
|
6
|
-
#include <memory>
|
|
7
|
-
#include <string>
|
|
8
|
-
#include <vector>
|
|
9
|
-
|
|
10
|
-
namespace plusui {
|
|
11
|
-
class Window;
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
namespace plusui {
|
|
15
|
-
|
|
16
|
-
enum class MenuItemType { Normal, Separator, Submenu, Checkbox, Radio };
|
|
17
|
-
|
|
18
|
-
struct MenuItem {
|
|
19
|
-
std::string id;
|
|
20
|
-
std::string label;
|
|
21
|
-
std::string accelerator;
|
|
22
|
-
std::string icon;
|
|
23
|
-
MenuItemType type = MenuItemType::Normal;
|
|
24
|
-
bool enabled = true;
|
|
25
|
-
bool checked = false;
|
|
26
|
-
std::vector<MenuItem> submenu;
|
|
27
|
-
};
|
|
28
|
-
|
|
29
|
-
struct MenuBarData {
|
|
30
|
-
std::vector<MenuItem> items;
|
|
31
|
-
};
|
|
32
|
-
|
|
33
|
-
class Menu {
|
|
34
|
-
public:
|
|
35
|
-
Menu();
|
|
36
|
-
~Menu();
|
|
37
|
-
|
|
38
|
-
// Move semantics
|
|
39
|
-
Menu(Menu &&other) noexcept;
|
|
40
|
-
Menu &operator=(Menu &&other) noexcept;
|
|
41
|
-
|
|
42
|
-
// Disable copy
|
|
43
|
-
Menu(const Menu &) = delete;
|
|
44
|
-
Menu &operator=(const Menu &) = delete;
|
|
45
|
-
|
|
46
|
-
static Menu create(const std::vector<MenuItem> &items = {});
|
|
47
|
-
|
|
48
|
-
void setItems(const std::vector<MenuItem> &items);
|
|
49
|
-
std::vector<MenuItem> getItems() const;
|
|
50
|
-
|
|
51
|
-
void append(const MenuItem &item);
|
|
52
|
-
void insert(int index, const MenuItem &item);
|
|
53
|
-
void remove(const std::string &id);
|
|
54
|
-
void clear();
|
|
55
|
-
|
|
56
|
-
void popup(int x, int y);
|
|
57
|
-
void close();
|
|
58
|
-
|
|
59
|
-
private:
|
|
60
|
-
struct Impl;
|
|
61
|
-
std::unique_ptr<Impl> pImpl;
|
|
62
|
-
};
|
|
63
|
-
|
|
64
|
-
class MenuBar {
|
|
65
|
-
public:
|
|
66
|
-
MenuBar();
|
|
67
|
-
~MenuBar();
|
|
68
|
-
|
|
69
|
-
static MenuBar &instance();
|
|
70
|
-
|
|
71
|
-
void setMenu(const MenuBarData &menu);
|
|
72
|
-
MenuBarData getMenu() const;
|
|
73
|
-
|
|
74
|
-
void append(const MenuItem &item);
|
|
75
|
-
void insert(int index, const MenuItem &item);
|
|
76
|
-
void remove(const std::string &id);
|
|
77
|
-
void clear();
|
|
78
|
-
|
|
79
|
-
void onMenuItemClick(std::function<void(const std::string &id)> callback);
|
|
80
|
-
|
|
81
|
-
private:
|
|
82
|
-
struct Impl;
|
|
83
|
-
std::unique_ptr<Impl> pImpl;
|
|
84
|
-
};
|
|
85
|
-
|
|
86
|
-
class MenuManager {
|
|
87
|
-
public:
|
|
88
|
-
static MenuManager &instance();
|
|
89
|
-
|
|
90
|
-
// Manage ID to Menu mapping
|
|
91
|
-
std::string createMenu(const std::vector<MenuItem> &items);
|
|
92
|
-
Menu *getMenu(const std::string &id);
|
|
93
|
-
void destroyMenu(const std::string &id);
|
|
94
|
-
|
|
95
|
-
private:
|
|
96
|
-
MenuManager();
|
|
97
|
-
~MenuManager();
|
|
98
|
-
struct Impl;
|
|
99
|
-
};
|
|
100
|
-
|
|
101
|
-
namespace bindings {
|
|
102
|
-
|
|
103
|
-
class MenuBindings {
|
|
104
|
-
public:
|
|
105
|
-
MenuBindings() = default;
|
|
106
|
-
~MenuBindings() = default;
|
|
107
|
-
|
|
108
|
-
void registerBindings(Window &window);
|
|
109
|
-
void setItemClickCallback(
|
|
110
|
-
std::function<void(const std::string &menuId, const std::string &itemId)>
|
|
111
|
-
callback);
|
|
112
|
-
void setContextMenu(const std::vector<MenuItem> &items);
|
|
113
|
-
void enableContextMenu(bool enable);
|
|
114
|
-
void showContextMenuAtCursor();
|
|
115
|
-
|
|
116
|
-
private:
|
|
117
|
-
std::function<void(const std::string &, const std::string &)>
|
|
118
|
-
itemClickCallback_;
|
|
119
|
-
std::vector<MenuItem> contextMenuItems_;
|
|
120
|
-
bool contextMenuEnabled_ = false;
|
|
121
|
-
std::string currentContextMenuId_;
|
|
122
|
-
|
|
123
|
-
std::vector<MenuItem> parseMenuItems(const std::string &json);
|
|
124
|
-
std::string menuItemToJson(const MenuItem &item);
|
|
125
|
-
};
|
|
126
|
-
|
|
127
|
-
class ContextMenuManager {
|
|
128
|
-
public:
|
|
129
|
-
static ContextMenuManager &instance();
|
|
130
|
-
|
|
131
|
-
void setDefaultMenu(const std::vector<MenuItem> &items);
|
|
132
|
-
void setMenuForSelector(const std::string &selector,
|
|
133
|
-
const std::vector<MenuItem> &items);
|
|
134
|
-
void attachToWebView(Window &window);
|
|
135
|
-
void handleRightClick(int x, int y, const std::string &targetSelector);
|
|
136
|
-
void onItemClick(std::function<void(const std::string &itemId,
|
|
137
|
-
const std::string &targetSelector)>
|
|
138
|
-
callback);
|
|
139
|
-
|
|
140
|
-
private:
|
|
141
|
-
ContextMenuManager() = default;
|
|
142
|
-
~ContextMenuManager() = default;
|
|
143
|
-
|
|
144
|
-
std::vector<MenuItem> defaultMenu_;
|
|
145
|
-
std::map<std::string, std::vector<MenuItem>> selectorMenus_;
|
|
146
|
-
std::function<void(const std::string &, const std::string &)> clickCallback_;
|
|
147
|
-
};
|
|
148
|
-
|
|
149
|
-
} // namespace bindings
|
|
150
|
-
|
|
151
|
-
} // namespace plusui
|
|
152
|
-
|
|
153
|
-
#endif
|
|
1
|
+
#ifndef PLUSUI_MENU_H
|
|
2
|
+
#define PLUSUI_MENU_H
|
|
3
|
+
|
|
4
|
+
#include <functional>
|
|
5
|
+
#include <map>
|
|
6
|
+
#include <memory>
|
|
7
|
+
#include <string>
|
|
8
|
+
#include <vector>
|
|
9
|
+
|
|
10
|
+
namespace plusui {
|
|
11
|
+
class Window;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
namespace plusui {
|
|
15
|
+
|
|
16
|
+
enum class MenuItemType { Normal, Separator, Submenu, Checkbox, Radio };
|
|
17
|
+
|
|
18
|
+
struct MenuItem {
|
|
19
|
+
std::string id;
|
|
20
|
+
std::string label;
|
|
21
|
+
std::string accelerator;
|
|
22
|
+
std::string icon;
|
|
23
|
+
MenuItemType type = MenuItemType::Normal;
|
|
24
|
+
bool enabled = true;
|
|
25
|
+
bool checked = false;
|
|
26
|
+
std::vector<MenuItem> submenu;
|
|
27
|
+
};
|
|
28
|
+
|
|
29
|
+
struct MenuBarData {
|
|
30
|
+
std::vector<MenuItem> items;
|
|
31
|
+
};
|
|
32
|
+
|
|
33
|
+
class Menu {
|
|
34
|
+
public:
|
|
35
|
+
Menu();
|
|
36
|
+
~Menu();
|
|
37
|
+
|
|
38
|
+
// Move semantics
|
|
39
|
+
Menu(Menu &&other) noexcept;
|
|
40
|
+
Menu &operator=(Menu &&other) noexcept;
|
|
41
|
+
|
|
42
|
+
// Disable copy
|
|
43
|
+
Menu(const Menu &) = delete;
|
|
44
|
+
Menu &operator=(const Menu &) = delete;
|
|
45
|
+
|
|
46
|
+
static Menu create(const std::vector<MenuItem> &items = {});
|
|
47
|
+
|
|
48
|
+
void setItems(const std::vector<MenuItem> &items);
|
|
49
|
+
std::vector<MenuItem> getItems() const;
|
|
50
|
+
|
|
51
|
+
void append(const MenuItem &item);
|
|
52
|
+
void insert(int index, const MenuItem &item);
|
|
53
|
+
void remove(const std::string &id);
|
|
54
|
+
void clear();
|
|
55
|
+
|
|
56
|
+
void popup(int x, int y);
|
|
57
|
+
void close();
|
|
58
|
+
|
|
59
|
+
private:
|
|
60
|
+
struct Impl;
|
|
61
|
+
std::unique_ptr<Impl> pImpl;
|
|
62
|
+
};
|
|
63
|
+
|
|
64
|
+
class MenuBar {
|
|
65
|
+
public:
|
|
66
|
+
MenuBar();
|
|
67
|
+
~MenuBar();
|
|
68
|
+
|
|
69
|
+
static MenuBar &instance();
|
|
70
|
+
|
|
71
|
+
void setMenu(const MenuBarData &menu);
|
|
72
|
+
MenuBarData getMenu() const;
|
|
73
|
+
|
|
74
|
+
void append(const MenuItem &item);
|
|
75
|
+
void insert(int index, const MenuItem &item);
|
|
76
|
+
void remove(const std::string &id);
|
|
77
|
+
void clear();
|
|
78
|
+
|
|
79
|
+
void onMenuItemClick(std::function<void(const std::string &id)> callback);
|
|
80
|
+
|
|
81
|
+
private:
|
|
82
|
+
struct Impl;
|
|
83
|
+
std::unique_ptr<Impl> pImpl;
|
|
84
|
+
};
|
|
85
|
+
|
|
86
|
+
class MenuManager {
|
|
87
|
+
public:
|
|
88
|
+
static MenuManager &instance();
|
|
89
|
+
|
|
90
|
+
// Manage ID to Menu mapping
|
|
91
|
+
std::string createMenu(const std::vector<MenuItem> &items);
|
|
92
|
+
Menu *getMenu(const std::string &id);
|
|
93
|
+
void destroyMenu(const std::string &id);
|
|
94
|
+
|
|
95
|
+
private:
|
|
96
|
+
MenuManager();
|
|
97
|
+
~MenuManager();
|
|
98
|
+
struct Impl;
|
|
99
|
+
};
|
|
100
|
+
|
|
101
|
+
namespace bindings {
|
|
102
|
+
|
|
103
|
+
class MenuBindings {
|
|
104
|
+
public:
|
|
105
|
+
MenuBindings() = default;
|
|
106
|
+
~MenuBindings() = default;
|
|
107
|
+
|
|
108
|
+
void registerBindings(Window &window);
|
|
109
|
+
void setItemClickCallback(
|
|
110
|
+
std::function<void(const std::string &menuId, const std::string &itemId)>
|
|
111
|
+
callback);
|
|
112
|
+
void setContextMenu(const std::vector<MenuItem> &items);
|
|
113
|
+
void enableContextMenu(bool enable);
|
|
114
|
+
void showContextMenuAtCursor();
|
|
115
|
+
|
|
116
|
+
private:
|
|
117
|
+
std::function<void(const std::string &, const std::string &)>
|
|
118
|
+
itemClickCallback_;
|
|
119
|
+
std::vector<MenuItem> contextMenuItems_;
|
|
120
|
+
bool contextMenuEnabled_ = false;
|
|
121
|
+
std::string currentContextMenuId_;
|
|
122
|
+
|
|
123
|
+
std::vector<MenuItem> parseMenuItems(const std::string &json);
|
|
124
|
+
std::string menuItemToJson(const MenuItem &item);
|
|
125
|
+
};
|
|
126
|
+
|
|
127
|
+
class ContextMenuManager {
|
|
128
|
+
public:
|
|
129
|
+
static ContextMenuManager &instance();
|
|
130
|
+
|
|
131
|
+
void setDefaultMenu(const std::vector<MenuItem> &items);
|
|
132
|
+
void setMenuForSelector(const std::string &selector,
|
|
133
|
+
const std::vector<MenuItem> &items);
|
|
134
|
+
void attachToWebView(Window &window);
|
|
135
|
+
void handleRightClick(int x, int y, const std::string &targetSelector);
|
|
136
|
+
void onItemClick(std::function<void(const std::string &itemId,
|
|
137
|
+
const std::string &targetSelector)>
|
|
138
|
+
callback);
|
|
139
|
+
|
|
140
|
+
private:
|
|
141
|
+
ContextMenuManager() = default;
|
|
142
|
+
~ContextMenuManager() = default;
|
|
143
|
+
|
|
144
|
+
std::vector<MenuItem> defaultMenu_;
|
|
145
|
+
std::map<std::string, std::vector<MenuItem>> selectorMenus_;
|
|
146
|
+
std::function<void(const std::string &, const std::string &)> clickCallback_;
|
|
147
|
+
};
|
|
148
|
+
|
|
149
|
+
} // namespace bindings
|
|
150
|
+
|
|
151
|
+
} // namespace plusui
|
|
152
|
+
|
|
153
|
+
#endif
|
|
@@ -1,18 +1,18 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* PlusUI - Main Framework Header
|
|
3
|
-
*
|
|
4
|
-
* Standard library style include (no .hpp extension needed)
|
|
5
|
-
*
|
|
6
|
-
* Usage:
|
|
7
|
-
* #include <plusui>
|
|
8
|
-
* using namespace plusui;
|
|
9
|
-
*
|
|
10
|
-
* This provides access to all core framework features including:
|
|
11
|
-
* - App & Window management
|
|
12
|
-
* - Browser & WebView
|
|
13
|
-
* - Events & Bindings
|
|
14
|
-
* - FileDrop, Keyboard, Clipboard
|
|
15
|
-
* - Display, Tray, Menu
|
|
16
|
-
*/
|
|
17
|
-
|
|
18
|
-
#include <plusui/plusui.hpp>
|
|
1
|
+
/**
|
|
2
|
+
* PlusUI - Main Framework Header
|
|
3
|
+
*
|
|
4
|
+
* Standard library style include (no .hpp extension needed)
|
|
5
|
+
*
|
|
6
|
+
* Usage:
|
|
7
|
+
* #include <plusui>
|
|
8
|
+
* using namespace plusui;
|
|
9
|
+
*
|
|
10
|
+
* This provides access to all core framework features including:
|
|
11
|
+
* - App & Window management
|
|
12
|
+
* - Browser & WebView
|
|
13
|
+
* - Events & Bindings
|
|
14
|
+
* - FileDrop, Keyboard, Clipboard
|
|
15
|
+
* - Display, Tray, Menu
|
|
16
|
+
*/
|
|
17
|
+
|
|
18
|
+
#include <plusui/plusui.hpp>
|
|
@@ -1,42 +1,42 @@
|
|
|
1
|
-
#ifndef PLUSUI_ROUTER_H
|
|
2
|
-
#define PLUSUI_ROUTER_H
|
|
3
|
-
|
|
4
|
-
#include <string>
|
|
5
|
-
#include <map>
|
|
6
|
-
#include <functional>
|
|
7
|
-
#include <memory>
|
|
8
|
-
#include <vector>
|
|
9
|
-
|
|
10
|
-
namespace plusui {
|
|
11
|
-
|
|
12
|
-
class Router {
|
|
13
|
-
public:
|
|
14
|
-
Router();
|
|
15
|
-
~Router();
|
|
16
|
-
|
|
17
|
-
static Router& instance();
|
|
18
|
-
|
|
19
|
-
void setRoutes(const std::map<std::string, std::string>& routes);
|
|
20
|
-
std::map<std::string, std::string> getRoutes() const;
|
|
21
|
-
|
|
22
|
-
void push(const std::string& route, const std::string& windowId = "");
|
|
23
|
-
void replace(const std::string& route, const std::string& windowId = "");
|
|
24
|
-
|
|
25
|
-
std::string getCurrentRoute(const std::string& windowId = "") const;
|
|
26
|
-
void setInitialRoute(const std::string& route);
|
|
27
|
-
|
|
28
|
-
using RouteChangeCallback = std::function<void(const std::string& route, const std::string& windowId)>;
|
|
29
|
-
void onRouteChange(RouteChangeCallback callback);
|
|
30
|
-
|
|
31
|
-
private:
|
|
32
|
-
struct Impl;
|
|
33
|
-
std::unique_ptr<Impl> pImpl;
|
|
34
|
-
|
|
35
|
-
// Prevent copying
|
|
36
|
-
Router(const Router&) = delete;
|
|
37
|
-
Router& operator=(const Router&) = delete;
|
|
38
|
-
};
|
|
39
|
-
|
|
40
|
-
} // namespace plusui
|
|
41
|
-
|
|
42
|
-
#endif // PLUSUI_ROUTER_H
|
|
1
|
+
#ifndef PLUSUI_ROUTER_H
|
|
2
|
+
#define PLUSUI_ROUTER_H
|
|
3
|
+
|
|
4
|
+
#include <string>
|
|
5
|
+
#include <map>
|
|
6
|
+
#include <functional>
|
|
7
|
+
#include <memory>
|
|
8
|
+
#include <vector>
|
|
9
|
+
|
|
10
|
+
namespace plusui {
|
|
11
|
+
|
|
12
|
+
class Router {
|
|
13
|
+
public:
|
|
14
|
+
Router();
|
|
15
|
+
~Router();
|
|
16
|
+
|
|
17
|
+
static Router& instance();
|
|
18
|
+
|
|
19
|
+
void setRoutes(const std::map<std::string, std::string>& routes);
|
|
20
|
+
std::map<std::string, std::string> getRoutes() const;
|
|
21
|
+
|
|
22
|
+
void push(const std::string& route, const std::string& windowId = "");
|
|
23
|
+
void replace(const std::string& route, const std::string& windowId = "");
|
|
24
|
+
|
|
25
|
+
std::string getCurrentRoute(const std::string& windowId = "") const;
|
|
26
|
+
void setInitialRoute(const std::string& route);
|
|
27
|
+
|
|
28
|
+
using RouteChangeCallback = std::function<void(const std::string& route, const std::string& windowId)>;
|
|
29
|
+
void onRouteChange(RouteChangeCallback callback);
|
|
30
|
+
|
|
31
|
+
private:
|
|
32
|
+
struct Impl;
|
|
33
|
+
std::unique_ptr<Impl> pImpl;
|
|
34
|
+
|
|
35
|
+
// Prevent copying
|
|
36
|
+
Router(const Router&) = delete;
|
|
37
|
+
Router& operator=(const Router&) = delete;
|
|
38
|
+
};
|
|
39
|
+
|
|
40
|
+
} // namespace plusui
|
|
41
|
+
|
|
42
|
+
#endif // PLUSUI_ROUTER_H
|
|
@@ -1,94 +1,94 @@
|
|
|
1
|
-
#ifndef PLUSUI_TRAY_HPP
|
|
2
|
-
#define PLUSUI_TRAY_HPP
|
|
3
|
-
|
|
4
|
-
#include <cstdint>
|
|
5
|
-
#include <functional>
|
|
6
|
-
#include <memory>
|
|
7
|
-
#include <string>
|
|
8
|
-
#include <vector>
|
|
9
|
-
|
|
10
|
-
namespace plusui {
|
|
11
|
-
|
|
12
|
-
struct TrayMenuItem {
|
|
13
|
-
std::string id;
|
|
14
|
-
std::string label;
|
|
15
|
-
bool enabled = true;
|
|
16
|
-
bool checked = false;
|
|
17
|
-
bool separator = false;
|
|
18
|
-
std::vector<TrayMenuItem> submenu;
|
|
19
|
-
};
|
|
20
|
-
|
|
21
|
-
struct TrayIconData {
|
|
22
|
-
std::string tooltip;
|
|
23
|
-
std::string iconPath;
|
|
24
|
-
};
|
|
25
|
-
|
|
26
|
-
class TrayIcon {
|
|
27
|
-
public:
|
|
28
|
-
TrayIcon();
|
|
29
|
-
~TrayIcon();
|
|
30
|
-
|
|
31
|
-
TrayIcon(TrayIcon &&other) noexcept;
|
|
32
|
-
TrayIcon &operator=(TrayIcon &&other) noexcept;
|
|
33
|
-
TrayIcon(const TrayIcon &) = delete;
|
|
34
|
-
TrayIcon &operator=(const TrayIcon &) = delete;
|
|
35
|
-
|
|
36
|
-
static TrayIcon create(const std::string &tooltip = "",
|
|
37
|
-
const std::string &iconPath = "");
|
|
38
|
-
|
|
39
|
-
void setTooltip(const std::string &tooltip);
|
|
40
|
-
void setIcon(const std::string &iconPath);
|
|
41
|
-
void setIconFromData(const std::vector<uint8_t> &data, int width, int height);
|
|
42
|
-
void setIconFromMemory(const unsigned char *data, size_t size);
|
|
43
|
-
|
|
44
|
-
void show();
|
|
45
|
-
void hide();
|
|
46
|
-
bool isVisible() const;
|
|
47
|
-
|
|
48
|
-
void setMenu(const std::vector<TrayMenuItem> &items);
|
|
49
|
-
void setContextMenu(const std::vector<TrayMenuItem> &items);
|
|
50
|
-
|
|
51
|
-
void onClick(std::function<void(int x, int y)> callback);
|
|
52
|
-
void onRightClick(std::function<void(int x, int y)> callback);
|
|
53
|
-
void onDoubleClick(std::function<void()> callback);
|
|
54
|
-
void onMenuItemClick(std::function<void(const std::string &id)> callback);
|
|
55
|
-
|
|
56
|
-
void dispose();
|
|
57
|
-
friend class TrayManager;
|
|
58
|
-
|
|
59
|
-
private:
|
|
60
|
-
struct Impl;
|
|
61
|
-
std::unique_ptr<Impl> pImpl;
|
|
62
|
-
};
|
|
63
|
-
|
|
64
|
-
class TrayManager {
|
|
65
|
-
public:
|
|
66
|
-
TrayManager();
|
|
67
|
-
~TrayManager();
|
|
68
|
-
|
|
69
|
-
static TrayManager &instance();
|
|
70
|
-
|
|
71
|
-
void setWindowHandle(void *hwnd);
|
|
72
|
-
void setIcon(const std::string &iconPath);
|
|
73
|
-
void setIconFromMemory(const unsigned char *data, size_t size);
|
|
74
|
-
void setTooltip(const std::string &tooltip);
|
|
75
|
-
void setVisible(bool visible);
|
|
76
|
-
|
|
77
|
-
std::vector<TrayIcon *> getIcons();
|
|
78
|
-
|
|
79
|
-
void onTrayCreated(std::function<void(TrayIcon &)> callback);
|
|
80
|
-
void onTrayDestroyed(std::function<void(int)> callback);
|
|
81
|
-
|
|
82
|
-
void refresh();
|
|
83
|
-
|
|
84
|
-
private:
|
|
85
|
-
TrayManager(const TrayManager &) = delete;
|
|
86
|
-
TrayManager &operator=(const TrayManager &) = delete;
|
|
87
|
-
|
|
88
|
-
struct Impl;
|
|
89
|
-
std::unique_ptr<Impl> pImpl;
|
|
90
|
-
};
|
|
91
|
-
|
|
92
|
-
} // namespace plusui
|
|
93
|
-
|
|
94
|
-
#endif
|
|
1
|
+
#ifndef PLUSUI_TRAY_HPP
|
|
2
|
+
#define PLUSUI_TRAY_HPP
|
|
3
|
+
|
|
4
|
+
#include <cstdint>
|
|
5
|
+
#include <functional>
|
|
6
|
+
#include <memory>
|
|
7
|
+
#include <string>
|
|
8
|
+
#include <vector>
|
|
9
|
+
|
|
10
|
+
namespace plusui {
|
|
11
|
+
|
|
12
|
+
struct TrayMenuItem {
|
|
13
|
+
std::string id;
|
|
14
|
+
std::string label;
|
|
15
|
+
bool enabled = true;
|
|
16
|
+
bool checked = false;
|
|
17
|
+
bool separator = false;
|
|
18
|
+
std::vector<TrayMenuItem> submenu;
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
struct TrayIconData {
|
|
22
|
+
std::string tooltip;
|
|
23
|
+
std::string iconPath;
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
class TrayIcon {
|
|
27
|
+
public:
|
|
28
|
+
TrayIcon();
|
|
29
|
+
~TrayIcon();
|
|
30
|
+
|
|
31
|
+
TrayIcon(TrayIcon &&other) noexcept;
|
|
32
|
+
TrayIcon &operator=(TrayIcon &&other) noexcept;
|
|
33
|
+
TrayIcon(const TrayIcon &) = delete;
|
|
34
|
+
TrayIcon &operator=(const TrayIcon &) = delete;
|
|
35
|
+
|
|
36
|
+
static TrayIcon create(const std::string &tooltip = "",
|
|
37
|
+
const std::string &iconPath = "");
|
|
38
|
+
|
|
39
|
+
void setTooltip(const std::string &tooltip);
|
|
40
|
+
void setIcon(const std::string &iconPath);
|
|
41
|
+
void setIconFromData(const std::vector<uint8_t> &data, int width, int height);
|
|
42
|
+
void setIconFromMemory(const unsigned char *data, size_t size);
|
|
43
|
+
|
|
44
|
+
void show();
|
|
45
|
+
void hide();
|
|
46
|
+
bool isVisible() const;
|
|
47
|
+
|
|
48
|
+
void setMenu(const std::vector<TrayMenuItem> &items);
|
|
49
|
+
void setContextMenu(const std::vector<TrayMenuItem> &items);
|
|
50
|
+
|
|
51
|
+
void onClick(std::function<void(int x, int y)> callback);
|
|
52
|
+
void onRightClick(std::function<void(int x, int y)> callback);
|
|
53
|
+
void onDoubleClick(std::function<void()> callback);
|
|
54
|
+
void onMenuItemClick(std::function<void(const std::string &id)> callback);
|
|
55
|
+
|
|
56
|
+
void dispose();
|
|
57
|
+
friend class TrayManager;
|
|
58
|
+
|
|
59
|
+
private:
|
|
60
|
+
struct Impl;
|
|
61
|
+
std::unique_ptr<Impl> pImpl;
|
|
62
|
+
};
|
|
63
|
+
|
|
64
|
+
class TrayManager {
|
|
65
|
+
public:
|
|
66
|
+
TrayManager();
|
|
67
|
+
~TrayManager();
|
|
68
|
+
|
|
69
|
+
static TrayManager &instance();
|
|
70
|
+
|
|
71
|
+
void setWindowHandle(void *hwnd);
|
|
72
|
+
void setIcon(const std::string &iconPath);
|
|
73
|
+
void setIconFromMemory(const unsigned char *data, size_t size);
|
|
74
|
+
void setTooltip(const std::string &tooltip);
|
|
75
|
+
void setVisible(bool visible);
|
|
76
|
+
|
|
77
|
+
std::vector<TrayIcon *> getIcons();
|
|
78
|
+
|
|
79
|
+
void onTrayCreated(std::function<void(TrayIcon &)> callback);
|
|
80
|
+
void onTrayDestroyed(std::function<void(int)> callback);
|
|
81
|
+
|
|
82
|
+
void refresh();
|
|
83
|
+
|
|
84
|
+
private:
|
|
85
|
+
TrayManager(const TrayManager &) = delete;
|
|
86
|
+
TrayManager &operator=(const TrayManager &) = delete;
|
|
87
|
+
|
|
88
|
+
struct Impl;
|
|
89
|
+
std::unique_ptr<Impl> pImpl;
|
|
90
|
+
};
|
|
91
|
+
|
|
92
|
+
} // namespace plusui
|
|
93
|
+
|
|
94
|
+
#endif
|