Audacity  3.0.3
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 388 of file Prefs.h.

Constructor & Destructor Documentation

◆ PrefsListener()

PrefsListener::PrefsListener ( )

Definition at line 118 of file Prefs.cpp.

119  : mpImpl{ std::make_unique<Impl>( *this ) }
120 {
121 }

◆ ~PrefsListener()

PrefsListener::~PrefsListener ( )
virtual

Definition at line 123 of file Prefs.cpp.

124 {
125 }

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

101 {
102  BasicUI::CallAfter([id]{
103  MyEvent event{ id };
104  hub().ProcessEvent(event);
105  });
106 }

References BasicUI::CallAfter(), and hub().

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()

virtual void PrefsListener::UpdatePrefs ( )
pure virtual

◆ UpdateSelectedPrefs()

void PrefsListener::UpdateSelectedPrefs ( int  id)
protectedvirtual

Reimplemented in MeterPanel, DeviceToolBar, TrackArtist, and ViewInfo.

Definition at line 127 of file Prefs.cpp.

128 {
129 }

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


The documentation for this class was generated from the following files:
BasicUI::CallAfter
void CallAfter(Action action)
Schedule an action to be done later, and in the main thread.
Definition: BasicUI.cpp:38
MyEvent
Definition: Prefs.cpp:77
hub
static wxEvtHandler & hub()
Definition: Prefs.cpp:94
PrefsListener::mpImpl
std::unique_ptr< Impl > mpImpl
Definition: Prefs.h:415