| 1 | #include "component.h" |
|---|---|
| 2 | |
| 3 | void CEditorComponent::OnInit(CEditor *pEditor) |
| 4 | { |
| 5 | CEditorObject::OnInit(pEditor); |
| 6 | OnReset(); |
| 7 | } |
| 8 | |
| 9 | void CEditorComponent::OnReset() |
| 10 | { |
| 11 | } |
| 12 | |
| 13 | void CEditorComponent::OnMapLoad() |
| 14 | { |
| 15 | } |
| 16 | |
| 17 | bool CEditorComponent::OnInput(const IInput::CEvent &Event) |
| 18 | { |
| 19 | for(CEditorComponent &Component : m_vSubComponents) |
| 20 | { |
| 21 | // Events with flag `FLAG_RELEASE` must always be forwarded to all components so keys being |
| 22 | // released can be handled in all components also after some components have been disabled. |
| 23 | if(Component.OnInput(Event) && (Event.m_Flags & ~IInput::FLAG_RELEASE) != 0) |
| 24 | { |
| 25 | return true; |
| 26 | } |
| 27 | } |
| 28 | return false; |
| 29 | } |
| 30 | |
| 31 | void CEditorComponent::OnUpdate() |
| 32 | { |
| 33 | } |
| 34 | |
| 35 | void CEditorComponent::OnRender(CUIRect View) |
| 36 | { |
| 37 | } |
| 38 | |
| 39 | void CEditorComponent::InitSubComponents() |
| 40 | { |
| 41 | for(CEditorComponent &Component : m_vSubComponents) |
| 42 | { |
| 43 | Component.OnInit(pEditor: Editor()); |
| 44 | } |
| 45 | } |
| 46 | |
| 47 | void CEditorComponent::RegisterSubComponent(CEditorComponent &Component) |
| 48 | { |
| 49 | m_vSubComponents.emplace_back(args&: Component); |
| 50 | } |
| 51 |