Audacity 3.2.0
Public Member Functions | Private Member Functions | Private Attributes | List of all members
ThemedAButtonWrapper< AButtonBase > Class Template Referencefinal

#include <ThemedWrappers.h>

Inheritance diagram for ThemedAButtonWrapper< AButtonBase >:
[legend]
Collaboration diagram for ThemedAButtonWrapper< AButtonBase >:
[legend]

Public Member Functions

template<typename... Args>
 ThemedAButtonWrapper (Args &&... args)
 
void SetImageIndices (int setIndex, int up, int over, int down, int overDown, int disabled)
 
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
 

Private Member Functions

void OnThemeChange (ThemeChangeMessage message)
 

Private Attributes

Observer::Subscription mThemeChangeSubscription
 
std::map< int, std::array< int, AButton::AButtonStateCount > > mSets
 
int mBackgroundColorIndex {-1}
 
int mForegroundColorIndex {-1}
 
std::optional< TranslatableStringmTranslatableLabel
 

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...
 
- Protected Member Functions inherited from PrefsListener
virtual void UpdateSelectedPrefs (int id)
 

Detailed Description

template<typename AButtonBase>
class ThemedAButtonWrapper< AButtonBase >

Definition at line 185 of file ThemedWrappers.h.

Constructor & Destructor Documentation

◆ ThemedAButtonWrapper()

template<typename AButtonBase >
template<typename... Args>
ThemedAButtonWrapper< AButtonBase >::ThemedAButtonWrapper ( Args &&...  args)
inline

Definition at line 198 of file ThemedWrappers.h.

198 : AButtonBase( std::forward<Args>(args)... )
199 {
202 }
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
Observer::Subscription mThemeChangeSubscription
void OnThemeChange(ThemeChangeMessage message)

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

Here is the call graph for this function:

Member Function Documentation

◆ OnThemeChange()

template<typename AButtonBase >
void ThemedAButtonWrapper< AButtonBase >::OnThemeChange ( ThemeChangeMessage  message)
inlineprivate

Definition at line 249 of file ThemedWrappers.h.

250 {
251 if (message.appearance)
252 {
253 for(const auto& p : mSets)
254 AButtonBase::SetAlternateImages(
255 p.first,
261 );
262
263 if(mBackgroundColorIndex != -1)
264 AButtonBase::SetBackgroundColour(theTheme.Colour(mBackgroundColorIndex));
265
266 if(mForegroundColorIndex != -1)
267 AButtonBase::SetForegroundColour(theTheme.Colour(mForegroundColorIndex));
268
269 AButtonBase::Refresh(false);
270 }
271 }
@ AButtonUp
Definition: AButton.h:227
@ AButtonDis
Definition: AButton.h:231
@ AButtonOver
Definition: AButton.h:228
@ AButtonDown
Definition: AButton.h:229
@ AButtonOverDown
Definition: AButton.h:230
wxColour & Colour(int iIndex)
wxImage & Image(int iIndex)
std::map< int, std::array< int, AButton::AButtonStateCount > > mSets
std::optional< PreferredSystemAppearance > appearance
Definition: Theme.h:112

References AButton::AButtonDis, AButton::AButtonDown, AButton::AButtonOver, AButton::AButtonOverDown, AButton::AButtonUp, ThemeChangeMessage::appearance, ThemeBase::Colour(), ThemeBase::Image(), ThemedAButtonWrapper< AButtonBase >::mBackgroundColorIndex, ThemedAButtonWrapper< AButtonBase >::mForegroundColorIndex, ThemedAButtonWrapper< AButtonBase >::mSets, and theTheme.

Referenced by ThemedAButtonWrapper< AButtonBase >::ThemedAButtonWrapper().

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

◆ SetBackgroundColorIndex()

template<typename AButtonBase >
void ThemedAButtonWrapper< AButtonBase >::SetBackgroundColorIndex ( int  index)
inline

Definition at line 217 of file ThemedWrappers.h.

218 {
219 mBackgroundColorIndex = index;
220 if(index != -1)
221 AButtonBase::SetBackgroundColour(theTheme.Colour(mBackgroundColorIndex));
222 }

References ThemeBase::Colour(), ThemedAButtonWrapper< AButtonBase >::mBackgroundColorIndex, and theTheme.

Here is the call graph for this function:

◆ SetForegroundColorIndex()

template<typename AButtonBase >
void ThemedAButtonWrapper< AButtonBase >::SetForegroundColorIndex ( int  index)
inline

Definition at line 224 of file ThemedWrappers.h.

225 {
226 mForegroundColorIndex = index;
227 if(index != -1)
228 AButtonBase::SetForegroundColour(theTheme.Colour(mForegroundColorIndex));
229 }

References ThemeBase::Colour(), ThemedAButtonWrapper< AButtonBase >::mForegroundColorIndex, and theTheme.

Here is the call graph for this function:

◆ SetImageIndices()

template<typename AButtonBase >
void ThemedAButtonWrapper< AButtonBase >::SetImageIndices ( int  setIndex,
int  up,
int  over,
int  down,
int  overDown,
int  disabled 
)
inline

Definition at line 204 of file ThemedWrappers.h.

205 {
206 mSets[setIndex] = { up, over, down, overDown, disabled };
207 AButtonBase::SetAlternateImages(
208 setIndex,
209 theTheme.Image(up),
210 theTheme.Image(over),
211 theTheme.Image(down),
212 theTheme.Image(overDown),
213 theTheme.Image(disabled)
214 );
215 }

References ThemeBase::Image(), ThemedAButtonWrapper< AButtonBase >::mSets, and theTheme.

Here is the call graph for this function:

◆ SetTranslatableLabel()

template<typename AButtonBase >
void ThemedAButtonWrapper< AButtonBase >::SetTranslatableLabel ( TranslatableString  label)
inline

Definition at line 231 of file ThemedWrappers.h.

232 {
233 mTranslatableLabel = std::move(label);
234 AButtonBase::SetLabel(*mTranslatableLabel);
235 }
TranslatableString label
Definition: TagsEditor.cpp:163
std::optional< TranslatableString > mTranslatableLabel

References label, and ThemedAButtonWrapper< AButtonBase >::mTranslatableLabel.

◆ UpdatePrefs()

template<typename AButtonBase >
void ThemedAButtonWrapper< AButtonBase >::UpdatePrefs ( )
inlineoverridevirtual

Implements PrefsListener.

Definition at line 237 of file ThemedWrappers.h.

238 {
241 {
242 AButtonBase::SetLabel(*mTranslatableLabel);
243 AButtonBase::Refresh(false);
244 }
245 }
virtual void UpdatePrefs()=0
Definition: Prefs.cpp:124

References ThemedAButtonWrapper< AButtonBase >::mTranslatableLabel, and PrefsListener::UpdatePrefs().

Here is the call graph for this function:

Member Data Documentation

◆ mBackgroundColorIndex

template<typename AButtonBase >
int ThemedAButtonWrapper< AButtonBase >::mBackgroundColorIndex {-1}
private

◆ mForegroundColorIndex

template<typename AButtonBase >
int ThemedAButtonWrapper< AButtonBase >::mForegroundColorIndex {-1}
private

◆ mSets

template<typename AButtonBase >
std::map<int, std::array<int, AButton::AButtonStateCount> > ThemedAButtonWrapper< AButtonBase >::mSets
private

◆ mThemeChangeSubscription

template<typename AButtonBase >
Observer::Subscription ThemedAButtonWrapper< AButtonBase >::mThemeChangeSubscription
private

◆ mTranslatableLabel

template<typename AButtonBase >
std::optional<TranslatableString> ThemedAButtonWrapper< AButtonBase >::mTranslatableLabel
private

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