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:
Collaboration diagram for PrefsListener:


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 555 of file Prefs.h.

Constructor & Destructor Documentation

◆ PrefsListener()

PrefsListener::PrefsListener ( )

Definition at line 114 of file Prefs.cpp.

115 : mpImpl{ std::make_unique<Impl>( *this ) }
std::unique_ptr< Impl > mpImpl
Definition: Prefs.h:583

◆ ~PrefsListener()

PrefsListener::~PrefsListener ( )

Definition at line 119 of file Prefs.cpp.


Member Function Documentation

◆ Broadcast()

void PrefsListener::Broadcast ( int  id = 0)

Call this static function to notify all PrefsListener objects.

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 97 of file Prefs.cpp.

100 hub().Publish(id);
101 });
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:208

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

Referenced by AudioSetupToolBar::CommonMenuItemSteps(), InitPreferences(), 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)

Reimplemented in ViewInfo, TrackArtist, AudioSetupToolBar, DeviceToolBar, and MeterPanel.

Definition at line 127 of file Prefs.cpp.


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

Here is the caller graph for this function:

Member Data Documentation

◆ mpImpl

std::unique_ptr<Impl> PrefsListener::mpImpl

Definition at line 584 of file Prefs.h.

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