Code::Blocks  SVN r11506
Classes | Typedefs | Functions | Variables
EditorHooks Namespace Reference

Provides static functions to add hooks to the editor modification operations. More...

Classes

class  cbSmartIndentEditorHookFunctor
 Provides a HookFunctor which redirects the Call() of a cbSmartIndentPlugin so only the interface of cbSmartIndentPlugin has to be implemented for a new language. More...
 
class  HookFunctor
 Functor class for use as a editor modification operations hook. More...
 
class  HookFunctorBase
 Abstract base hook functor interface. More...
 

Typedefs

typedef std::map< int, HookFunctorBase * > HookFunctorsMap
 

Functions

DLLIMPORT int RegisterHook (HookFunctorBase *functor)
 Register a project loading/saving hook. More...
 
DLLIMPORT HookFunctorBaseUnregisterHook (int id, bool deleteHook=true)
 Unregister a previously registered project loading/saving hook. More...
 
DLLIMPORT bool HasRegisteredHooks ()
 Are there any hooks registered? More...
 
DLLIMPORT void CallHooks (cbEditor *editor, wxScintillaEvent &event)
 Call all registered hooks using the supplied parameters. More...
 

Variables

static HookFunctorsMap s_HookFunctorsMap
 
static int s_UniqueID = 0
 

Detailed Description

Provides static functions to add hooks to the editor modification operations.

Typedef Documentation

◆ HookFunctorsMap

Definition at line 73 of file editor_hooks.cpp.

Function Documentation

◆ CallHooks()

void EditorHooks::CallHooks ( cbEditor editor,
wxScintillaEvent event 
)

Call all registered hooks using the supplied parameters.

This is called by ProjectLoader.

Parameters
editorThe editor in question.
eventParameter (wxScintilla event) to provide to the registered hook

Definition at line 111 of file editor_hooks.cpp.

References EditorHooks::HookFunctorBase::Call(), LogManager::DebugLog(), F(), wxString::FromUTF8(), Manager::Get(), Manager::GetLogManager(), s_HookFunctorsMap, wxStopWatch::Time(), wxString::wx_str(), and wxT.

Referenced by cbEditor::OnScintillaEvent().

◆ HasRegisteredHooks()

bool EditorHooks::HasRegisteredHooks ( )

Are there any hooks registered?

Returns
True if any hooks are registered, false if none.

Definition at line 106 of file editor_hooks.cpp.

References s_HookFunctorsMap.

Referenced by cbEditor::OnScintillaEvent().

◆ RegisterHook()

int EditorHooks::RegisterHook ( EditorHooks::HookFunctorBase functor)

Register a project loading/saving hook.

Parameters
functorThe functor to use as a callback.
Returns
An ID. Use this to unregister your hook later.

Definition at line 78 of file editor_hooks.cpp.

References s_HookFunctorsMap, and s_UniqueID.

Referenced by CCManager::CCManager(), CodeCompletion::OnAttach(), and cbSmartIndentPlugin::OnAttach().

◆ UnregisterHook()

EditorHooks::HookFunctorBase * EditorHooks::UnregisterHook ( int  id,
bool  deleteHook = true 
)

Unregister a previously registered project loading/saving hook.

Parameters
idThe hook's ID. You should have the ID from when RegisterHook() was called.
deleteHookIf true, the hook will be deleted (default). If not, it's up to you to delete it.
Returns
The functor. If deleteHook was true, it always returns NULL.

Definition at line 89 of file editor_hooks.cpp.

References s_HookFunctorsMap.

Referenced by CodeCompletion::OnRelease(), cbSmartIndentPlugin::OnRelease(), and CCManager::~CCManager().

Variable Documentation

◆ s_HookFunctorsMap

HookFunctorsMap EditorHooks::s_HookFunctorsMap
static

Definition at line 74 of file editor_hooks.cpp.

Referenced by CallHooks(), HasRegisteredHooks(), RegisterHook(), and UnregisterHook().

◆ s_UniqueID

int EditorHooks::s_UniqueID = 0
static

Definition at line 75 of file editor_hooks.cpp.

Referenced by RegisterHook().