Audacity 3.2.0
Public Member Functions | Friends | List of all members
Theme Class Referencefinal

Based on ThemeBase, Theme manages image and icon resources. More...

#include <Theme.h>

Inheritance diagram for Theme:
[legend]
Collaboration diagram for Theme:
[legend]

Public Member Functions

 Theme (void)
 
 ~Theme (void)
 
void EnsureInitialised () override
 
void RegisterImagesAndColours ()
 
- Public Member Functions inherited from ThemeBase
 ThemeBase (void)
 
 ThemeBase (const ThemeBase &)=delete
 
ThemeBaseoperator= (const ThemeBase &)=delete
 
virtual ~ThemeBase (void)
 
virtual void EnsureInitialised ()=0
 
FilePath GetFilePath ()
 
void SetFilePath (const FilePath &path)
 
void SwitchTheme (teThemeType Theme)
 
void LoadTheme (teThemeType Theme)
 
void RegisterImage (NameSet &allNames, int &flags, int &iIndex, char const **pXpm, const wxString &Name)
 
void RegisterImage (NameSet &allNames, int &flags, int &iIndex, const wxImage &Image, const wxString &Name)
 
void RegisterColour (NameSet &allNames, int &iIndex, const wxColour &Clr, const wxString &Name)
 
teThemeType GetFallbackThemeType ()
 
void CreateImageCache ()
 
bool CreateOneImageCache (teThemeType id, bool bBinarySave)
 
bool ReadImageCache (teThemeType type={}, bool bOkIfNotFound=false)
 
void LoadThemeComponents (bool bOkIfNotFound=false)
 
void LoadOneThemeComponents (teThemeType id, bool bOkIfNotFound=false)
 
void SaveThemeComponents ()
 
bool SaveOneThemeComponents (teThemeType id)
 
void SaveThemeAsCode ()
 
void WriteImageDefs ()
 Writes a series of Macro definitions that can be used in the include file. More...
 
void WriteImageMap ()
 
void WriteOneImageMap (teThemeType id)
 
void RecolourBitmap (int iIndex, wxColour From, wxColour To)
 
int ColourDistance (wxColour &From, wxColour &To)
 
wxColour & Colour (int iIndex)
 
wxBitmap & Bitmap (int iIndex)
 
wxImageImage (int iIndex)
 
wxSize ImageSize (int iIndex)
 
void ReplaceImage (int iIndex, wxImage *pImage)
 
void RotateImageInto (int iTo, int iFrom, bool bClockwise)
 
void SetBrushColour (wxBrush &Brush, int iIndex)
 
void SetPenColour (wxPen &Pen, int iIndex)
 
wxImage MaskedImage (char const **pXpm, char const **pMask)
 
wxImage MakeImageWithAlpha (wxBitmap &Bmp)
 
void DeleteUnusedThemes ()
 
- Public Member Functions inherited from Observer::Publisher< ThemeChangeMessage >
 Publisher (ExceptionPolicy *pPolicy=nullptr, Alloc a={})
 Constructor supporting type-erased custom allocation/deletion. More...
 
 Publisher (Publisher &&)=default
 
Publisheroperator= (Publisher &&)=default
 
Subscription Subscribe (Callback callback)
 Connect a callback to the Publisher; later-connected are called earlier. More...
 
Subscription Subscribe (Object &obj, Return(Object::*callback)(Args...))
 Overload of Subscribe takes an object and pointer-to-member-function. More...
 

Friends

class AColor
 

Additional Inherited Members

- Public Types inherited from ThemeBase
using NameSet = std::unordered_set< wxString >
 
- Public Types inherited from Observer::Publisher< ThemeChangeMessage >
using message_type = ThemeChangeMessage
 
using CallbackReturn = std::conditional_t< true, void, bool >
 
using Callback = std::function< CallbackReturn(const ThemeChangeMessage &) >
 Type of functions that can be connected to the Publisher. More...
 
- Static Public Member Functions inherited from ThemeBase
static bool LoadPreferredTheme ()
 
- Static Public Attributes inherited from Observer::Publisher< ThemeChangeMessage >
static constexpr bool notifies_all
 
- Protected Member Functions inherited from Observer::Publisher< ThemeChangeMessage >
CallbackReturn Publish (const ThemeChangeMessage &message)
 Send a message to connected callbacks. More...
 
- Protected Attributes inherited from ThemeBase
FilePath mThemeDir
 
wxArrayString mBitmapNames
 
std::vector< int > mBitmapFlags
 
wxArrayString mColourNames
 
PreferredSystemAppearance mPreferredSystemAppearance { PreferredSystemAppearance::Light }
 
std::map< Identifier, ThemeSetmSets
 
ThemeSetmpSet = nullptr
 

Detailed Description

Based on ThemeBase, Theme manages image and icon resources.

Theme is a class which manages theme resources. It maps sets of ids to the resources and to names of the resources, so that they can be loaded/saved from files.

Theme adds the Audacity specific images to ThemeBase.

See also
Themability of Audacity

Definition at line 208 of file Theme.h.

Constructor & Destructor Documentation

◆ Theme()

Theme::Theme ( void  )

Definition at line 84 of file Theme.cpp.

85{
86}

◆ ~Theme()

Theme::~Theme ( void  )

Definition at line 88 of file Theme.cpp.

89{
90}

Member Function Documentation

◆ EnsureInitialised()

void Theme::EnsureInitialised ( )
overridevirtual

Implements ThemeBase.

Definition at line 137 of file Theme.cpp.

138{
139 if ( !mpSet || mpSet->bInitialised )
140 return;
142
143#ifdef EXPERIMENTAL_EXTRA_THEME_RESOURCES
144 extern void RegisterExtraThemeResources();
145 RegisterExtraThemeResources();
146#endif
147}
ThemeSet * mpSet
Definition: Theme.h:205
void RegisterImagesAndColours()
Definition: Theme.cpp:169
bool bInitialised
Definition: Theme.h:107

References ThemeSet::bInitialised, ThemeBase::mpSet, and RegisterImagesAndColours().

Here is the call graph for this function:

◆ RegisterImagesAndColours()

void Theme::RegisterImagesAndColours ( )

Definition at line 169 of file Theme.cpp.

170{
171 if ( !mpSet || mpSet->bInitialised )
172 return;
173 mpSet->bInitialised = true;
174
175// This initialises the variables e.g
176// RegisterImage( myFlags, bmpRecordButton, some image, wxT("RecordButton"));
177 int myFlags = resFlagPaired;
178 NameSet allNames;
179#define THEME_INITS
180#include "AllThemeResources.h"
181
182
183}
@ resFlagPaired
Definition: Theme.h:61
std::unordered_set< wxString > NameSet
Definition: Theme.h:151

References ThemeSet::bInitialised, ThemeBase::mpSet, and resFlagPaired.

Referenced by EnsureInitialised().

Here is the caller graph for this function:

Friends And Related Function Documentation

◆ AColor

friend class AColor
friend

Definition at line 210 of file Theme.h.


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