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

#include <ThemedWrappers.h>

Inheritance diagram for ThemedButtonWrapper< ButtonBase >:
[legend]
Collaboration diagram for ThemedButtonWrapper< ButtonBase >:
[legend]

Public Member Functions

template<typename... Args>
 ThemedButtonWrapper (Args &&... args)
 
int GetBitmapIndex () const
 
void SetBitmapFocusIndex (int index)
 
void SetBitmapIndex (int index)
 
void SetBitmapLabelIndex (int index)
 
void SetBitmapPressedIndex (int index)
 
void SetBitmapCurrentIndex (int index)
 
void SetBackgroundColorIndex (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
 
int mBitmapIndex { -1 }
 
int mFocusBitmapIndex { -1 }
 
int mLabelBitmapIndex { -1 }
 
int mPressedBitmapIndex { -1 }
 
int mCurrentBitmapIndex { -1 }
 
int mBackgroundColorIndex { -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...
 

Detailed Description

template<class ButtonBase>
class ThemedButtonWrapper< ButtonBase >

Definition at line 92 of file ThemedWrappers.h.

Constructor & Destructor Documentation

◆ ThemedButtonWrapper()

template<class ButtonBase >
template<typename... Args>
ThemedButtonWrapper< ButtonBase >::ThemedButtonWrapper ( Args &&...  args)
inline

Definition at line 107 of file ThemedWrappers.h.

107 : ButtonBase( std::forward<Args>(args)... )
108 {
111 }
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 ThemedButtonWrapper< ButtonBase >::mThemeChangeSubscription, ThemedButtonWrapper< ButtonBase >::OnThemeChange(), Observer::Publisher< Message, NotifyAll >::Subscribe(), and theTheme.

Here is the call graph for this function:

Member Function Documentation

◆ GetBitmapIndex()

template<class ButtonBase >
int ThemedButtonWrapper< ButtonBase >::GetBitmapIndex ( ) const
inline

Definition at line 113 of file ThemedWrappers.h.

114 {
115 return mBitmapIndex;
116 }

References ThemedButtonWrapper< ButtonBase >::mBitmapIndex.

◆ OnThemeChange()

template<class ButtonBase >
void ThemedButtonWrapper< ButtonBase >::OnThemeChange ( ThemeChangeMessage  message)
inlineprotected

Definition at line 168 of file ThemedWrappers.h.

169 {
170 if (message.appearance)
171 {
172 if(mBitmapIndex != -1)
173 ButtonBase::SetBitmap(theTheme.Bitmap(mBitmapIndex));
174 if(mLabelBitmapIndex != -1)
175 ButtonBase::SetBitmapLabel(theTheme.Bitmap(mLabelBitmapIndex));
176 if(mPressedBitmapIndex != -1)
177 ButtonBase::SetBitmapPressed(theTheme.Bitmap(mPressedBitmapIndex));
178 if(mCurrentBitmapIndex != -1)
179 ButtonBase::SetBitmapCurrent(theTheme.Bitmap(mCurrentBitmapIndex));
180 if(mFocusBitmapIndex != -1)
181 ButtonBase::SetBitmapFocus(theTheme.Bitmap(mFocusBitmapIndex));
182
183 if(mBackgroundColorIndex != -1)
184 ButtonBase::SetBackgroundColour(theTheme.Colour(mBackgroundColorIndex));
185 ButtonBase::Refresh();
186 }
187 }
wxColour & Colour(int iIndex)
wxBitmap & Bitmap(int iIndex)
std::optional< PreferredSystemAppearance > appearance
Definition: Theme.h:112

References ThemeChangeMessage::appearance, ThemeBase::Bitmap(), ThemeBase::Colour(), ThemedButtonWrapper< ButtonBase >::mBackgroundColorIndex, ThemedButtonWrapper< ButtonBase >::mBitmapIndex, ThemedButtonWrapper< ButtonBase >::mCurrentBitmapIndex, ThemedButtonWrapper< ButtonBase >::mFocusBitmapIndex, ThemedButtonWrapper< ButtonBase >::mLabelBitmapIndex, ThemedButtonWrapper< ButtonBase >::mPressedBitmapIndex, and theTheme.

Referenced by ThemedButtonWrapper< ButtonBase >::ThemedButtonWrapper().

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

◆ SetBackgroundColorIndex()

template<class ButtonBase >
void ThemedButtonWrapper< ButtonBase >::SetBackgroundColorIndex ( int  index)
inline

Definition at line 147 of file ThemedWrappers.h.

148 {
149 mBackgroundColorIndex = index;
150 if(index != -1)
151 ButtonBase::SetBackgroundColour(theTheme.Colour(mBackgroundColorIndex));
152 }

References ThemeBase::Colour(), ThemedButtonWrapper< ButtonBase >::mBackgroundColorIndex, and theTheme.

Here is the call graph for this function:

◆ SetBitmapCurrentIndex()

template<class ButtonBase >
void ThemedButtonWrapper< ButtonBase >::SetBitmapCurrentIndex ( int  index)
inline

Definition at line 141 of file ThemedWrappers.h.

142 {
143 mCurrentBitmapIndex = index;
144 ButtonBase::SetBitmapCurrent(theTheme.Bitmap(mCurrentBitmapIndex));
145 }

References ThemeBase::Bitmap(), ThemedButtonWrapper< ButtonBase >::mCurrentBitmapIndex, and theTheme.

Here is the call graph for this function:

◆ SetBitmapFocusIndex()

template<class ButtonBase >
void ThemedButtonWrapper< ButtonBase >::SetBitmapFocusIndex ( int  index)
inline

Definition at line 118 of file ThemedWrappers.h.

119 {
120 mFocusBitmapIndex = index;
121 ButtonBase::SetBitmapFocus(theTheme.Bitmap(mFocusBitmapIndex));
122 }

References ThemeBase::Bitmap(), ThemedButtonWrapper< ButtonBase >::mFocusBitmapIndex, and theTheme.

Here is the call graph for this function:

◆ SetBitmapIndex()

template<class ButtonBase >
void ThemedButtonWrapper< ButtonBase >::SetBitmapIndex ( int  index)
inline

Definition at line 124 of file ThemedWrappers.h.

125 {
126 mBitmapIndex = index;
127 ButtonBase::SetBitmap(theTheme.Bitmap(mBitmapIndex));
128 }

References ThemeBase::Bitmap(), ThemedButtonWrapper< ButtonBase >::mBitmapIndex, and theTheme.

Here is the call graph for this function:

◆ SetBitmapLabelIndex()

template<class ButtonBase >
void ThemedButtonWrapper< ButtonBase >::SetBitmapLabelIndex ( int  index)
inline

Definition at line 130 of file ThemedWrappers.h.

131 {
132 mLabelBitmapIndex = index;
133 ButtonBase::SetBitmapLabel(theTheme.Bitmap(mLabelBitmapIndex));
134 }

References ThemeBase::Bitmap(), ThemedButtonWrapper< ButtonBase >::mLabelBitmapIndex, and theTheme.

Here is the call graph for this function:

◆ SetBitmapPressedIndex()

template<class ButtonBase >
void ThemedButtonWrapper< ButtonBase >::SetBitmapPressedIndex ( int  index)
inline

Definition at line 135 of file ThemedWrappers.h.

136 {
137 mPressedBitmapIndex = index;
138 ButtonBase::SetBitmapPressed(theTheme.Bitmap(mPressedBitmapIndex));
139 }

References ThemeBase::Bitmap(), ThemedButtonWrapper< ButtonBase >::mPressedBitmapIndex, and theTheme.

Here is the call graph for this function:

◆ SetTranslatableLabel()

template<class ButtonBase >
void ThemedButtonWrapper< ButtonBase >::SetTranslatableLabel ( TranslatableString  label)
inline

Definition at line 154 of file ThemedWrappers.h.

155 {
156 mTranslatableLabel = std::move(label);
157 ButtonBase::SetLabel(mTranslatableLabel->Translation());
158 }
TranslatableString label
Definition: TagsEditor.cpp:165
std::optional< TranslatableString > mTranslatableLabel

References label, and ThemedButtonWrapper< ButtonBase >::mTranslatableLabel.

◆ UpdatePrefs()

template<class ButtonBase >
void ThemedButtonWrapper< ButtonBase >::UpdatePrefs ( )
inlineoverridevirtual

Implements PrefsListener.

Definition at line 160 of file ThemedWrappers.h.

161 {
164 ButtonBase::SetLabel(mTranslatableLabel->Translation());
165 }
virtual void UpdatePrefs()=0
Definition: Prefs.cpp:154

References ThemedButtonWrapper< ButtonBase >::mTranslatableLabel, and PrefsListener::UpdatePrefs().

Here is the call graph for this function:

Member Data Documentation

◆ mBackgroundColorIndex

template<class ButtonBase >
int ThemedButtonWrapper< ButtonBase >::mBackgroundColorIndex { -1 }
private

◆ mBitmapIndex

template<class ButtonBase >
int ThemedButtonWrapper< ButtonBase >::mBitmapIndex { -1 }
private

◆ mCurrentBitmapIndex

template<class ButtonBase >
int ThemedButtonWrapper< ButtonBase >::mCurrentBitmapIndex { -1 }
private

◆ mFocusBitmapIndex

template<class ButtonBase >
int ThemedButtonWrapper< ButtonBase >::mFocusBitmapIndex { -1 }
private

◆ mLabelBitmapIndex

template<class ButtonBase >
int ThemedButtonWrapper< ButtonBase >::mLabelBitmapIndex { -1 }
private

◆ mPressedBitmapIndex

template<class ButtonBase >
int ThemedButtonWrapper< ButtonBase >::mPressedBitmapIndex { -1 }
private

◆ mThemeChangeSubscription

template<class ButtonBase >
Observer::Subscription ThemedButtonWrapper< ButtonBase >::mThemeChangeSubscription
private

◆ mTranslatableLabel

template<class ButtonBase >
std::optional<TranslatableString> ThemedButtonWrapper< ButtonBase >::mTranslatableLabel
private

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