2016-01-05 09:53:16 +00:00
|
|
|
#ifndef URDE_SPACE_HPP
|
|
|
|
#define URDE_SPACE_HPP
|
2015-12-11 02:37:54 +00:00
|
|
|
|
2017-12-29 08:08:12 +00:00
|
|
|
#include "athena/DNAYaml.hpp"
|
|
|
|
#include "specter/Space.hpp"
|
|
|
|
#include "specter/IMenuNode.hpp"
|
|
|
|
#include "specter/Button.hpp"
|
|
|
|
#include "specter/MultiLineTextView.hpp"
|
|
|
|
#include "specter/ViewResources.hpp"
|
|
|
|
#include "specter/RootView.hpp"
|
2016-01-05 00:01:02 +00:00
|
|
|
#include "ProjectManager.hpp"
|
2015-12-11 02:37:54 +00:00
|
|
|
|
2016-03-04 23:04:53 +00:00
|
|
|
namespace specter
|
2015-12-11 02:37:54 +00:00
|
|
|
{
|
|
|
|
class View;
|
|
|
|
class SplitView;
|
|
|
|
class ViewResources;
|
|
|
|
class Toolbar;
|
2017-12-29 08:08:12 +00:00
|
|
|
struct Icon;
|
2015-12-11 02:37:54 +00:00
|
|
|
}
|
2016-03-05 00:03:41 +00:00
|
|
|
namespace urde
|
2015-12-11 02:37:54 +00:00
|
|
|
{
|
|
|
|
class ViewManager;
|
2016-01-10 06:42:58 +00:00
|
|
|
class RootSpace;
|
2015-12-11 02:37:54 +00:00
|
|
|
|
2016-03-04 23:04:53 +00:00
|
|
|
class Space : public specter::ISpaceController
|
2015-12-11 02:37:54 +00:00
|
|
|
{
|
2016-01-05 00:01:02 +00:00
|
|
|
friend class SplitSpace;
|
2015-12-11 02:37:54 +00:00
|
|
|
public:
|
2016-01-10 06:42:58 +00:00
|
|
|
virtual ~Space() = default;
|
2016-01-05 00:01:02 +00:00
|
|
|
Space(const Space& other) = delete;
|
|
|
|
Space& operator=(const Space& other) = delete;
|
|
|
|
|
2016-02-01 20:04:55 +00:00
|
|
|
/** Common encoded-enumeration for all space classes */
|
2015-12-11 02:37:54 +00:00
|
|
|
enum class Class
|
|
|
|
{
|
|
|
|
None,
|
2016-01-10 06:42:58 +00:00
|
|
|
RootSpace,
|
2015-12-12 00:37:32 +00:00
|
|
|
SplitSpace,
|
|
|
|
TestSpace,
|
2016-01-07 00:40:27 +00:00
|
|
|
ResourceBrowser,
|
2016-02-01 20:04:55 +00:00
|
|
|
ModelViewer,
|
2016-02-02 08:31:05 +00:00
|
|
|
EffectEditor,
|
2016-12-13 02:56:43 +00:00
|
|
|
InformationCenter,
|
|
|
|
GameMode
|
2015-12-11 02:37:54 +00:00
|
|
|
};
|
2016-01-04 05:31:02 +00:00
|
|
|
|
2018-02-22 07:24:51 +00:00
|
|
|
struct State : athena::io::DNAVYaml<athena::Big> {Delete _d;};
|
2016-01-10 06:42:58 +00:00
|
|
|
static Space* NewSpaceFromConfigStream(ViewManager& vm, Space* parent, ConfigReader& r);
|
|
|
|
static RootSpace* NewRootSpaceFromConfigStream(ViewManager& vm, ConfigReader& r);
|
2016-01-04 05:31:02 +00:00
|
|
|
|
2016-03-04 23:04:53 +00:00
|
|
|
struct SpaceMenuNode : specter::IMenuNode
|
2016-01-17 04:14:13 +00:00
|
|
|
{
|
2016-03-04 23:04:53 +00:00
|
|
|
struct SubNodeData : specter::IMenuNode
|
2016-01-17 04:14:13 +00:00
|
|
|
{
|
|
|
|
Class m_cls;
|
|
|
|
std::string m_key;
|
|
|
|
std::string m_text;
|
2016-03-04 23:04:53 +00:00
|
|
|
specter::Icon& m_icon;
|
|
|
|
zeus::CColor m_color;
|
2016-01-17 04:14:13 +00:00
|
|
|
const std::string* text() const {return &m_text;}
|
|
|
|
void activated(const boo::SWindowCoord& coord) {}
|
|
|
|
|
2016-03-04 23:04:53 +00:00
|
|
|
SubNodeData(Class cls, const char* key, const char* text, specter::Icon& icon, const zeus::CColor& color)
|
2016-01-18 23:33:23 +00:00
|
|
|
: m_cls(cls), m_key(key), m_text(text), m_icon(icon), m_color(color) {}
|
2016-01-17 04:14:13 +00:00
|
|
|
};
|
|
|
|
static std::vector<SubNodeData> s_subNodeDats;
|
|
|
|
|
2016-03-04 23:04:53 +00:00
|
|
|
struct SubNode : specter::IMenuNode
|
2016-01-17 04:14:13 +00:00
|
|
|
{
|
|
|
|
Space& m_space;
|
|
|
|
const SubNodeData& m_data;
|
|
|
|
const std::string* text() const {return &m_data.m_text;}
|
2016-07-09 01:23:34 +00:00
|
|
|
void activated(const boo::SWindowCoord& coord);
|
2016-01-17 04:14:13 +00:00
|
|
|
|
|
|
|
SubNode(Space& space, const SubNodeData& data) : m_space(space), m_data(data) {}
|
|
|
|
};
|
|
|
|
std::vector<SubNode> m_subNodes;
|
|
|
|
|
|
|
|
SpaceMenuNode(Space& space)
|
|
|
|
{
|
|
|
|
m_subNodes.reserve(s_subNodeDats.size());
|
|
|
|
for (const SubNodeData& sn : s_subNodeDats)
|
|
|
|
m_subNodes.emplace_back(space, sn);
|
|
|
|
}
|
|
|
|
|
|
|
|
static std::string s_text;
|
|
|
|
const std::string* text() const {return &s_text;}
|
|
|
|
|
|
|
|
size_t subNodeCount() const {return m_subNodes.size();}
|
|
|
|
IMenuNode* subNode(size_t idx) {return &m_subNodes[idx];}
|
|
|
|
|
2016-02-01 20:04:55 +00:00
|
|
|
static void InitializeStrings(ViewManager& vm);
|
|
|
|
static const std::string* LookupClassString(Class cls)
|
2016-01-17 04:14:13 +00:00
|
|
|
{
|
|
|
|
for (const SubNodeData& sn : s_subNodeDats)
|
|
|
|
if (sn.m_cls == cls)
|
|
|
|
return &sn.m_text;
|
|
|
|
return nullptr;
|
|
|
|
}
|
2016-03-04 23:04:53 +00:00
|
|
|
static specter::Icon* LookupClassIcon(Class cls)
|
2016-01-18 23:33:23 +00:00
|
|
|
{
|
|
|
|
for (SubNodeData& sn : s_subNodeDats)
|
|
|
|
if (sn.m_cls == cls)
|
|
|
|
return &sn.m_icon;
|
|
|
|
return nullptr;
|
|
|
|
}
|
2016-03-04 23:04:53 +00:00
|
|
|
static const zeus::CColor* LookupClassColor(Class cls)
|
2016-01-18 23:33:23 +00:00
|
|
|
{
|
|
|
|
for (SubNodeData& sn : s_subNodeDats)
|
|
|
|
if (sn.m_cls == cls)
|
|
|
|
return &sn.m_color;
|
|
|
|
return nullptr;
|
|
|
|
}
|
2016-01-17 04:14:13 +00:00
|
|
|
} m_spaceMenuNode;
|
|
|
|
|
2016-03-04 23:04:53 +00:00
|
|
|
struct SpaceSelectBind : specter::IButtonBinding
|
2016-01-17 04:14:13 +00:00
|
|
|
{
|
|
|
|
Space& m_space;
|
2017-11-13 06:19:18 +00:00
|
|
|
std::string_view name(const specter::Control* control) const {return SpaceMenuNode::s_text;}
|
2016-01-17 04:14:13 +00:00
|
|
|
|
2016-03-04 23:04:53 +00:00
|
|
|
MenuStyle menuStyle(const specter::Button* button) const {return MenuStyle::Primary;}
|
|
|
|
std::unique_ptr<specter::View> buildMenu(const specter::Button* button);
|
2016-01-17 04:14:13 +00:00
|
|
|
|
|
|
|
SpaceSelectBind(Space& space) : m_space(space) {}
|
|
|
|
} m_spaceSelectBind;
|
2016-03-04 23:04:53 +00:00
|
|
|
std::unique_ptr<specter::Button> m_spaceSelectButton;
|
2016-01-17 04:14:13 +00:00
|
|
|
|
2015-12-11 02:37:54 +00:00
|
|
|
protected:
|
2015-12-12 00:37:32 +00:00
|
|
|
friend class ViewManager;
|
2016-01-10 06:42:58 +00:00
|
|
|
friend class RootSpace;
|
2015-12-11 02:37:54 +00:00
|
|
|
ViewManager& m_vm;
|
|
|
|
Class m_class = Class::None;
|
2016-01-10 06:42:58 +00:00
|
|
|
Space* m_parent;
|
2016-03-04 23:04:53 +00:00
|
|
|
std::unique_ptr<specter::Space> m_spaceView;
|
2016-01-17 04:14:13 +00:00
|
|
|
Space(ViewManager& vm, Class cls, Space* parent);
|
2015-12-11 02:37:54 +00:00
|
|
|
|
|
|
|
/* Allows common Space code to access DNA-encoded state */
|
2016-01-05 00:01:02 +00:00
|
|
|
virtual const Space::State& spaceState() const=0;
|
2015-12-11 02:37:54 +00:00
|
|
|
|
|
|
|
/* Structural control */
|
|
|
|
virtual bool usesToolbar() const {return false;}
|
2016-01-27 00:44:22 +00:00
|
|
|
virtual unsigned toolbarUnits() const {return 1;}
|
2016-03-04 23:04:53 +00:00
|
|
|
virtual void buildToolbarView(specter::ViewResources& res, specter::Toolbar& tb) {}
|
|
|
|
virtual specter::View* buildContentView(specter::ViewResources& res)=0;
|
|
|
|
virtual specter::View* buildSpaceView(specter::ViewResources& res);
|
2016-01-05 00:01:02 +00:00
|
|
|
|
2015-12-13 02:27:34 +00:00
|
|
|
public:
|
2016-03-04 23:04:53 +00:00
|
|
|
virtual void saveState(athena::io::IStreamWriter& w) const;
|
|
|
|
virtual void saveState(athena::io::YAMLDocWriter& w) const;
|
2016-01-07 00:40:27 +00:00
|
|
|
virtual void reloadState() {}
|
2016-01-05 00:01:02 +00:00
|
|
|
|
|
|
|
virtual void think() {}
|
2016-01-10 06:42:58 +00:00
|
|
|
|
|
|
|
virtual Space* copy(Space* parent) const=0;
|
|
|
|
bool spaceSplitAllowed() const {return true;}
|
|
|
|
|
2016-03-04 23:04:53 +00:00
|
|
|
specter::ISplitSpaceController* spaceSplit(specter::SplitView::Axis axis, int thisSlot);
|
2016-01-10 06:42:58 +00:00
|
|
|
virtual std::unique_ptr<Space> exchangeSpaceSplitJoin(Space* removeSpace, std::unique_ptr<Space>&& keepSpace)
|
|
|
|
{return std::unique_ptr<Space>();}
|
2016-02-01 01:13:45 +00:00
|
|
|
|
2016-03-04 23:04:53 +00:00
|
|
|
virtual specter::View* basisView() {return m_spaceView.get();}
|
2016-01-10 06:42:58 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
class RootSpace : public Space
|
|
|
|
{
|
|
|
|
friend class ViewManager;
|
2016-03-04 23:04:53 +00:00
|
|
|
std::unique_ptr<specter::RootView> m_rootView;
|
2016-01-11 02:17:08 +00:00
|
|
|
std::unique_ptr<Space> m_spaceTree;
|
2016-01-10 06:42:58 +00:00
|
|
|
struct State : Space::State
|
|
|
|
{
|
2018-02-22 07:24:51 +00:00
|
|
|
AT_DECL_DNA_YAML
|
|
|
|
AT_DECL_DNAV
|
2016-01-10 06:42:58 +00:00
|
|
|
} m_state;
|
|
|
|
const Space::State& spaceState() const {return m_state;}
|
|
|
|
|
|
|
|
public:
|
|
|
|
RootSpace(ViewManager& vm) : Space(vm, Class::RootSpace, nullptr) {}
|
|
|
|
RootSpace(ViewManager& vm, ConfigReader& r)
|
|
|
|
: RootSpace(vm)
|
|
|
|
{
|
|
|
|
m_state.read(r);
|
2017-02-12 23:56:03 +00:00
|
|
|
if (auto rec = r.enterSubRecord("spaceTree"))
|
|
|
|
m_spaceTree.reset(NewSpaceFromConfigStream(vm, this, r));
|
2016-01-10 06:42:58 +00:00
|
|
|
}
|
|
|
|
|
2016-03-01 03:08:25 +00:00
|
|
|
void think()
|
|
|
|
{
|
|
|
|
if (m_spaceTree)
|
|
|
|
m_spaceTree->think();
|
|
|
|
}
|
|
|
|
|
2016-03-04 23:04:53 +00:00
|
|
|
void saveState(athena::io::IStreamWriter& w) const
|
2016-01-10 06:42:58 +00:00
|
|
|
{
|
|
|
|
w.writeUint32Big(atUint32(m_class));
|
|
|
|
m_state.write(w);
|
|
|
|
|
2016-01-11 02:17:08 +00:00
|
|
|
if (m_spaceTree)
|
|
|
|
m_spaceTree->saveState(w);
|
2016-01-10 06:42:58 +00:00
|
|
|
else
|
|
|
|
w.writeUint32Big(0);
|
|
|
|
}
|
|
|
|
|
2016-03-04 23:04:53 +00:00
|
|
|
void saveState(athena::io::YAMLDocWriter& w) const
|
2016-01-10 06:42:58 +00:00
|
|
|
{
|
|
|
|
w.writeUint32("class", atUint32(m_class));
|
|
|
|
m_state.write(w);
|
|
|
|
|
2017-02-12 23:56:03 +00:00
|
|
|
if (auto rec = w.enterSubRecord("spaceTree"))
|
|
|
|
{
|
|
|
|
if (m_spaceTree)
|
|
|
|
m_spaceTree->saveState(w);
|
|
|
|
else
|
|
|
|
w.writeUint32("class", 0);
|
|
|
|
}
|
2016-01-10 06:42:58 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void setChild(std::unique_ptr<Space>&& space)
|
|
|
|
{
|
2016-01-11 02:17:08 +00:00
|
|
|
m_spaceTree = std::move(space);
|
|
|
|
m_spaceTree->m_parent = this;
|
2016-01-10 06:42:58 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
Space* copy(Space* parent) const {return nullptr;}
|
|
|
|
bool spaceSplitAllowed() const {return false;}
|
|
|
|
|
2016-03-04 23:04:53 +00:00
|
|
|
specter::View* buildSpaceView(specter::ViewResources& res);
|
|
|
|
specter::View* buildContentView(specter::ViewResources& res) {return m_spaceTree->buildSpaceView(res);}
|
2016-01-10 06:42:58 +00:00
|
|
|
|
|
|
|
std::unique_ptr<Space> exchangeSpaceSplitJoin(Space* removeSpace, std::unique_ptr<Space>&& keepSpace);
|
2016-02-01 01:13:45 +00:00
|
|
|
|
2016-03-04 23:04:53 +00:00
|
|
|
specter::View* basisView();
|
2015-12-11 02:37:54 +00:00
|
|
|
};
|
|
|
|
|
2016-03-04 23:04:53 +00:00
|
|
|
class SplitSpace : public Space, public specter::ISplitSpaceController
|
2015-12-11 02:37:54 +00:00
|
|
|
{
|
2015-12-12 00:37:32 +00:00
|
|
|
friend class ViewManager;
|
2016-01-05 00:01:02 +00:00
|
|
|
std::unique_ptr<Space> m_slots[2];
|
2016-03-04 23:04:53 +00:00
|
|
|
std::unique_ptr<specter::SplitView> m_splitView;
|
2016-01-04 05:31:02 +00:00
|
|
|
struct State : Space::State
|
2015-12-11 02:37:54 +00:00
|
|
|
{
|
2018-02-22 07:24:51 +00:00
|
|
|
AT_DECL_DNA_YAML
|
|
|
|
AT_DECL_DNAV
|
2016-03-04 23:04:53 +00:00
|
|
|
Value<specter::SplitView::Axis> axis = specter::SplitView::Axis::Horizontal;
|
2016-01-11 02:17:08 +00:00
|
|
|
Value<float> split = 0.5;
|
2015-12-11 02:37:54 +00:00
|
|
|
} m_state;
|
2016-01-05 00:01:02 +00:00
|
|
|
const Space::State& spaceState() const {return m_state;}
|
2015-12-12 00:37:32 +00:00
|
|
|
|
|
|
|
public:
|
2016-03-04 23:04:53 +00:00
|
|
|
SplitSpace(ViewManager& vm, Space* parent, specter::SplitView::Axis axis) : Space(vm, Class::SplitSpace, parent)
|
2016-01-11 02:17:08 +00:00
|
|
|
{
|
|
|
|
m_state.axis = axis;
|
|
|
|
reloadState();
|
|
|
|
}
|
2016-01-10 06:42:58 +00:00
|
|
|
SplitSpace(ViewManager& vm, Space* parent, ConfigReader& r)
|
2016-03-04 23:04:53 +00:00
|
|
|
: SplitSpace(vm, parent, specter::SplitView::Axis::Horizontal)
|
2016-01-04 05:31:02 +00:00
|
|
|
{
|
|
|
|
m_state.read(r);
|
2017-02-12 23:56:03 +00:00
|
|
|
if (auto rec = r.enterSubRecord("slot0"))
|
|
|
|
m_slots[0].reset(NewSpaceFromConfigStream(vm, this, r));
|
|
|
|
if (auto rec = r.enterSubRecord("slot1"))
|
|
|
|
m_slots[1].reset(NewSpaceFromConfigStream(vm, this, r));
|
2016-01-11 02:17:08 +00:00
|
|
|
reloadState();
|
|
|
|
}
|
|
|
|
|
|
|
|
void reloadState()
|
|
|
|
{
|
|
|
|
m_state.split = std::min(1.f, std::max(0.f, m_state.split));
|
2016-03-04 23:04:53 +00:00
|
|
|
if (m_state.axis != specter::SplitView::Axis::Horizontal &&
|
|
|
|
m_state.axis != specter::SplitView::Axis::Vertical)
|
|
|
|
m_state.axis = specter::SplitView::Axis::Horizontal;
|
2016-01-11 02:17:08 +00:00
|
|
|
if (m_splitView)
|
|
|
|
{
|
|
|
|
m_splitView->setSplit(m_state.split);
|
|
|
|
m_splitView->setAxis(m_state.axis);
|
|
|
|
}
|
2016-01-04 05:31:02 +00:00
|
|
|
}
|
|
|
|
|
2016-03-01 03:08:25 +00:00
|
|
|
void think()
|
|
|
|
{
|
|
|
|
if (m_slots[0])
|
|
|
|
m_slots[0]->think();
|
|
|
|
if (m_slots[1])
|
|
|
|
m_slots[1]->think();
|
|
|
|
}
|
|
|
|
|
2016-03-04 23:04:53 +00:00
|
|
|
void saveState(athena::io::IStreamWriter& w) const
|
2016-01-05 00:01:02 +00:00
|
|
|
{
|
|
|
|
w.writeUint32Big(atUint32(m_class));
|
|
|
|
m_state.write(w);
|
|
|
|
|
|
|
|
if (m_slots[0])
|
|
|
|
m_slots[0]->saveState(w);
|
|
|
|
else
|
|
|
|
w.writeUint32Big(0);
|
|
|
|
|
|
|
|
|
|
|
|
if (m_slots[1])
|
|
|
|
m_slots[1]->saveState(w);
|
|
|
|
else
|
|
|
|
w.writeUint32Big(0);
|
|
|
|
}
|
|
|
|
|
2016-03-04 23:04:53 +00:00
|
|
|
void saveState(athena::io::YAMLDocWriter& w) const
|
2016-01-05 00:01:02 +00:00
|
|
|
{
|
|
|
|
w.writeUint32("class", atUint32(m_class));
|
|
|
|
m_state.write(w);
|
|
|
|
|
2017-02-12 23:56:03 +00:00
|
|
|
if (auto rec = w.enterSubRecord("slot0"))
|
|
|
|
{
|
|
|
|
if (m_slots[0])
|
|
|
|
m_slots[0]->saveState(w);
|
|
|
|
else
|
|
|
|
w.writeUint32("class", 0);
|
|
|
|
}
|
2016-01-05 00:01:02 +00:00
|
|
|
|
2017-02-12 23:56:03 +00:00
|
|
|
if (auto rec = w.enterSubRecord("slot1"))
|
|
|
|
{
|
|
|
|
if (m_slots[1])
|
|
|
|
m_slots[1]->saveState(w);
|
|
|
|
else
|
|
|
|
w.writeUint32("class", 0);
|
|
|
|
}
|
2016-01-05 00:01:02 +00:00
|
|
|
}
|
|
|
|
|
2016-01-10 06:42:58 +00:00
|
|
|
void setChildSlot(unsigned slot, std::unique_ptr<Space>&& space);
|
2016-01-05 00:01:02 +00:00
|
|
|
|
2016-03-04 23:04:53 +00:00
|
|
|
specter::View* buildSpaceView(specter::ViewResources& res) {return buildContentView(res);}
|
|
|
|
specter::View* buildContentView(specter::ViewResources& res);
|
2016-01-10 06:42:58 +00:00
|
|
|
|
|
|
|
Space* copy(Space* parent) const {return nullptr;}
|
|
|
|
bool spaceSplitAllowed() const {return false;}
|
|
|
|
|
|
|
|
ISpaceController* spaceJoin(int keepSlot)
|
|
|
|
{
|
|
|
|
if (m_parent)
|
|
|
|
{
|
|
|
|
ISpaceController* ret = m_slots[keepSlot].get();
|
|
|
|
m_parent->exchangeSpaceSplitJoin(this, std::move(m_slots[keepSlot]));
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
return nullptr;
|
|
|
|
}
|
|
|
|
|
|
|
|
std::unique_ptr<Space> exchangeSpaceSplitJoin(Space* removeSpace, std::unique_ptr<Space>&& keepSpace);
|
|
|
|
|
2016-03-04 23:04:53 +00:00
|
|
|
specter::SplitView* splitView() {return m_splitView.get();}
|
2016-01-12 00:46:27 +00:00
|
|
|
void updateSplit(float split) {m_state.split = split;}
|
2016-03-04 23:04:53 +00:00
|
|
|
void joinViews(specter::SplitView* thisSplit, int thisSlot, specter::SplitView* otherSplit, int otherSlot);
|
2016-02-01 01:13:45 +00:00
|
|
|
|
2016-03-04 23:04:53 +00:00
|
|
|
void setAxis(specter::SplitView::Axis axis)
|
2016-01-10 06:42:58 +00:00
|
|
|
{
|
2016-01-11 02:17:08 +00:00
|
|
|
m_state.axis = axis;
|
|
|
|
reloadState();
|
2016-01-10 06:42:58 +00:00
|
|
|
}
|
2016-01-12 00:46:27 +00:00
|
|
|
|
2016-03-04 23:04:53 +00:00
|
|
|
specter::SplitView::Axis axis() const {return m_state.axis;}
|
2016-01-12 00:46:27 +00:00
|
|
|
float split() const {return m_state.split;}
|
2016-02-01 01:13:45 +00:00
|
|
|
|
2016-03-04 23:04:53 +00:00
|
|
|
specter::View* basisView() {return m_splitView.get();}
|
2015-12-12 00:37:32 +00:00
|
|
|
};
|
|
|
|
|
2016-02-01 20:04:55 +00:00
|
|
|
class ViewerSpace : public Space
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
ViewerSpace(ViewManager& vm, Class cls, Space* parent)
|
|
|
|
: Space(vm, cls, parent) {}
|
|
|
|
};
|
|
|
|
|
|
|
|
class EditorSpace : public Space
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
EditorSpace(ViewManager& vm, Class cls, Space* parent)
|
|
|
|
: Space(vm, cls, parent) {}
|
|
|
|
};
|
|
|
|
|
2016-03-01 03:08:25 +00:00
|
|
|
class GameSpace : public Space
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
GameSpace(ViewManager& vm, Class cls, Space* parent)
|
|
|
|
: Space(vm, cls, parent) {}
|
|
|
|
};
|
|
|
|
|
2015-12-12 00:37:32 +00:00
|
|
|
class TestSpace : public Space
|
|
|
|
{
|
2016-03-04 23:04:53 +00:00
|
|
|
std::unique_ptr<specter::Button> m_button;
|
|
|
|
std::unique_ptr<specter::MultiLineTextView> m_textView;
|
2015-12-12 00:37:32 +00:00
|
|
|
|
|
|
|
std::string m_contentStr;
|
|
|
|
std::string m_buttonStr;
|
|
|
|
|
2016-03-04 23:04:53 +00:00
|
|
|
specter::IButtonBinding* m_binding;
|
2015-12-12 00:37:32 +00:00
|
|
|
|
|
|
|
public:
|
2017-11-13 06:19:18 +00:00
|
|
|
TestSpace(ViewManager& vm, Space* parent, std::string_view content, std::string_view button,
|
2016-03-04 23:04:53 +00:00
|
|
|
specter::IButtonBinding* binding)
|
2016-01-10 06:42:58 +00:00
|
|
|
: Space(vm, Class::TestSpace, parent), m_contentStr(content), m_buttonStr(button), m_binding(binding)
|
2015-12-12 00:37:32 +00:00
|
|
|
{}
|
|
|
|
|
2016-01-04 05:31:02 +00:00
|
|
|
struct State : Space::State
|
2015-12-12 00:37:32 +00:00
|
|
|
{
|
2018-02-22 07:24:51 +00:00
|
|
|
AT_DECL_DNA_YAML
|
|
|
|
AT_DECL_DNAV
|
2015-12-12 00:37:32 +00:00
|
|
|
} m_state;
|
2016-01-04 05:31:02 +00:00
|
|
|
Space::State& spaceState() {return m_state;}
|
2015-12-12 00:37:32 +00:00
|
|
|
|
|
|
|
bool usesToolbar() const {return true;}
|
2016-03-04 23:04:53 +00:00
|
|
|
void buildToolbarView(specter::ViewResources& res, specter::Toolbar& tb)
|
2015-12-12 00:37:32 +00:00
|
|
|
{
|
2016-03-04 23:04:53 +00:00
|
|
|
m_button.reset(new specter::Button(res, tb, m_binding, m_buttonStr));
|
2016-01-27 00:44:22 +00:00
|
|
|
tb.push_back(m_button.get(), 0);
|
2015-12-12 00:37:32 +00:00
|
|
|
}
|
|
|
|
|
2016-03-04 23:04:53 +00:00
|
|
|
specter::View* buildContentView(specter::ViewResources& res)
|
2015-12-12 00:37:32 +00:00
|
|
|
{
|
2016-03-04 23:04:53 +00:00
|
|
|
m_textView.reset(new specter::MultiLineTextView(res, *m_spaceView, res.m_heading14));
|
2015-12-12 00:37:32 +00:00
|
|
|
m_textView->setBackground(res.themeData().viewportBackground());
|
|
|
|
m_textView->typesetGlyphs(m_contentStr, res.themeData().uiText());
|
|
|
|
return m_textView.get();
|
|
|
|
}
|
2015-12-11 02:37:54 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
}
|
|
|
|
|
2016-01-05 09:53:16 +00:00
|
|
|
#endif // URDE_SPACE_HPP
|