Audacity 3.2.0
Protected Member Functions | List of all members
AppEvents::ProviderBase Class Reference

#include <AppEvents.h>

Inheritance diagram for AppEvents::ProviderBase:
[legend]

Protected Member Functions

virtual ~ProviderBase ()=default
 
void HandleAppInitialized ()
 
void HandleAppIdle ()
 
void HandleAppClosing ()
 

Detailed Description

Base class for application events providers. This class has no virtual methods and should not be publicly derived from. Derived classes should use the provided interface to fire events. It is safe to have multiple instances of derived classes, but it does not make much sense.

Definition at line 41 of file AppEvents.h.

Constructor & Destructor Documentation

◆ ~ProviderBase()

virtual AppEvents::ProviderBase::~ProviderBase ( )
protectedvirtualdefault

Member Function Documentation

◆ HandleAppClosing()

void AppEvents::ProviderBase::HandleAppClosing ( )
protected

Definition at line 96 of file AppEvents.cpp.

97{
98 auto& handlers = GetEventHandlers();
99
100 handlers.AppClosingCalled = true;
101
102 std::vector<std::function<void()>> callbacks;
103 std::swap(callbacks, handlers.appClosing);
104
105 for (auto& callback : callbacks)
106 callback();
107}
void swap(std::unique_ptr< Alg_seq > &a, std::unique_ptr< Alg_seq > &b)
Definition: NoteTrack.cpp:634

References AppEvents::anonymous_namespace{AppEvents.cpp}::GetEventHandlers(), and anonymous_namespace{NoteTrack.cpp}::swap().

Referenced by AudacityApp::OnExit().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ HandleAppIdle()

void AppEvents::ProviderBase::HandleAppIdle ( )
protected

Definition at line 91 of file AppEvents.cpp.

92{
93 GetEventHandlers().Publish(IdleEvent{});
94}
CallbackReturn Publish(const Message &message)
Send a message to connected callbacks.
Definition: Observer.h:207

References AppEvents::anonymous_namespace{AppEvents.cpp}::GetEventHandlers(), and Observer::Publisher< Message, NotifyAll >::Publish().

Referenced by AudacityApp::OnIdle().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ HandleAppInitialized()

void AppEvents::ProviderBase::HandleAppInitialized ( )
protected

Definition at line 78 of file AppEvents.cpp.

79{
80 auto& handlers = GetEventHandlers();
81
82 handlers.AppInitializedCalled = true;
83
84 std::vector<std::function<void()>> callbacks;
85 std::swap(callbacks, handlers.appInitialized);
86
87 for (auto& callback : callbacks)
88 callback();
89}

References AppEvents::anonymous_namespace{AppEvents.cpp}::GetEventHandlers(), and anonymous_namespace{NoteTrack.cpp}::swap().

Referenced by AudacityApp::InitPart2().

Here is the call graph for this function:
Here is the caller graph for this function:

The documentation for this class was generated from the following files: