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

Constructor & Destructor Documentation

◆ ThemedButtonWrapper()

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

Definition at line 101 of file ThemedWrappers.h.

101 : ButtonBase( std::forward<Args>(args)... )
102 {
105 }
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 107 of file ThemedWrappers.h.

108 {
109 return mBitmapIndex;
110 }

References ThemedButtonWrapper< ButtonBase >::mBitmapIndex.

◆ OnThemeChange()

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

Definition at line 162 of file ThemedWrappers.h.

163 {
164 if (message.appearance)
165 {
166 if(mBitmapIndex != -1)
167 ButtonBase::SetBitmap(theTheme.Bitmap(mBitmapIndex));
168 if(mLabelBitmapIndex != -1)
169 ButtonBase::SetBitmapLabel(theTheme.Bitmap(mLabelBitmapIndex));
170 if(mPressedBitmapIndex != -1)
171 ButtonBase::SetBitmapPressed(theTheme.Bitmap(mPressedBitmapIndex));
172 if(mCurrentBitmapIndex != -1)
173 ButtonBase::SetBitmapCurrent(theTheme.Bitmap(mCurrentBitmapIndex));
174 if(mFocusBitmapIndex != -1)
175 ButtonBase::SetBitmapFocus(theTheme.Bitmap(mFocusBitmapIndex));
176
177 if(mBackgroundColorIndex != -1)
178 ButtonBase::SetBackgroundColour(theTheme.Colour(mBackgroundColorIndex));
179 ButtonBase::Refresh();
180 }
181 }
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 141 of file ThemedWrappers.h.

142 {
143 mBackgroundColorIndex = index;
144 if(index != -1)
145 ButtonBase::SetBackgroundColour(theTheme.Colour(mBackgroundColorIndex));
146 }

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

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

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

113 {
114 mFocusBitmapIndex = index;
115 ButtonBase::SetBitmapFocus(theTheme.Bitmap(mFocusBitmapIndex));
116 }

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

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

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

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

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

130 {
131 mPressedBitmapIndex = index;
132 ButtonBase::SetBitmapPressed(theTheme.Bitmap(mPressedBitmapIndex));
133 }

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

149 {
150 mTranslatableLabel = std::move(label);
151 ButtonBase::SetLabel(mTranslatableLabel->Translation());
152 }
TranslatableString label
Definition: TagsEditor.cpp:163
std::optional< TranslatableString > mTranslatableLabel

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

◆ UpdatePrefs()

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

Implements PrefsListener.

Definition at line 154 of file ThemedWrappers.h.

155 {
158 ButtonBase::SetLabel(mTranslatableLabel->Translation());
159 }
virtual void UpdatePrefs()=0
Definition: Prefs.cpp:124

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: