diff options
| author | Akshay Nair <phenax5@gmail.com> | 2025-03-29 11:45:18 +0530 |
|---|---|---|
| committer | Akshay Nair <phenax5@gmail.com> | 2025-03-29 11:45:18 +0530 |
| commit | bcecbced7e1af9d99443a7e823f18328c7943f09 (patch) | |
| tree | 612fac477acfa38358e15916bd4a44f386dc9206 /src/WindowActionRouter.hpp | |
| parent | f7392096d2d84be7143947d386528bf4f487ee83 (diff) | |
| download | null-browser-bcecbced7e1af9d99443a7e823f18328c7943f09.tar.gz null-browser-bcecbced7e1af9d99443a7e823f18328c7943f09.zip | |
Add window action router for multi-window
Diffstat (limited to '')
| -rw-r--r-- | src/WindowActionRouter.hpp | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/src/WindowActionRouter.hpp b/src/WindowActionRouter.hpp new file mode 100644 index 0000000..b6cd731 --- /dev/null +++ b/src/WindowActionRouter.hpp @@ -0,0 +1,30 @@ +#pragma once + +#include "widgets/BrowserWindow.hpp" +#include <QWidget> +#include <QtCore> +#include <cstdint> +#include <unordered_map> + +using WindowId = uint64_t; +using WindowMap = std::unordered_map<uint64_t, BrowserWindow *>; + +class WindowActionRouter : public QWidget { + Q_OBJECT + +public: + static WindowActionRouter *instance() { + static auto *router = new WindowActionRouter; + return router; + } + + void add_window(BrowserWindow *window); + const WindowMap &windows(); + +protected: + WindowActionRouter(); + +private: + WindowMap window_map; + uint64_t last_id = 1; +}; |
