This commit is contained in:
Matthias Koefferlein 2024-03-30 00:21:16 +01:00
parent 876215f6c7
commit 80d1aad90a
2 changed files with 21 additions and 3 deletions

View File

@ -23,6 +23,7 @@
#include "edtEditorHooks.h"
#include "tlObjectCollection.h"
#include "tlStaticObjects.h"
namespace edt
{
@ -30,16 +31,28 @@ namespace edt
// ---------------------------------------------------------------
// EditorHooksManager definition and implementation
static EditorHooksManager *sp_instance = 0;
static bool sp_instance_initialized = false;
class EditorHooksManager
{
public:
EditorHooksManager () { }
EditorHooksManager ()
{
// .. nothing yet ..
}
~EditorHooksManager ()
{
sp_instance = 0;
}
static EditorHooksManager *instance ()
{
static EditorHooksManager *sp_instance = 0;
if (! sp_instance) {
if (! sp_instance && ! sp_instance_initialized) {
sp_instance = new EditorHooksManager ();
sp_instance_initialized = true;
tl::StaticObjects::reg (&sp_instance);
}
return sp_instance;
}

View File

@ -140,6 +140,11 @@ gsi::Class<edt::EditorHooks> decl_EditorHooksBase ("lay", "EditorHooksBase",
) +
gsi::method ("technologies", &edt::EditorHooks::get_technologies,
"@brief Gets the list of technologies these hooks are associated with.\n"
) +
gsi::method ("register", &edt::EditorHooks::register_editor_hook, gsi::arg ("hooks"),
"@brief Registers the hooks in the system.\n"
"The hooks will not be active before they are registered in the system. Registration will "
"also transfer object ownership to the system."
),
"@brief The base class for editor hooks\n"
"Editor hooks allow implementing technology-specific callbacks into the editor "