1#include "editor_object.h"
2
3#include "editor.h"
4
5void CEditorObject::Init(CEditor *pEditor)
6{
7 m_pEditor = pEditor;
8 OnReset();
9}
10
11void CEditorObject::OnUpdate()
12{
13 if(IsActive())
14 OnActive();
15 else if(IsHot())
16 OnHot();
17}
18
19bool CEditorObject::OnInput(const IInput::CEvent &Event)
20{
21 return false;
22}
23
24void CEditorObject::OnRender(CUIRect View) {}
25
26void CEditorObject::OnReset() {}
27void CEditorObject::OnMapLoad() {}
28
29bool CEditorObject::IsHot()
30{
31 return Ui()->HotItem() == this;
32}
33
34void CEditorObject::SetHot()
35{
36 Ui()->SetHotItem(this);
37}
38
39void CEditorObject::UnsetHot()
40{
41 if(IsHot())
42 Ui()->SetHotItem(nullptr);
43}
44
45void CEditorObject::OnHot() {}
46
47bool CEditorObject::IsActive()
48{
49 return Ui()->CheckActiveItem(pId: this);
50}
51
52void CEditorObject::SetActive()
53{
54 SetHot();
55 Ui()->SetActiveItem(this);
56}
57
58void CEditorObject::SetInactive()
59{
60 if(IsActive())
61 Ui()->SetActiveItem(nullptr);
62}
63
64void CEditorObject::OnActive() {}
65
66CEditor *CEditorObject::Editor() { return m_pEditor; }
67const CEditor *CEditorObject::Editor() const { return m_pEditor; }
68IInput *CEditorObject::Input() { return m_pEditor->Input(); }
69IClient *CEditorObject::Client() { return m_pEditor->Client(); }
70CConfig *CEditorObject::Config() { return m_pEditor->Config(); }
71IConsole *CEditorObject::Console() { return m_pEditor->Console(); }
72IEngine *CEditorObject::Engine() { return m_pEditor->Engine(); }
73IGraphics *CEditorObject::Graphics() { return m_pEditor->Graphics(); }
74ISound *CEditorObject::Sound() { return m_pEditor->Sound(); }
75ITextRender *CEditorObject::TextRender() { return m_pEditor->TextRender(); }
76IStorage *CEditorObject::Storage() { return m_pEditor->Storage(); }
77CUi *CEditorObject::Ui() { return m_pEditor->Ui(); }
78CRenderTools *CEditorObject::RenderTools() { return m_pEditor->RenderTools(); }
79