Audacity 3.2.0
Classes | Public Member Functions | Static Public Member Functions | Protected Member Functions | Private Attributes | List of all members
PrefsListener Class Referenceabstract

A listener notified of changes in preferences. More...

#include <Prefs.h>

Inheritance diagram for PrefsListener:
[legend]
Collaboration diagram for PrefsListener:
[legend]

Classes

struct  Impl
 

Public Member Functions

 PrefsListener ()
 
virtual ~PrefsListener ()
 
virtual void UpdatePrefs ()=0
 

Static Public Member Functions

static void Broadcast (int id=0)
 Call this static function to notify all PrefsListener objects. More...
 

Protected Member Functions

virtual void UpdateSelectedPrefs (int id)
 

Private Attributes

std::unique_ptr< ImplmpImpl
 

Detailed Description

A listener notified of changes in preferences.

Definition at line 473 of file Prefs.h.

Constructor & Destructor Documentation

◆ PrefsListener()

PrefsListener::PrefsListener ( )

Definition at line 115 of file Prefs.cpp.

116 : mpImpl{ std::make_unique<Impl>( *this ) }
117{
118}
std::unique_ptr< Impl > mpImpl
Definition: Prefs.h:501

◆ ~PrefsListener()

PrefsListener::~PrefsListener ( )
virtual

Definition at line 120 of file Prefs.cpp.

121{
122}

Member Function Documentation

◆ Broadcast()

void PrefsListener::Broadcast ( int  id = 0)
static

Call this static function to notify all PrefsListener objects.

Parameters
idwhen positive, passed to UpdateSelectedPrefs() of all listeners, meant to indicate that only a certain subset of preferences have changed; else their UpdatePrefs() methods are called. (That is supposed to happen when the user OK's changes in the Preferences dialog.) Callbacks are delayed, in the main thread, using BasicUI::CallAfter

Definition at line 98 of file Prefs.cpp.

99{
101 hub().Publish(id);
102 });
103}
CallbackReturn Publish(const Message &message)
Send a message to connected callbacks.
Definition: Observer.h:207
void CallAfter(Action action)
Schedule an action to be done later, and in the main thread.
Definition: BasicUI.cpp:38

References BasicUI::CallAfter(), anonymous_namespace{Prefs.cpp}::hub(), and Observer::Publisher< Message, NotifyAll >::Publish().

Referenced by AdornedRulerPanel::OnAutoScroll(), DeviceToolBar::OnChoice(), PrefsDialog::OnOK(), MeterPanel::OnPreferences(), ViewActions::Handler::OnShowClipping(), and ViewActions::Handler::OnShowNameOverlay().

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

◆ UpdatePrefs()

void PrefsListener::UpdatePrefs ( )
pure virtual

◆ UpdateSelectedPrefs()

void PrefsListener::UpdateSelectedPrefs ( int  id)
protectedvirtual

Reimplemented in ViewInfo, TrackArtist, DeviceToolBar, and MeterPanel.

Definition at line 128 of file Prefs.cpp.

129{
130}

Referenced by PrefsListener::Impl::OnEvent(), ViewInfo::UpdateSelectedPrefs(), and DeviceToolBar::UpdateSelectedPrefs().

Here is the caller graph for this function:

Member Data Documentation

◆ mpImpl

std::unique_ptr<Impl> PrefsListener::mpImpl
private

Definition at line 502 of file Prefs.h.


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