Audacity 3.2.0
Public Member Functions | Protected Member Functions | Private Attributes | List of all members
ThemedWindowWrapper< WindowBase > Class Template Referencefinal

#include <ThemedWrappers.h>

Inheritance diagram for ThemedWindowWrapper< WindowBase >:
[legend]
Collaboration diagram for ThemedWindowWrapper< WindowBase >:
[legend]

Public Member Functions

template<typename... Args>
 ThemedWindowWrapper (Args &&... args)
 
void SetBackgroundColorIndex (int index)
 
void SetForegroundColorIndex (int index)
 
void SetTranslatableLabel (TranslatableString label)
 
void UpdatePrefs () override
 
- Public Member Functions inherited from PrefsListener
 PrefsListener ()
 
virtual ~PrefsListener ()
 
virtual void UpdatePrefs ()=0
 

Protected Member Functions

void OnThemeChange (ThemeChangeMessage message)
 
- Protected Member Functions inherited from PrefsListener
virtual void UpdateSelectedPrefs (int id)
 

Private Attributes

Observer::Subscription mThemeChangeSubscription
 
std::optional< TranslatableStringmTranslatableLabel
 
int mForegroundColorIndex { -1 }
 
int mBackgroundColorIndex { -1 }
 

Additional Inherited Members

- Static Public Member Functions inherited from PrefsListener
static void Broadcast (int id=0)
 Call this static function to notify all PrefsListener objects. More...
 

Detailed Description

template<class WindowBase>
class ThemedWindowWrapper< WindowBase >

Definition at line 28 of file ThemedWrappers.h.

Constructor & Destructor Documentation

◆ ThemedWindowWrapper()

template<class WindowBase >
template<typename... Args>
ThemedWindowWrapper< WindowBase >::ThemedWindowWrapper ( Args &&...  args)
inline

Definition at line 38 of file ThemedWrappers.h.

38 : WindowBase( std::forward<Args>(args)... )
39 {
42 }
THEME_API Theme theTheme
Definition: Theme.cpp:82
Subscription Subscribe(Callback callback)
Connect a callback to the Publisher; later-connected are called earlier.
Definition: Observer.h:199
void OnThemeChange(ThemeChangeMessage message)
Observer::Subscription mThemeChangeSubscription

References ThemedWindowWrapper< WindowBase >::mThemeChangeSubscription, ThemedWindowWrapper< WindowBase >::OnThemeChange(), Observer::Publisher< Message, NotifyAll >::Subscribe(), and theTheme.

Here is the call graph for this function:

Member Function Documentation

◆ OnThemeChange()

template<class WindowBase >
void ThemedWindowWrapper< WindowBase >::OnThemeChange ( ThemeChangeMessage  message)
inlineprotected

Definition at line 72 of file ThemedWrappers.h.

73 {
74 if (message.appearance)
75 {
76 if(mBackgroundColorIndex != -1)
77 WindowBase::SetBackgroundColour(theTheme.Colour(mBackgroundColorIndex));
78 if(mForegroundColorIndex != -1)
79 WindowBase::SetForegroundColour(theTheme.Colour(mForegroundColorIndex));
80 WindowBase::Refresh();
81 }
82 }
wxColour & Colour(int iIndex)
std::optional< PreferredSystemAppearance > appearance
Definition: Theme.h:112

References ThemeChangeMessage::appearance, ThemeBase::Colour(), ThemedWindowWrapper< WindowBase >::mBackgroundColorIndex, ThemedWindowWrapper< WindowBase >::mForegroundColorIndex, and theTheme.

Referenced by ThemedWindowWrapper< WindowBase >::ThemedWindowWrapper().

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

◆ SetBackgroundColorIndex()

template<class WindowBase >
void ThemedWindowWrapper< WindowBase >::SetBackgroundColorIndex ( int  index)
inline

Definition at line 44 of file ThemedWrappers.h.

45 {
47 if(index != -1)
48 WindowBase::SetBackgroundColour(theTheme.Colour(mBackgroundColorIndex));
49 }

References ThemeBase::Colour(), ThemedWindowWrapper< WindowBase >::mBackgroundColorIndex, and theTheme.

Here is the call graph for this function:

◆ SetForegroundColorIndex()

template<class WindowBase >
void ThemedWindowWrapper< WindowBase >::SetForegroundColorIndex ( int  index)
inline

Definition at line 51 of file ThemedWrappers.h.

52 {
54 if(index != -1)
55 WindowBase::SetForegroundColour(theTheme.Colour(mForegroundColorIndex));
56 }

References ThemeBase::Colour(), ThemedWindowWrapper< WindowBase >::mForegroundColorIndex, and theTheme.

Here is the call graph for this function:

◆ SetTranslatableLabel()

template<class WindowBase >
void ThemedWindowWrapper< WindowBase >::SetTranslatableLabel ( TranslatableString  label)
inline

Definition at line 58 of file ThemedWrappers.h.

59 {
60 mTranslatableLabel = std::move(label);
61 WindowBase::SetLabel(mTranslatableLabel->Translation());
62 }
TranslatableString label
Definition: TagsEditor.cpp:163
std::optional< TranslatableString > mTranslatableLabel

References label, and ThemedWindowWrapper< WindowBase >::mTranslatableLabel.

◆ UpdatePrefs()

template<class WindowBase >
void ThemedWindowWrapper< WindowBase >::UpdatePrefs ( )
inlineoverridevirtual

Implements PrefsListener.

Definition at line 64 of file ThemedWrappers.h.

65 {
68 WindowBase::SetLabel(mTranslatableLabel->Translation());
69 }
virtual void UpdatePrefs()=0
Definition: Prefs.cpp:124

References ThemedWindowWrapper< WindowBase >::mTranslatableLabel, and PrefsListener::UpdatePrefs().

Here is the call graph for this function:

Member Data Documentation

◆ mBackgroundColorIndex

template<class WindowBase >
int ThemedWindowWrapper< WindowBase >::mBackgroundColorIndex { -1 }
private

◆ mForegroundColorIndex

template<class WindowBase >
int ThemedWindowWrapper< WindowBase >::mForegroundColorIndex { -1 }
private

◆ mThemeChangeSubscription

template<class WindowBase >
Observer::Subscription ThemedWindowWrapper< WindowBase >::mThemeChangeSubscription
private

◆ mTranslatableLabel

template<class WindowBase >
std::optional<TranslatableString> ThemedWindowWrapper< WindowBase >::mTranslatableLabel
private

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