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 91 of file AudioSetupToolBar.h.

Member Function Documentation

◆ AppendSubMenu()

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

Definition at line 572 of file AudioSetupToolBar.cpp.

574{
576 AppendSubMenu(toolBar, menu, mStrings, mIndex, callback, title);
577}
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 93 of file AudioSetupToolBar.h.

93{ 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 94 of file AudioSetupToolBar.h.

94{ 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 108 of file AudioSetupToolBar.h.

108 {
109 return make_iterator_range(mStrings).index(name);
110 }
IteratorRange< Iterator > make_iterator_range(const Iterator &i1, const Iterator &i2)
Definition: IteratorX.h:210
wxString name
Definition: TagsEditor.cpp:166

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 95 of file AudioSetupToolBar.h.

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

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 100 of file AudioSetupToolBar.h.

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

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 105 of file AudioSetupToolBar.h.

105 {
106 return mIndex;
107 }

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 111 of file AudioSetupToolBar.h.

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

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 125 of file AudioSetupToolBar.h.

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

References id, mIndex, and mStrings.

◆ Set() [3/3]

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

Definition at line 120 of file AudioSetupToolBar.h.

120 {
121 mStrings.swap(names);
122 mIndex = mStrings.empty() ? -1 : 0;
123 }
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 136 of file AudioSetupToolBar.h.

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

◆ mStrings

wxArrayStringEx AudioSetupToolBar::Choices::mStrings
private

Definition at line 135 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: