Audacity 3.2.0
Public Member Functions | Private Attributes | List of all members
AudioSetupToolBar::Choices Class Reference
Collaboration diagram for AudioSetupToolBar::Choices:
[legend]

Public Member Functions

void Clear ()
 
bool Empty () const
 
std::optional< wxString > Get () const
 
wxString GetFirst () const
 
int GetSmallIntegerId () const
 
int Find (const wxString &name) const
 
bool Set (const wxString &name)
 
void Set (wxArrayString &&names)
 
bool Set (int id)
 
void AppendSubMenu (AudioSetupToolBar &toolBar, wxMenu &menu, Callback callback, const wxString &title)
 

Private Attributes

wxArrayStringEx mStrings
 
int mIndex { -1 }
 

Detailed Description

Definition at line 92 of file AudioSetupToolBar.h.

Member Function Documentation

◆ AppendSubMenu()

void AudioSetupToolBar::Choices::AppendSubMenu ( AudioSetupToolBar toolBar,
wxMenu &  menu,
Callback  callback,
const wxString &  title 
)

Definition at line 600 of file AudioSetupToolBar.cpp.

602{
604 AppendSubMenu(toolBar, menu, mStrings, mIndex, callback, title);
605}
static const auto title
static void AppendSubMenu(AudioSetupToolBar &toolbar, wxMenu &menu, const wxArrayString &labels, int checkedItem, Callback callback, const wxString &title)

References AudioSetupToolBar::AppendSubMenu(), mIndex, mStrings, and title.

Referenced by AudioSetupToolBar::OnAudioSetup().

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

◆ Clear()

void AudioSetupToolBar::Choices::Clear ( )
inline

Definition at line 94 of file AudioSetupToolBar.h.

94{ mStrings.Clear(); mIndex = -1; }

References mIndex, and mStrings.

Referenced by AudioSetupToolBar::DeinitChildren(), AudioSetupToolBar::FillHostDevices(), and AudioSetupToolBar::FillInputChannels().

Here is the caller graph for this function:

◆ Empty()

bool AudioSetupToolBar::Choices::Empty ( ) const
inline

Definition at line 95 of file AudioSetupToolBar.h.

95{ return mStrings.empty(); }

References mStrings.

Referenced by GetFirst(), and AudioSetupToolBar::UpdatePrefs().

Here is the caller graph for this function:

◆ Find()

int AudioSetupToolBar::Choices::Find ( const wxString &  name) const
inline

Definition at line 109 of file AudioSetupToolBar.h.

109 {
110 return make_iterator_range(mStrings).index(name);
111 }
const TranslatableString name
Definition: Distortion.cpp:76
IteratorRange< Iterator > make_iterator_range(const Iterator &i1, const Iterator &i2)
Definition: IteratorX.h:210

References make_iterator_range(), mStrings, and name.

Referenced by AudioSetupToolBar::FillHostDevices().

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

◆ Get()

std::optional< wxString > AudioSetupToolBar::Choices::Get ( ) const
inline

Definition at line 96 of file AudioSetupToolBar.h.

96 {
97 if (mIndex < 0 || mIndex >= mStrings.size())
98 return {};
99 return { mStrings[mIndex] };
100 }

References mIndex, and mStrings.

Referenced by AudioSetupToolBar::ChangeDeviceLabel(), AudioSetupToolBar::ChangeHost(), and AudioSetupToolBar::UpdatePrefs().

Here is the caller graph for this function:

◆ GetFirst()

wxString AudioSetupToolBar::Choices::GetFirst ( ) const
inline

Definition at line 101 of file AudioSetupToolBar.h.

101 {
102 if (!Empty())
103 return mStrings[0];
104 return {};
105 }

References Empty(), and mStrings.

Referenced by AudioSetupToolBar::UpdatePrefs().

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

◆ GetSmallIntegerId()

int AudioSetupToolBar::Choices::GetSmallIntegerId ( ) const
inline

Definition at line 106 of file AudioSetupToolBar.h.

106 {
107 return mIndex;
108 }

References mIndex.

Referenced by AudioSetupToolBar::UpdatePrefs().

Here is the caller graph for this function:

◆ Set() [1/3]

bool AudioSetupToolBar::Choices::Set ( const wxString &  name)
inline

Definition at line 112 of file AudioSetupToolBar.h.

112 {
113 auto index = make_iterator_range(mStrings).index(name);
114 if (index != -1) {
115 mIndex = index;
116 return true;
117 }
118 // else no state change
119 return false;
120 }

References make_iterator_range(), mIndex, mStrings, and name.

Referenced by AudioSetupToolBar::ChangeDeviceLabel(), AudioSetupToolBar::ChangeHost(), AudioSetupToolBar::FillHostDevices(), AudioSetupToolBar::FillHosts(), AudioSetupToolBar::FillInputChannels(), AudioSetupToolBar::OnChannels(), and AudioSetupToolBar::UpdatePrefs().

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

◆ Set() [2/3]

bool AudioSetupToolBar::Choices::Set ( int  id)
inline

Definition at line 126 of file AudioSetupToolBar.h.

126 {
127 if (id < 0 || id >= mStrings.size())
128 return false; // no change of state then
129 mIndex = id;
130 return true;
131 }
int id

References id, mIndex, and mStrings.

◆ Set() [3/3]

void AudioSetupToolBar::Choices::Set ( wxArrayString &&  names)
inline

Definition at line 121 of file AudioSetupToolBar.h.

121 {
122 mStrings.swap(names);
123 mIndex = mStrings.empty() ? -1 : 0;
124 }
static TranslatableStrings names
Definition: TagsEditor.cpp:153

References mIndex, mStrings, and names.

Member Data Documentation

◆ mIndex

int AudioSetupToolBar::Choices::mIndex { -1 }
private

Definition at line 137 of file AudioSetupToolBar.h.

Referenced by AppendSubMenu(), Clear(), Get(), GetSmallIntegerId(), and Set().

◆ mStrings

wxArrayStringEx AudioSetupToolBar::Choices::mStrings
private

Definition at line 136 of file AudioSetupToolBar.h.

Referenced by AppendSubMenu(), Clear(), Empty(), Find(), Get(), GetFirst(), and Set().


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