metaforce/Editor/InformationCenter.hpp

52 lines
1.3 KiB
C++
Raw Normal View History

2018-10-07 03:42:33 +00:00
#pragma once
2016-02-02 08:31:05 +00:00
#include "Space.hpp"
#include "ViewManager.hpp"
2018-12-08 05:30:43 +00:00
namespace urde {
class InformationCenter : public ViewerSpace {
struct State : Space::State {
AT_DECL_DNA_YAML
AT_DECL_DNAV
Value<bool> showLog;
} m_state;
2016-02-02 08:31:05 +00:00
2018-12-08 05:30:43 +00:00
const Space::State& spaceState() const { return m_state; }
2016-02-02 08:31:05 +00:00
2018-12-08 05:30:43 +00:00
struct View : specter::View {
InformationCenter& m_ic;
std::vector<hecl::SystemString> m_log;
2016-02-02 08:31:05 +00:00
2018-12-08 05:30:43 +00:00
View(InformationCenter& ic, specter::ViewResources& res) : specter::View(res, ic.m_vm.rootView()), m_ic(ic) {}
};
2016-02-02 08:31:05 +00:00
2018-12-08 05:30:43 +00:00
std::unique_ptr<View> m_view;
2016-02-02 08:31:05 +00:00
public:
2018-12-08 05:30:43 +00:00
InformationCenter(ViewManager& vm, Space* parent) : ViewerSpace(vm, Class::InformationCenter, parent) {
reloadState();
}
2016-02-02 08:31:05 +00:00
2018-12-08 05:30:43 +00:00
InformationCenter(ViewManager& vm, Space* parent, const InformationCenter& other) : InformationCenter(vm, parent) {
m_state = other.m_state;
reloadState();
}
2016-02-02 08:31:05 +00:00
2018-12-08 05:30:43 +00:00
InformationCenter(ViewManager& vm, Space* parent, ConfigReader& r) : InformationCenter(vm, parent) {
m_state.read(r);
reloadState();
}
2016-02-02 08:31:05 +00:00
2018-12-08 05:30:43 +00:00
void reloadState() {}
2016-02-02 08:31:05 +00:00
2018-12-08 05:30:43 +00:00
virtual specter::View* buildContentView(specter::ViewResources& res) {
m_view.reset(new View(*this, res));
return m_view.get();
}
2016-02-02 08:31:05 +00:00
2018-12-08 05:30:43 +00:00
Space* copy(Space* parent) const { return new InformationCenter(m_vm, parent, *this); }
2016-02-02 08:31:05 +00:00
2018-12-08 05:30:43 +00:00
bool usesToolbar() const { return true; }
2016-02-02 08:31:05 +00:00
};
2018-12-08 05:30:43 +00:00
} // namespace urde