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