Plasma Engine  2.0
Loading...
Searching...
No Matches
DocumentRegistry.h
1#pragma once
2
3#include <Foundation/Communication/Event.h>
4#include <Foundation/Containers/HybridArray.h>
5#include <ToolsFoundation/Document/Document.h>
6#include <ToolsFoundation/ToolsFoundationDLL.h>
7
8struct PL_TOOLSFOUNDATION_DLL plActiveDocumentChange
9{
10 const plDocument* m_pOldDocument;
11 const plDocument* m_pNewDocument;
12};
13
18class PL_TOOLSFOUNDATION_DLL plDocumentRegistry
19{
20public:
21 static bool RegisterDocument(const plDocument* pDocument);
22 static bool UnregisterDocument(const plDocument* pDocument);
23
24 static plArrayPtr<const plDocument*> GetDocuments() { return s_Documents; }
25
26 static void SetActiveDocument(const plDocument* pDocument);
27 static const plDocument* GetActiveDocument();
28
29private:
30 PL_MAKE_SUBSYSTEM_STARTUP_FRIEND(Core, DocumentRegistry);
31
32 static void Startup();
33 static void Shutdown();
34
35public:
36 // static plEvent<plDocumentChange&> m_DocumentAddedEvent;
37 // static plEvent<plDocumentChange&> m_DocumentRemovedEvent;
38 static plEvent<plActiveDocumentChange&> m_ActiveDocumentChanged;
39
40private:
41 static plHybridArray<const plDocument*, 16> s_Documents;
42 static plDocument* s_pActiveDocument;
43};
This class encapsulates an array and it's size. It is recommended to use this class instead of plain ...
Definition ArrayPtr.h:37
Definition Document.h:57
Tracks existing and active plDocument.
Definition DocumentRegistry.h:19
Definition Event.h:177
A hybrid array uses in-place storage to handle the first few elements without any allocation....
Definition HybridArray.h:12
Definition DocumentRegistry.h:9