Audacity 3.2.0
Public Member Functions | Protected Member Functions | Private Types | 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
 

Protected Member Functions

void OnThemeChange (ThemeChangeMessage message)
 

Private Types

using PrefsListenerBase = std::conditional_t< std::is_base_of_v< PrefsListener, WindowBase >, WindowBase, PrefsListener >
 

Private Attributes

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

Detailed Description

template<class WindowBase>
class ThemedWindowWrapper< WindowBase >

Definition at line 31 of file ThemedWrappers.h.

Member Typedef Documentation

◆ PrefsListenerBase

template<class WindowBase >
using ThemedWindowWrapper< WindowBase >::PrefsListenerBase = std::conditional_t<std::is_base_of_v<PrefsListener, WindowBase>, WindowBase, PrefsListener>
private

Definition at line 40 of file ThemedWrappers.h.

Constructor & Destructor Documentation

◆ ThemedWindowWrapper()

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

Definition at line 44 of file ThemedWrappers.h.

44 : WindowBase( std::forward<Args>(args)... )
45 {
48 }
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 78 of file ThemedWrappers.h.

79 {
80 if (message.appearance)
81 {
82 if(mBackgroundColorIndex != -1)
83 WindowBase::SetBackgroundColour(theTheme.Colour(mBackgroundColorIndex));
84 if(mForegroundColorIndex != -1)
85 WindowBase::SetForegroundColour(theTheme.Colour(mForegroundColorIndex));
86 WindowBase::Refresh();
87 }
88 }
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 50 of file ThemedWrappers.h.

51 {
53 if(index != -1)
54 WindowBase::SetBackgroundColour(theTheme.Colour(mBackgroundColorIndex));
55 }

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 57 of file ThemedWrappers.h.

58 {
60 if(index != -1)
61 WindowBase::SetForegroundColour(theTheme.Colour(mForegroundColorIndex));
62 }

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 64 of file ThemedWrappers.h.

65 {
66 mTranslatableLabel = std::move(label);
67 WindowBase::SetLabel(mTranslatableLabel->Translation());
68 }
TranslatableString label
Definition: TagsEditor.cpp:165
std::optional< TranslatableString > mTranslatableLabel

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

◆ UpdatePrefs()

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

Definition at line 70 of file ThemedWrappers.h.

71 {
72 PrefsListenerBase::UpdatePrefs();
74 WindowBase::SetLabel(mTranslatableLabel->Translation());
75 }

References ThemedWindowWrapper< WindowBase >::mTranslatableLabel.

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: