mirror of
https://github.com/mudita/MuditaOS.git
synced 2026-06-27 01:36:59 -04:00
* Moved ApplicationLauncher to separate files - declutering * WindowsStore renamed to WindowsFactory - Store needs to be splitted toavoid antipattern * Options window build dynamically onBeforeShow * Dialog windows dynamically built
53 lines
1.2 KiB
C++
53 lines
1.2 KiB
C++
#pragma once
|
|
|
|
#include <memory>
|
|
#include <map>
|
|
#include <vector>
|
|
#include <string>
|
|
#include <AppWindow.hpp>
|
|
|
|
namespace app
|
|
{
|
|
|
|
class Application;
|
|
|
|
class WindowsStack
|
|
{
|
|
Application *parent;
|
|
|
|
public:
|
|
WindowsStack(Application *parent) : parent(parent)
|
|
{}
|
|
|
|
std::vector<std::string> stack;
|
|
std::map<std::string, std::unique_ptr<gui::AppWindow>> windows;
|
|
|
|
std::map<std::string, std::unique_ptr<gui::AppWindow>>::const_iterator begin() const
|
|
{
|
|
return std::begin(windows);
|
|
}
|
|
|
|
std::map<std::string, std::unique_ptr<gui::AppWindow>>::const_iterator end() const
|
|
{
|
|
return std::end(windows);
|
|
}
|
|
|
|
[[nodiscard]] auto getParent() const
|
|
{
|
|
return parent;
|
|
}
|
|
|
|
auto push(const std::string &name, std::unique_ptr<gui::AppWindow> window)
|
|
{
|
|
windows[name] = std::move(window);
|
|
stack.push_back(name);
|
|
}
|
|
|
|
gui::AppWindow *get(const std::string &name)
|
|
{
|
|
auto ret = windows.find(name);
|
|
return ret == std::end(windows) ? nullptr : ret->second.get();
|
|
}
|
|
};
|
|
} // namespace app
|