Audacity 3.2.0
Classes | Public Member Functions | Static Public Member Functions | Protected Member Functions | Protected Attributes | Private Member Functions | Private Attributes | List of all members
ShuttleGuiBase Class Reference

Base class for shuttling data to and from a GUI. More...

#include <ShuttleGui.h>

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

Classes

struct  ListControlColumn
 

Public Member Functions

 ShuttleGuiBase (wxWindow *pParent, teShuttleMode ShuttleMode, bool vertical, wxSize minSize)
 
virtual ~ShuttleGuiBase ()
 
void Init (bool vertical, wxSize minSize)
 
void ResetId ()
 
void HandleOptionality (const TranslatableString &Prompt)
 
wxStaticText * AddPrompt (const TranslatableString &Prompt, int wrapWidth=0)
 Right aligned text string. More...
 
void AddUnits (const TranslatableString &Prompt, int wrapWidth=0)
 Left aligned text string. More...
 
void AddTitle (const TranslatableString &Prompt, int wrapWidth=0)
 Centred text string. More...
 
wxWindow * AddWindow (wxWindow *pWindow, int PositionFlags=wxALIGN_CENTRE)
 
wxSlider * AddSlider (const TranslatableString &Prompt, int pos, int Max, int Min=0)
 
wxSlider * AddVSlider (const TranslatableString &Prompt, int pos, int Max)
 
wxSpinCtrl * AddSpinCtrl (const TranslatableString &Prompt, int Value, int Max, int Min)
 
SpinControlAddSpinControl (const wxSize &size, const TranslatableString &Prompt, double Value, double Max, double Min)
 
wxTreeCtrl * AddTree ()
 
wxRadioButton * AddRadioButton (const TranslatableString &Prompt, int selector=0, int initValue=0)
 
wxRadioButton * AddRadioButtonToGroup (const TranslatableString &Prompt, int selector=1, int initValue=0)
 
wxButton * AddButton (const TranslatableString &Text, int PositionFlags=wxALIGN_CENTRE, bool setDefault=false)
 
wxBitmapButton * AddBitmapButton (const wxBitmap &Bitmap, int PositionFlags=wxALIGN_CENTRE, bool setDefault=false)
 
wxStaticText * AddVariableText (const TranslatableString &Str, bool bCenter=false, int PositionFlags=0, int wrapWidth=0)
 
ReadOnlyTextAddReadOnlyText (const TranslatableString &Caption, const wxString &Value)
 
wxTextCtrl * AddTextBox (const TranslatableString &Caption, const wxString &Value, const int nChars)
 
wxTextCtrl * AddNumericTextBox (const TranslatableString &Caption, const wxString &Value, const int nChars, bool acceptEnter=false)
 
wxTextCtrl * AddTextWindow (const wxString &Value)
 Multiline text box that grows. More...
 
wxListBox * AddListBox (const wxArrayStringEx &choices)
 
wxListCtrl * AddListControl (std::initializer_list< const ListControlColumn > columns={}, long listControlStyles=0)
 
wxListCtrl * AddListControlReportMode (std::initializer_list< const ListControlColumn > columns={}, long listControlStyles=0)
 
wxGrid * AddGrid ()
 
wxCheckBox * AddCheckBox (const TranslatableString &Prompt, bool Selected)
 
wxCheckBox * AddCheckBoxOnRight (const TranslatableString &Prompt, bool Selected)
 
wxCheckBox * AddCheckBox (const TranslatableString &Prompt, const wxChar *)=delete
 
wxCheckBox * AddCheckBox (const TranslatableString &Prompt, const char *)=delete
 
wxCheckBox * AddCheckBoxOnRight (const TranslatableString &Prompt, const wxChar *)=delete
 
wxCheckBox * AddCheckBoxOnRight (const TranslatableString &Prompt, const char *)=delete
 
wxComboBox * AddCombo (const TranslatableString &Prompt, const wxString &Selected, const wxArrayStringEx &choices)
 
wxChoice * AddChoice (const TranslatableString &Prompt, const TranslatableStrings &choices, int Selected=-1)
 
wxChoice * AddChoice (const TranslatableString &Prompt, const TranslatableStrings &choices, const TranslatableString &selected)
 
void AddIcon (wxBitmap *pBmp)
 
void AddFixedText (const TranslatableString &Str, bool bCenter=false, int wrapWidth=0)
 
void AddConstTextBox (const TranslatableString &Caption, const TranslatableString &Value)
 Single line text box of fixed size. More...
 
void StartHorizontalLay (int PositionFlags=wxALIGN_CENTRE, int iProp=1)
 
void EndHorizontalLay ()
 
void StartVerticalLay (int iProp=1)
 
void StartVerticalLay (int PositionFlags, int iProp)
 
void EndVerticalLay ()
 
void StartWrapLay (int PositionFlags=wxEXPAND, int iProp=0)
 
void EndWrapLay ()
 
wxScrolledWindow * StartScroller (int iStyle=0)
 
void EndScroller ()
 
wxPanel * StartPanel (int iStyle=0)
 
void EndPanel ()
 
void StartMultiColumn (int nCols, int PositionFlags=wxALIGN_LEFT)
 
void EndMultiColumn ()
 
void StartTwoColumn ()
 
void EndTwoColumn ()
 
void StartThreeColumn ()
 
void EndThreeColumn ()
 
wxStaticBox * StartStatic (const TranslatableString &Str, int iProp=0)
 
void EndStatic ()
 
wxNotebook * StartNotebook ()
 
void EndNotebook ()
 
wxSimplebook * StartSimplebook ()
 
void EndSimplebook ()
 
wxNotebookPageStartNotebookPage (const TranslatableString &Name)
 
void EndNotebookPage ()
 
wxPanel * StartInvisiblePanel (int border=0)
 
void EndInvisiblePanel ()
 
void StartRadioButtonGroup (ChoiceSetting &Setting)
 Call this before any TieRadioButton calls. More...
 
void EndRadioButtonGroup ()
 
bool DoStep (int iStep)
 
int TranslateToIndex (const wxString &Value, const wxArrayStringEx &Choices)
 String-to-Index. More...
 
wxString TranslateFromIndex (const int nIn, const wxArrayStringEx &Choices)
 Index-to-String. More...
 
wxTextCtrl * TieTextBox (const TranslatableString &Caption, wxString &Value, const int nChars=0)
 
wxTextCtrl * TieTextBox (const TranslatableString &Prompt, int &Selected, const int nChars=0)
 
wxTextCtrl * TieTextBox (const TranslatableString &Prompt, double &Value, const int nChars=0)
 
wxTextCtrl * TieNumericTextBox (const TranslatableString &Prompt, int &Value, const int nChars=0, bool acceptEnter=false)
 
wxTextCtrl * TieNumericTextBox (const TranslatableString &Prompt, double &Value, const int nChars=0, bool acceptEnter=false)
 
wxCheckBox * TieCheckBox (const TranslatableString &Prompt, bool &Var)
 
wxCheckBox * TieCheckBoxOnRight (const TranslatableString &Prompt, bool &Var)
 
wxChoice * TieChoice (const TranslatableString &Prompt, TranslatableString &Selected, const TranslatableStrings &choices)
 
wxChoice * TieChoice (const TranslatableString &Prompt, int &Selected, const TranslatableStrings &choices)
 
wxSlider * TieSlider (const TranslatableString &Prompt, int &pos, const int max, const int min=0)
 
wxSlider * TieSlider (const TranslatableString &Prompt, double &pos, const double max, const double min=0.0)
 
wxSlider * TieSlider (const TranslatableString &Prompt, float &pos, const float fMin, const float fMax)
 
wxSlider * TieVSlider (const TranslatableString &Prompt, float &pos, const float fMin, const float fMax)
 
wxRadioButton * TieRadioButton ()
 This function must be within a StartRadioButtonGroup - EndRadioButtonGroup pair. More...
 
wxSpinCtrl * TieSpinCtrl (const TranslatableString &Prompt, int &Value, const int max, const int min=0)
 
SpinControlTieSpinControl (const wxSize &size, const TranslatableString &Prompt, double &Value, const double max, const double min=0)
 
virtual wxCheckBox * TieCheckBox (const TranslatableString &Prompt, const BoolSetting &Setting)
 
virtual wxCheckBox * TieCheckBoxOnRight (const TranslatableString &Prompt, const BoolSetting &Setting)
 
virtual wxChoice * TieChoice (const TranslatableString &Prompt, ChoiceSetting &choiceSetting)
 
virtual wxChoice * TieNumberAsChoice (const TranslatableString &Prompt, IntSetting &Setting, const TranslatableStrings &Choices, const std::vector< int > *pInternalChoices=nullptr, int iNoMatchSelector=0)
 
virtual wxTextCtrl * TieTextBox (const TranslatableString &Prompt, const StringSetting &Setting, const int nChars)
 
virtual wxTextCtrl * TieIntegerTextBox (const TranslatableString &Prompt, const IntSetting &Setting, const int nChars)
 
virtual wxTextCtrl * TieNumericTextBox (const TranslatableString &Prompt, const DoubleSetting &Setting, const int nChars, bool acceptEnter=false)
 
virtual wxSlider * TieSlider (const TranslatableString &Prompt, const IntSetting &Setting, const int max, const int min=0)
 
virtual wxSpinCtrl * TieSpinCtrl (const TranslatableString &Prompt, const IntSetting &Setting, const int max, const int min)
 
void SetBorder (int Border)
 
int GetBorder () const noexcept
 
void SetSizerProportion (int iProp)
 
void SetStretchyCol (int i)
 Used to modify an already placed FlexGridSizer to make a column stretchy. More...
 
void SetStretchyRow (int i)
 Used to modify an already placed FlexGridSizer to make a row stretchy. More...
 
wxWindow * GetParent ()
 
ShuttleGuiBaseProp (int iProp)
 
void UseUpId ()
 
wxSizer * GetSizer ()
 

Static Public Member Functions

static void ApplyItem (int step, const DialogDefinition::Item &item, wxWindow *pWind, wxWindow *pDlg)
 

Protected Member Functions

void SetProportions (int Default)
 
void PushSizer ()
 
void PopSizer ()
 
void UpdateSizersCore (bool bPrepend, int Flags, bool prompt=false)
 
void UpdateSizers ()
 
void UpdateSizersC ()
 
void UpdateSizersAtStart ()
 
long GetStyle (long Style)
 

Protected Attributes

wxWindow *const mpDlg
 
wxSizer * pSizerStack [nMaxNestedSizers]
 
std::unique_ptr< ShuttlePrefsmpShuttle
 
int miNoMatchSelector
 
teShuttleMode mShuttleMode
 Used in choices to determine which item to use on no match. More...
 
int miSizerProp
 
int mSizerDepth
 
int miBorder
 
int miProp
 
int miId
 
int miIdNext
 
int miIdSetByUser
 
int miPropSetByUser
 
bool * mpbOptionalFlag
 
std::unique_ptr< wxSizer > mpSubSizer
 
wxSizer * mpSizer
 
wxWindow * mpParent
 
wxWindow * mpWind
 
DialogDefinition::Item mItem
 

Private Member Functions

void DoInsertListColumns (wxListCtrl *pListCtrl, long listControlStyles, std::initializer_list< const ListControlColumn > columns)
 
void DoDataShuttle (const wxString &Name, WrappedType &WrappedRef)
 
wxCheckBox * DoTieCheckBoxOnRight (const TranslatableString &Prompt, WrappedType &WrappedRef)
 
wxTextCtrl * DoTieTextBox (const TranslatableString &Prompt, WrappedType &WrappedRef, const int nChars)
 
wxTextCtrl * DoTieNumericTextBox (const TranslatableString &Prompt, WrappedType &WrappedRef, const int nChars, bool acceptEnter=false)
 
wxCheckBox * DoTieCheckBox (const TranslatableString &Prompt, WrappedType &WrappedRef)
 
wxSlider * DoTieSlider (const TranslatableString &Prompt, WrappedType &WrappedRef, const int max, const int min=0)
 
wxSpinCtrl * DoTieSpinCtrl (const TranslatableString &Prompt, WrappedType &WrappedRef, const int max, const int min=0)
 
SpinControlDoTieSpinControl (const wxSize &size, const TranslatableString &Prompt, WrappedType &WrappedRef, const double max, const double min=0)
 
wxRadioButton * DoAddRadioButton (const TranslatableString &Prompt, int style, int selector, int initValue)
 Unwrapped string value. More...
 

Private Attributes

std::vector< EnumValueSymbolmRadioSymbols
 
wxString mRadioSettingName
 
std::optional< WrappedTypemRadioValue
 The setting controlled by a group. More...
 
int mRadioCount
 The wrapped value associated with the active radio button. More...
 
wxString mRadioValueString
 The index of this radio item. -1 for none. More...
 

Detailed Description

Base class for shuttling data to and from a GUI.

see also ShuttleGui

Use the:

The code in this file is fairly repetitive. We are dealing with

A technique used to reduce the size of the Tie functions is to have one generic Tie function that uses WrappedType for its data type. Type specific Tie functions themselves call the generic variant.

A second technique used to reduce the size of Tie functions only comes into play for two-step Tie functions. (A two step Tie function is one that transfers data between the registry and the GUI via an intermediate temporary variable). In the two step style, a function ShuttleGuiBase::DoStep() determines which transfers in the function are to be done, reducing repetitive if-then-else's.

Although unusual, these two techniques make the code easier to add to and much easier to check for correctness. The alternative 'more obvious' code that just repeats code as needed is considerably longer.

You would rarely use ShuttleGuiBase directly, instead you'd use ShuttleGui.

There is DOxygen documentation on how to use the ShuttleGui class in The Shuttle System .

Definition at line 240 of file ShuttleGui.h.

Constructor & Destructor Documentation

◆ ShuttleGuiBase()

ShuttleGuiBase::ShuttleGuiBase ( wxWindow *  pParent,
teShuttleMode  ShuttleMode,
bool  vertical,
wxSize  minSize 
)

Definition at line 128 of file ShuttleGui.cpp.

130 : mpDlg{ pParent }
131{
132 wxASSERT( (pParent != NULL ) || ( ShuttleMode != eIsCreating));
133 mpbOptionalFlag = nullptr;
134 mpParent = pParent;
135 mShuttleMode = ShuttleMode;
136 Init( vertical, minSize );
137}
@ eIsCreating
Definition: ShuttleGui.h:37
wxWindow *const mpDlg
Definition: ShuttleGui.h:536
void Init(bool vertical, wxSize minSize)
Definition: ShuttleGui.cpp:143
bool * mpbOptionalFlag
Definition: ShuttleGui.h:557
wxWindow * mpParent
Definition: ShuttleGui.h:561
teShuttleMode mShuttleMode
Used in choices to determine which item to use on no match.
Definition: ShuttleGui.h:543

References eIsCreating, Init(), mpbOptionalFlag, mpParent, and mShuttleMode.

Here is the call graph for this function:

◆ ~ShuttleGuiBase()

ShuttleGuiBase::~ShuttleGuiBase ( )
virtual

Definition at line 139 of file ShuttleGui.cpp.

140{
141}

Member Function Documentation

◆ AddBitmapButton()

wxBitmapButton * ShuttleGuiBase::AddBitmapButton ( const wxBitmap &  Bitmap,
int  PositionFlags = wxALIGN_CENTRE,
bool  setDefault = false 
)

Definition at line 381 of file ShuttleGui.cpp.

383{
384 UseUpId();
386 return wxDynamicCast(wxWindow::FindWindowById( miId, mpDlg), wxBitmapButton);
387 wxBitmapButton * pBtn;
388 mpWind = pBtn = safenew wxBitmapButton(GetParent(), miId, Bitmap,
389 wxDefaultPosition, wxDefaultSize, GetStyle( wxBU_AUTODRAW ) );
390 pBtn->SetBackgroundColour(
391 wxColour( 246,246,243));
392// wxSystemSettings::GetColour(wxSYS_COLOUR_BTNFACE));
393 miProp=0;
394 UpdateSizersCore(false, PositionFlags | wxALL);
395 if (setDefault)
396 pBtn->SetDefault();
397 return pBtn;
398}
#define safenew
Definition: MemoryX.h:10
long GetStyle(long Style)
wxWindow * GetParent()
Definition: ShuttleGui.h:502
void UpdateSizersCore(bool bPrepend, int Flags, bool prompt=false)
wxWindow * mpWind
Definition: ShuttleGui.h:562

References eIsCreating, GetParent(), GetStyle(), miId, miProp, mpDlg, mpWind, mShuttleMode, safenew, UpdateSizersCore(), and UseUpId().

Here is the call graph for this function:

◆ AddButton()

wxButton * ShuttleGuiBase::AddButton ( const TranslatableString Text,
int  PositionFlags = wxALIGN_CENTRE,
bool  setDefault = false 
)

Definition at line 362 of file ShuttleGui.cpp.

364{
365 UseUpId();
367 return wxDynamicCast(wxWindow::FindWindowById( miId, mpDlg), wxButton);
368 wxButton * pBtn;
369 const auto translated = Text.Translation();
370 mpWind = pBtn = safenew wxButton(GetParent(), miId,
371 translated, wxDefaultPosition, wxDefaultSize,
372 GetStyle( 0 ) );
373 mpWind->SetName(wxStripMenuCodes(translated));
374 miProp=0;
375 UpdateSizersCore(false, PositionFlags | wxALL);
376 if (setDefault)
377 pBtn->SetDefault();
378 return pBtn;
379}
wxString Translation() const

References eIsCreating, GetParent(), GetStyle(), miId, miProp, mpDlg, mpWind, mShuttleMode, safenew, TranslatableString::Translation(), UpdateSizersCore(), and UseUpId().

Referenced by audacity::cloud::audiocom::ShareAudioDialog::Populate().

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

◆ AddCheckBox() [1/3]

wxCheckBox * ShuttleGuiBase::AddCheckBox ( const TranslatableString Prompt,
bool  Selected 
)

Definition at line 311 of file ShuttleGui.cpp.

312{
313 HandleOptionality( Prompt );
314 auto realPrompt = Prompt.Translation();
315 if( mpbOptionalFlag )
316 {
317 AddPrompt( {} );
318 //realPrompt = wxT("");
319 }
320
321 UseUpId();
323 return wxDynamicCast(wxWindow::FindWindowById( miId, mpDlg), wxCheckBox);
324 wxCheckBox * pCheckBox;
325 miProp=0;
326 mpWind = pCheckBox = safenew wxCheckBox(GetParent(), miId, realPrompt, wxDefaultPosition, wxDefaultSize,
327 GetStyle( 0 ));
328 pCheckBox->SetValue(Selected);
329 if (realPrompt.empty()) {
330 // NVDA 2018.3 does not read controls which are buttons, check boxes or radio buttons which have
331 // an accessibility name which is empty. Bug 1980.
332#if wxUSE_ACCESSIBILITY
333 // so that name can be set on a standard control
334 pCheckBox->SetAccessible(safenew WindowAccessible(pCheckBox));
335#endif
336 pCheckBox->SetName(wxT("\a")); // non-empty string which screen readers do not read
337 }
338 UpdateSizers();
339 return pCheckBox;
340}
wxT("CloseDown"))
wxStaticText * AddPrompt(const TranslatableString &Prompt, int wrapWidth=0)
Right aligned text string.
Definition: ShuttleGui.cpp:238
void HandleOptionality(const TranslatableString &Prompt)
Definition: ShuttleGui.cpp:224
An alternative to using wxWindowAccessible, which in wxWidgets 3.1.1 contained GetParent() which was ...

References AddPrompt(), eIsCreating, GetParent(), GetStyle(), HandleOptionality(), miId, miProp, mpbOptionalFlag, mpDlg, mpWind, mShuttleMode, safenew, TranslatableString::Translation(), UpdateSizers(), UseUpId(), and wxT().

Referenced by DoTieCheckBox().

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

◆ AddCheckBox() [2/3]

wxCheckBox * ShuttleGuiBase::AddCheckBox ( const TranslatableString Prompt,
const char *   
)
delete

◆ AddCheckBox() [3/3]

wxCheckBox * ShuttleGuiBase::AddCheckBox ( const TranslatableString Prompt,
const wxChar *   
)
delete

◆ AddCheckBoxOnRight() [1/3]

wxCheckBox * ShuttleGuiBase::AddCheckBoxOnRight ( const TranslatableString Prompt,
bool  Selected 
)

For a consistent two-column layout we want labels on the left and controls on the right. CheckBoxes break that rule, so we fake it by placing a static text label and then a tick box with an empty label.

Definition at line 345 of file ShuttleGui.cpp.

346{
347 HandleOptionality( Prompt );
348 AddPrompt( Prompt );
349 UseUpId();
351 return wxDynamicCast(wxWindow::FindWindowById( miId, mpDlg), wxCheckBox);
352 wxCheckBox * pCheckBox;
353 miProp=0;
354 mpWind = pCheckBox = safenew wxCheckBox(GetParent(), miId, wxT(""), wxDefaultPosition, wxDefaultSize,
355 GetStyle( 0 ));
356 pCheckBox->SetValue(Selected);
357 pCheckBox->SetName(Prompt.Stripped().Translation());
358 UpdateSizers();
359 return pCheckBox;
360}
TranslatableString Stripped(unsigned options=MenuCodes) const
non-mutating, constructs another TranslatableString object

References AddPrompt(), eIsCreating, GetParent(), GetStyle(), HandleOptionality(), miId, miProp, mpDlg, mpWind, mShuttleMode, safenew, TranslatableString::Stripped(), TranslatableString::Translation(), UpdateSizers(), UseUpId(), and wxT().

Referenced by DoTieCheckBoxOnRight(), and TieCheckBoxOnRight().

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

◆ AddCheckBoxOnRight() [2/3]

wxCheckBox * ShuttleGuiBase::AddCheckBoxOnRight ( const TranslatableString Prompt,
const char *   
)
delete

◆ AddCheckBoxOnRight() [3/3]

wxCheckBox * ShuttleGuiBase::AddCheckBoxOnRight ( const TranslatableString Prompt,
const wxChar *   
)
delete

◆ AddChoice() [1/2]

wxChoice * ShuttleGuiBase::AddChoice ( const TranslatableString Prompt,
const TranslatableStrings choices,
const TranslatableString selected 
)

Definition at line 435 of file ShuttleGui.cpp.

437{
438 return AddChoice(
439 Prompt, choices, make_iterator_range( choices ).index( Selected ) );
440}
IteratorRange< Iterator > make_iterator_range(const Iterator &i1, const Iterator &i2)
Definition: IteratorX.h:210
wxChoice * AddChoice(const TranslatableString &Prompt, const TranslatableStrings &choices, int Selected=-1)
Definition: ShuttleGui.cpp:400

References AddChoice(), and make_iterator_range().

Here is the call graph for this function:

◆ AddChoice() [2/2]

wxChoice * ShuttleGuiBase::AddChoice ( const TranslatableString Prompt,
const TranslatableStrings choices,
int  Selected = -1 
)

Definition at line 400 of file ShuttleGui.cpp.

402{
403 HandleOptionality( Prompt );
404 AddPrompt( Prompt );
405 UseUpId();
407 return wxDynamicCast(wxWindow::FindWindowById( miId, mpDlg), wxChoice);
408 wxChoice * pChoice;
409 miProp=0;
410
411 mpWind = pChoice = safenew wxChoice(
412 GetParent(),
413 miId,
414 wxDefaultPosition,
415 wxDefaultSize,
416 transform_container<wxArrayString>(
417 choices, std::mem_fn( &TranslatableString::StrippedTranslation ) ),
418 GetStyle( 0 ) );
419
420 pChoice->SetMinSize( { 180, -1 } );// Use -1 for 'default size' - Platform specific.
421#ifdef __WXMAC__
422#if wxUSE_ACCESSIBILITY
423 // so that name can be set on a standard control
424 mpWind->SetAccessible(safenew WindowAccessible(mpWind));
425#endif
426#endif
427 pChoice->SetName(Prompt.Stripped().Translation());
428 if ( Selected >= 0 && Selected < (int)choices.size() )
429 pChoice->SetSelection( Selected );
430
431 UpdateSizers();
432 return pChoice;
433}
wxString StrippedTranslation() const

References AddPrompt(), eIsCreating, GetParent(), GetStyle(), HandleOptionality(), miId, miProp, mpDlg, mpWind, mShuttleMode, safenew, TranslatableString::Stripped(), TranslatableString::StrippedTranslation(), TranslatableString::Translation(), UpdateSizers(), and UseUpId().

Referenced by AddChoice(), and TieChoice().

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

◆ AddCombo()

wxComboBox * ShuttleGuiBase::AddCombo ( const TranslatableString Prompt,
const wxString &  Selected,
const wxArrayStringEx choices 
)

Definition at line 519 of file ShuttleGui.cpp.

522{
523 const auto translated = Prompt.Translation();
524 HandleOptionality( Prompt );
525 AddPrompt( Prompt );
526 UseUpId();
528 return wxDynamicCast(wxWindow::FindWindowById( miId, mpDlg), wxComboBox);
529 wxComboBox * pCombo;
530 miProp=0;
531
532 int n = choices.size();
533 if( n>50 ) n=50;
534 int i;
535 wxString Choices[50];
536 for(i=0;i<n;i++)
537 {
538 Choices[i] = choices[i];
539 }
540
541 mpWind = pCombo = safenew wxComboBox(GetParent(), miId, Selected, wxDefaultPosition, wxDefaultSize,
542 n, Choices, GetStyle( 0 ));
543 mpWind->SetName(wxStripMenuCodes(translated));
544
545 UpdateSizers();
546 return pCombo;
547}

References AddPrompt(), eIsCreating, GetParent(), GetStyle(), HandleOptionality(), miId, miProp, mpDlg, mpWind, mShuttleMode, safenew, TranslatableString::Translation(), UpdateSizers(), and UseUpId().

Here is the call graph for this function:

◆ AddConstTextBox()

void ShuttleGuiBase::AddConstTextBox ( const TranslatableString Caption,
const TranslatableString Value 
)

Single line text box of fixed size.

Definition at line 758 of file ShuttleGui.cpp.

760{
761 HandleOptionality( Prompt );
762 AddPrompt( Prompt );
763 UseUpId();
765 return;
766// return wxDynamicCast(wxWindow::FindWindowById( miId, mpDlg), wx);
767 miProp=0;
768 UpdateSizers();
769 miProp=0;
770 const auto translatedValue = Value.Translation();
771 mpWind = safenew wxStaticText(GetParent(), miId,
772 translatedValue, wxDefaultPosition, wxDefaultSize,
773 GetStyle( 0 ));
774 mpWind->SetName(translatedValue); // fix for bug 577 (NVDA/Narrator screen readers do not read static text in dialogs)
775 UpdateSizers();
776}

References AddPrompt(), eIsCreating, GetParent(), GetStyle(), HandleOptionality(), miId, miProp, mpWind, mShuttleMode, safenew, TranslatableString::Translation(), UpdateSizers(), and UseUpId().

Here is the call graph for this function:

◆ AddFixedText()

void ShuttleGuiBase::AddFixedText ( const TranslatableString Str,
bool  bCenter = false,
int  wrapWidth = 0 
)

Definition at line 442 of file ShuttleGui.cpp.

444{
445 const auto translated = Str.Translation();
446 UseUpId();
448 return;
449 auto text = safenew wxStaticText(GetParent(),
450 miId, translated, wxDefaultPosition, wxDefaultSize,
451 GetStyle( wxALIGN_LEFT ));
452 mpWind = text;
453 if ( wrapWidth > 0 )
454 text->Wrap( wrapWidth );
455 mpWind->SetName(wxStripMenuCodes(translated)); // fix for bug 577 (NVDA/Narrator screen readers do not read static text in dialogs)
456 if( bCenter )
457 {
458 miProp=1;
460 }
461 else
462 UpdateSizers();
463}
void UpdateSizersC()

References eIsCreating, GetParent(), GetStyle(), miId, miProp, mpWind, mShuttleMode, safenew, TranslatableString::Translation(), UpdateSizers(), UpdateSizersC(), and UseUpId().

Referenced by audacity::cloud::audiocom::ShareAudioDialog::InitialStatePanel::PopulateInitialStatePanel(), and audacity::cloud::audiocom::ShareAudioDialog::ProgressPanel::PopulateProgressPanel().

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

◆ AddGrid()

wxGrid * ShuttleGuiBase::AddGrid ( )

Definition at line 793 of file ShuttleGui.cpp.

794{
795 UseUpId();
797 return wxDynamicCast(wxWindow::FindWindowById( miId, mpDlg), wxGrid);
798 wxGrid * pGrid;
799 SetProportions( 1 );
800 mpWind = pGrid = safenew wxGrid(GetParent(), miId, wxDefaultPosition,
801 wxDefaultSize, GetStyle( wxWANTS_CHARS ));
802 pGrid->SetMinSize( wxSize( 120, 150 ));
803 UpdateSizers();
804 return pGrid;
805}
void SetProportions(int Default)

References eIsCreating, GetParent(), GetStyle(), miId, mpDlg, mpWind, mShuttleMode, safenew, SetProportions(), UpdateSizers(), and UseUpId().

Here is the call graph for this function:

◆ AddIcon()

void ShuttleGuiBase::AddIcon ( wxBitmap *  pBmp)

Definition at line 893 of file ShuttleGui.cpp.

894{
895 UseUpId();
897// return wxDynamicCast(wxWindow::FindWindowById( miId, mpDlg), wx);
898 return;
899 wxBitmapButton * pBtn;
900 mpWind = pBtn = safenew wxBitmapButton(GetParent(), miId, *pBmp,
901 wxDefaultPosition, wxDefaultSize, GetStyle( wxBU_AUTODRAW ) );
902 pBtn->SetWindowStyle( wxBORDER_NONE );
903 pBtn->SetCanFocus(false);
905}

References eIsCreating, GetParent(), GetStyle(), miId, mpWind, mShuttleMode, safenew, UpdateSizersC(), and UseUpId().

Here is the call graph for this function:

◆ AddListBox()

wxListBox * ShuttleGuiBase::AddListBox ( const wxArrayStringEx choices)

Definition at line 778 of file ShuttleGui.cpp.

779{
780 UseUpId();
782 return wxDynamicCast(wxWindow::FindWindowById( miId, mpDlg), wxListBox);
783 wxListBox * pListBox;
784 SetProportions( 1 );
785 mpWind = pListBox = safenew wxListBox(GetParent(), miId,
786 wxDefaultPosition, wxDefaultSize, choices, GetStyle(0));
787 pListBox->SetMinSize( wxSize( 120,150 ));
788 UpdateSizers();
789 return pListBox;
790}

References eIsCreating, GetParent(), GetStyle(), miId, mpDlg, mpWind, mShuttleMode, safenew, SetProportions(), UpdateSizers(), and UseUpId().

Here is the call graph for this function:

◆ AddListControl()

wxListCtrl * ShuttleGuiBase::AddListControl ( std::initializer_list< const ListControlColumn columns = {},
long  listControlStyles = 0 
)

Definition at line 807 of file ShuttleGui.cpp.

811{
812 UseUpId();
814 return wxDynamicCast(wxWindow::FindWindowById( miId, mpDlg), wxListCtrl);
815 wxListCtrl * pListCtrl;
816 SetProportions( 1 );
817 mpWind = pListCtrl = safenew wxListCtrl(GetParent(), miId,
818 wxDefaultPosition, wxDefaultSize, GetStyle( wxLC_ICON ));
819 pListCtrl->SetMinSize( wxSize( 120,150 ));
820 UpdateSizers();
821
822 DoInsertListColumns( pListCtrl, listControlStyles, columns );
823
824 return pListCtrl;
825}
void DoInsertListColumns(wxListCtrl *pListCtrl, long listControlStyles, std::initializer_list< const ListControlColumn > columns)
Definition: ShuttleGui.cpp:848

References DoInsertListColumns(), eIsCreating, GetParent(), GetStyle(), miId, mpDlg, mpWind, mShuttleMode, safenew, SetProportions(), UpdateSizers(), and UseUpId().

Here is the call graph for this function:

◆ AddListControlReportMode()

wxListCtrl * ShuttleGuiBase::AddListControlReportMode ( std::initializer_list< const ListControlColumn columns = {},
long  listControlStyles = 0 
)

Definition at line 827 of file ShuttleGui.cpp.

831{
832 UseUpId();
834 return wxDynamicCast(wxWindow::FindWindowById( miId, mpDlg), wxListCtrl);
835 wxListCtrl * pListCtrl;
836 SetProportions( 1 );
837 mpWind = pListCtrl = safenew wxListCtrl(GetParent(), miId,
838 wxDefaultPosition, wxSize(230,120),//wxDefaultSize,
839 GetStyle( wxLC_REPORT | wxLC_HRULES | wxLC_VRULES ));
840// pListCtrl->SetMinSize( wxSize( 120,150 ));
841 UpdateSizers();
842
843 DoInsertListColumns( pListCtrl, listControlStyles, columns );
844
845 return pListCtrl;
846}

References DoInsertListColumns(), eIsCreating, GetParent(), GetStyle(), miId, mpDlg, mpWind, mShuttleMode, safenew, SetProportions(), UpdateSizers(), and UseUpId().

Here is the call graph for this function:

◆ AddNumericTextBox()

wxTextCtrl * ShuttleGuiBase::AddNumericTextBox ( const TranslatableString Caption,
const wxString &  Value,
const int  nChars,
bool  acceptEnter = false 
)

Definition at line 695 of file ShuttleGui.cpp.

698{
699 const auto translated = Caption.Translation();
700 HandleOptionality( Caption );
701 AddPrompt( Caption );
702 UseUpId();
704 return wxDynamicCast(wxWindow::FindWindowById( miId, mpDlg), wxTextCtrl);
705 wxTextCtrl * pTextCtrl;
706 wxSize Size(wxDefaultSize);
707 if( nChars > 0 )
708 {
709 Size.SetWidth( nChars *5 );
710 }
711 miProp=0;
712
713#ifdef EXPERIMENTAL_RIGHT_ALIGNED_TEXTBOXES
714 long flags = wxTE_RIGHT;
715#else
716 long flags = wxTE_LEFT;
717#endif
718
719 if (acceptEnter)
720 flags = wxTE_PROCESS_ENTER;
721
722 wxTextValidator Validator(wxFILTER_NUMERIC);
723 mpWind = pTextCtrl = safenew wxTextCtrl(GetParent(), miId, Value,
724 wxDefaultPosition, Size, GetStyle( flags ),
725 Validator // It's OK to pass this. It will be cloned.
726 );
727#if wxUSE_ACCESSIBILITY
728 // so that name can be set on a standard control
729 mpWind->SetAccessible(safenew WindowAccessible(mpWind));
730#endif
731 mpWind->SetName(wxStripMenuCodes(translated));
732 UpdateSizers();
733 return pTextCtrl;
734}
A Validator is an object which checks whether a wxVariant satisfies a certain criterion....
Definition: Validators.h:54
SizeType< float > Size
Alias for SizeType<float>
Definition: Size.h:174

References AddPrompt(), eIsCreating, GetParent(), GetStyle(), HandleOptionality(), miId, miProp, mpDlg, mpWind, mShuttleMode, safenew, TranslatableString::Translation(), UpdateSizers(), and UseUpId().

Referenced by DoTieNumericTextBox().

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

◆ AddPrompt()

wxStaticText * ShuttleGuiBase::AddPrompt ( const TranslatableString Prompt,
int  wrapWidth = 0 
)

Right aligned text string.

Definition at line 238 of file ShuttleGui.cpp.

239{
241 return wxDynamicCast(wxWindow::FindWindowById( miId, mpDlg), wxStaticText);
242 //wxLogDebug( "Prompt: [%s] Id:%i (%i)", Prompt.c_str(), miId, miIdSetByUser ) ;
243 if( mpbOptionalFlag ){
244 bool * pVar = mpbOptionalFlag;
245 mpbOptionalFlag = nullptr;
246 TieCheckBox( {}, *pVar);
247 //return;
248 }
249 if( Prompt.empty() )
250 return nullptr;
251 miProp=1;
252 const auto translated = Prompt.Translation();
253 auto text = safenew wxStaticText(GetParent(), -1, translated, wxDefaultPosition, wxDefaultSize,
254 GetStyle( wxALIGN_RIGHT ));
255 mpWind = text;
256 if (wrapWidth > 0)
257 text->Wrap(wrapWidth);
258 mpWind->SetName(wxStripMenuCodes(translated)); // fix for bug 577 (NVDA/Narrator screen readers do not read static text in dialogs)
259 UpdateSizersCore( false, wxALL | wxALIGN_CENTRE_VERTICAL, true );
260
261 return text;
262}
wxCheckBox * TieCheckBox(const TranslatableString &Prompt, bool &Var)

References eIsCreating, TranslatableString::empty(), GetParent(), GetStyle(), miId, miProp, mpbOptionalFlag, mpDlg, mpWind, mShuttleMode, safenew, TieCheckBox(), TranslatableString::Translation(), and UpdateSizersCore().

Referenced by AddCheckBox(), AddCheckBoxOnRight(), AddChoice(), AddCombo(), AddConstTextBox(), AddNumericTextBox(), AddReadOnlyText(), AddSlider(), AddSpinControl(), AddSpinCtrl(), and AddTextBox().

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

◆ AddRadioButton()

wxRadioButton * ShuttleGuiBase::AddRadioButton ( const TranslatableString Prompt,
int  selector = 0,
int  initValue = 0 
)

Definition at line 570 of file ShuttleGui.cpp.

572{
573 return DoAddRadioButton( Prompt, wxRB_GROUP, selector, initValue );
574}
wxRadioButton * DoAddRadioButton(const TranslatableString &Prompt, int style, int selector, int initValue)
Unwrapped string value.
Definition: ShuttleGui.cpp:550

References DoAddRadioButton().

Here is the call graph for this function:

◆ AddRadioButtonToGroup()

wxRadioButton * ShuttleGuiBase::AddRadioButtonToGroup ( const TranslatableString Prompt,
int  selector = 1,
int  initValue = 0 
)

Definition at line 576 of file ShuttleGui.cpp.

578{
579 return DoAddRadioButton( Prompt, 0, selector, initValue );
580}

References DoAddRadioButton().

Here is the call graph for this function:

◆ AddReadOnlyText()

ReadOnlyText * ShuttleGuiBase::AddReadOnlyText ( const TranslatableString Caption,
const wxString &  Value 
)

Definition at line 498 of file ShuttleGui.cpp.

500{
501 const auto translated = Caption.Translation();
502 auto style = GetStyle( wxBORDER_NONE );
503 HandleOptionality( Caption );
504 mItem.miStyle = wxALIGN_CENTER_VERTICAL;
505 AddPrompt( Caption );
506 UseUpId();
508 return wxDynamicCast(wxWindow::FindWindowById( miId, mpDlg), ReadOnlyText);
509 ReadOnlyText * pReadOnlyText;
510 miProp=0;
511
512 mpWind = pReadOnlyText = safenew ReadOnlyText(GetParent(), miId, Value,
513 wxDefaultPosition, wxDefaultSize, GetStyle( style ));
514 mpWind->SetName(wxStripMenuCodes(translated));
515 UpdateSizers();
516 return pReadOnlyText;
517}
DialogDefinition::Item mItem
Definition: ShuttleGui.h:592

References AddPrompt(), eIsCreating, GetParent(), GetStyle(), HandleOptionality(), miId, miProp, DialogDefinition::Item::miStyle, mItem, mpDlg, mpWind, mShuttleMode, safenew, anonymous_namespace{AudacityDontAskAgainMessageDialog.cpp}::style, TranslatableString::Translation(), UpdateSizers(), and UseUpId().

Here is the call graph for this function:

◆ AddSlider()

wxSlider * ShuttleGuiBase::AddSlider ( const TranslatableString Prompt,
int  pos,
int  Max,
int  Min = 0 
)

Definition at line 591 of file ShuttleGui.cpp.

593{
594 HandleOptionality( Prompt );
595 AddPrompt( Prompt );
596 UseUpId();
598 return wxDynamicCast(wxWindow::FindWindowById( miId, mpDlg), wxSlider);
599 wxSlider * pSlider;
601 pos, Min, Max,
602 wxDefaultPosition,
603 // Bug2289: On Linux at least, sliders like to be constructed with the
604 // proper size, not reassigned size later
605 ( ( mItem.mWindowSize == wxSize{} ) ? wxDefaultSize : mItem.mWindowSize ),
606 GetStyle( wxSL_HORIZONTAL | wxSL_LABELS | wxSL_AUTOTICKS )
607 );
608#if wxUSE_ACCESSIBILITY
609 // so that name can be set on a standard control
610 mpWind->SetAccessible(safenew WindowAccessible(mpWind));
611#endif
612 mpWind->SetName(wxStripMenuCodes(Prompt.Translation()));
613 miProp=1;
614 UpdateSizers();
615 return pSlider;
616}

References AddPrompt(), eIsCreating, GetParent(), GetStyle(), HandleOptionality(), miId, miProp, mItem, mpDlg, mpWind, mShuttleMode, DialogDefinition::Item::mWindowSize, safenew, TranslatableString::Translation(), UpdateSizers(), and UseUpId().

Referenced by DoTieSlider().

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

◆ AddSpinControl()

SpinControl * ShuttleGuiBase::AddSpinControl ( const wxSize &  size,
const TranslatableString Prompt,
double  Value,
double  Max,
double  Min 
)

Definition at line 640 of file ShuttleGui.cpp.

643{
644 const auto translated = Prompt.Translation();
645 HandleOptionality( Prompt );
646 AddPrompt( Prompt );
647 UseUpId();
649 return dynamic_cast<SpinControl*>(wxWindow::FindWindowById(miId, mpDlg));
650 SpinControl * pSpinCtrl;
651 mpWind = pSpinCtrl = safenew SpinControl(
652 GetParent(), miId, Value, Min, Max, 1.0, true, wxDefaultPosition, size,
653 Prompt);
654 miProp=1;
655 UpdateSizers();
656 return pSpinCtrl;
657}

References AddPrompt(), eIsCreating, GetParent(), HandleOptionality(), miId, miProp, mpDlg, mpWind, mShuttleMode, safenew, size, TranslatableString::Translation(), UpdateSizers(), and UseUpId().

Referenced by DoTieSpinControl().

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

◆ AddSpinCtrl()

wxSpinCtrl * ShuttleGuiBase::AddSpinCtrl ( const TranslatableString Prompt,
int  Value,
int  Max,
int  Min 
)

Definition at line 618 of file ShuttleGui.cpp.

620{
621 const auto translated = Prompt.Translation();
622 HandleOptionality( Prompt );
623 AddPrompt( Prompt );
624 UseUpId();
626 return wxDynamicCast(wxWindow::FindWindowById( miId, mpDlg), wxSpinCtrl);
627 wxSpinCtrl * pSpinCtrl;
628 mpWind = pSpinCtrl = safenew wxSpinCtrl(GetParent(), miId,
629 wxEmptyString,
630 wxDefaultPosition, wxDefaultSize,
631 GetStyle( wxSP_VERTICAL | wxSP_ARROW_KEYS ),
632 Min, Max, Value
633 );
634 mpWind->SetName(wxStripMenuCodes(translated));
635 miProp=1;
636 UpdateSizers();
637 return pSpinCtrl;
638}

References AddPrompt(), eIsCreating, GetParent(), GetStyle(), HandleOptionality(), miId, miProp, mpDlg, mpWind, mShuttleMode, safenew, TranslatableString::Translation(), UpdateSizers(), and UseUpId().

Referenced by DoTieSpinCtrl().

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

◆ AddTextBox()

wxTextCtrl * ShuttleGuiBase::AddTextBox ( const TranslatableString Caption,
const wxString &  Value,
const int  nChars 
)

Definition at line 659 of file ShuttleGui.cpp.

661{
662 const auto translated = Caption.Translation();
663 HandleOptionality( Caption );
664 AddPrompt( Caption );
665 UseUpId();
667 return wxDynamicCast(wxWindow::FindWindowById( miId, mpDlg), wxTextCtrl);
668 wxTextCtrl * pTextCtrl;
669 wxSize Size(wxDefaultSize);
670 if( nChars > 0 )
671 {
672 int width;
673 mpDlg->GetTextExtent( wxT("9"), &width, nullptr );
674 Size.SetWidth( nChars * width );
675 }
676 miProp=0;
677
678#ifdef EXPERIMENTAL_RIGHT_ALIGNED_TEXTBOXES
679 long flags = wxTE_RIGHT;
680#else
681 long flags = wxTE_LEFT;
682#endif
683
684 mpWind = pTextCtrl = safenew wxTextCtrlWrapper(GetParent(), miId, Value,
685 wxDefaultPosition, Size, GetStyle( flags ));
686#if wxUSE_ACCESSIBILITY
687 // so that name can be set on a standard control
688 mpWind->SetAccessible(safenew WindowAccessible(mpWind));
689#endif
690 mpWind->SetName(wxStripMenuCodes(translated));
691 UpdateSizers();
692 return pTextCtrl;
693}

References AddPrompt(), eIsCreating, GetParent(), GetStyle(), HandleOptionality(), miId, miProp, mpDlg, mpWind, mShuttleMode, safenew, TranslatableString::Translation(), UpdateSizers(), UseUpId(), and wxT().

Referenced by DoTieTextBox(), ErrorReportDialog::ErrorReportDialog(), and audacity::cloud::audiocom::ShareAudioDialog::InitialStatePanel::PopulateInitialStatePanel().

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

◆ AddTextWindow()

wxTextCtrl * ShuttleGuiBase::AddTextWindow ( const wxString &  Value)

Multiline text box that grows.

Definition at line 737 of file ShuttleGui.cpp.

738{
739 UseUpId();
741 return wxDynamicCast(wxWindow::FindWindowById( miId, mpDlg), wxTextCtrl);
742 wxTextCtrl * pTextCtrl;
743 SetProportions( 1 );
744 mpWind = pTextCtrl = safenew wxTextCtrl(GetParent(), miId, Value,
745 wxDefaultPosition, wxDefaultSize, GetStyle( wxTE_MULTILINE ));
746#if wxUSE_ACCESSIBILITY
747 // so that name can be set on a standard control
748 mpWind->SetAccessible(safenew WindowAccessible(mpWind));
749#endif
750 UpdateSizers();
751 // Start off at start of window...
752 pTextCtrl->SetInsertionPoint( 0 );
753 pTextCtrl->ShowPosition( 0 );
754 return pTextCtrl;
755}

References eIsCreating, GetParent(), GetStyle(), miId, mpDlg, mpWind, mShuttleMode, safenew, SetProportions(), UpdateSizers(), and UseUpId().

Referenced by ErrorDialog::ErrorDialog().

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

◆ AddTitle()

void ShuttleGuiBase::AddTitle ( const TranslatableString Prompt,
int  wrapWidth = 0 
)

Centred text string.

Definition at line 283 of file ShuttleGui.cpp.

284{
285 if( Prompt.empty() )
286 return;
288 return;
289 const auto translated = Prompt.Translation();
290 auto text = safenew wxStaticText(GetParent(), -1, translated, wxDefaultPosition, wxDefaultSize,
291 GetStyle( wxALIGN_CENTRE ));
292 mpWind = text;
293 if (wrapWidth > 0)
294 text->Wrap(wrapWidth);
295 mpWind->SetName(translated); // fix for bug 577 (NVDA/Narrator screen readers do not read static text in dialogs)
296 UpdateSizers();
297}

References eIsCreating, TranslatableString::empty(), GetParent(), GetStyle(), mpWind, mShuttleMode, safenew, TranslatableString::Translation(), and UpdateSizers().

Here is the call graph for this function:

◆ AddTree()

wxTreeCtrl * ShuttleGuiBase::AddTree ( )

Definition at line 879 of file ShuttleGui.cpp.

880{
881 UseUpId();
883 return wxDynamicCast(wxWindow::FindWindowById( miId, mpDlg), wxTreeCtrl);
884 wxTreeCtrl * pTreeCtrl;
885 SetProportions( 1 );
886 mpWind = pTreeCtrl = safenew wxTreeCtrl(GetParent(), miId, wxDefaultPosition, wxDefaultSize,
887 GetStyle( wxTR_HAS_BUTTONS ));
888 pTreeCtrl->SetMinSize( wxSize( 120,650 ));
889 UpdateSizers();
890 return pTreeCtrl;
891}

References eIsCreating, GetParent(), GetStyle(), miId, mpDlg, mpWind, mShuttleMode, safenew, SetProportions(), UpdateSizers(), and UseUpId().

Here is the call graph for this function:

◆ AddUnits()

void ShuttleGuiBase::AddUnits ( const TranslatableString Prompt,
int  wrapWidth = 0 
)

Left aligned text string.

Definition at line 265 of file ShuttleGui.cpp.

266{
267 if( Prompt.empty() )
268 return;
270 return;
271 miProp = 1;
272 const auto translated = Prompt.Translation();
273 auto text = safenew wxStaticText(GetParent(), -1, translated, wxDefaultPosition, wxDefaultSize,
274 GetStyle( wxALIGN_LEFT ));
275 mpWind = text;
276 if (wrapWidth > 0)
277 text->Wrap(wrapWidth);
278 mpWind->SetName(translated); // fix for bug 577 (NVDA/Narrator screen readers do not read static text in dialogs)
279 UpdateSizersCore( false, wxALL | wxALIGN_CENTRE_VERTICAL );
280}

References eIsCreating, TranslatableString::empty(), GetParent(), GetStyle(), miProp, mpWind, mShuttleMode, safenew, TranslatableString::Translation(), and UpdateSizersCore().

Here is the call graph for this function:

◆ AddVariableText()

wxStaticText * ShuttleGuiBase::AddVariableText ( const TranslatableString Str,
bool  bCenter = false,
int  PositionFlags = 0,
int  wrapWidth = 0 
)

Definition at line 465 of file ShuttleGui.cpp.

468{
469 const auto translated = Str.Translation();
470 UseUpId();
472 return wxDynamicCast(wxWindow::FindWindowById( miId, mpDlg), wxStaticText);
473
474 wxStaticText *pStatic;
475 auto text = pStatic = safenew wxStaticText(GetParent(), miId, translated,
476 wxDefaultPosition, wxDefaultSize,
477 GetStyle( wxALIGN_LEFT ));
478 mpWind = text;
479 if ( wrapWidth > 0 )
480 text->Wrap( wrapWidth );
481 mpWind->SetName(wxStripMenuCodes(translated)); // fix for bug 577 (NVDA/Narrator screen readers do not read static text in dialogs)
482 if( bCenter )
483 {
484 miProp=1;
485 if( PositionFlags )
486 UpdateSizersCore( false, PositionFlags );
487 else
489 }
490 else
491 if( PositionFlags )
492 UpdateSizersCore( false, PositionFlags );
493 else
494 UpdateSizers();
495 return pStatic;
496}

References eIsCreating, GetParent(), GetStyle(), miId, miProp, mpDlg, mpWind, mShuttleMode, safenew, TranslatableString::Translation(), UpdateSizers(), UpdateSizersC(), UpdateSizersCore(), and UseUpId().

Referenced by ErrorReportDialog::ErrorReportDialog(), and audacity::cloud::audiocom::ShareAudioDialog::ProgressPanel::PopulateProgressPanel().

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

◆ AddVSlider()

wxSlider * ShuttleGuiBase::AddVSlider ( const TranslatableString Prompt,
int  pos,
int  Max 
)

◆ AddWindow()

wxWindow * ShuttleGuiBase::AddWindow ( wxWindow *  pWindow,
int  PositionFlags = wxALIGN_CENTRE 
)

Very generic 'Add' function. We can add anything we like. Useful for unique controls

Definition at line 301 of file ShuttleGui.cpp.

302{
304 return pWindow;
305 mpWind = pWindow;
306 SetProportions( 0 );
307 UpdateSizersCore(false, PositionFlags | wxALL);
308 return pWindow;
309}

References eIsCreating, mpWind, mShuttleMode, SetProportions(), and UpdateSizersCore().

Referenced by audacity::cloud::audiocom::ShareAudioDialog::InitialStatePanel::PopulateInitialStatePanel(), and audacity::cloud::audiocom::ShareAudioDialog::ProgressPanel::PopulateProgressPanel().

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

◆ ApplyItem()

void ShuttleGuiBase::ApplyItem ( int  step,
const DialogDefinition::Item item,
wxWindow *  pWind,
wxWindow *  pDlg 
)
static

Definition at line 2158 of file ShuttleGui.cpp.

2160{
2161 if ( step == 0 ) {
2162 // Do these steps before adding the window to the sizer
2163 if( item.mUseBestSize )
2164 pWind->SetMinSize( pWind->GetBestSize() );
2165 else if( item.mHasMinSize )
2166 pWind->SetMinSize( item.mMinSize );
2167
2168 if ( item.mWindowSize != wxSize{} )
2169 pWind->SetSize( item.mWindowSize );
2170 }
2171 else if ( step == 1) {
2172 // Apply certain other optional window attributes here
2173
2174 if ( item.mValidatorSetter )
2175 item.mValidatorSetter( pWind );
2176
2177 if ( !item.mToolTip.empty() )
2178 pWind->SetToolTip( item.mToolTip.Translation() );
2179
2180 if ( !item.mName.empty() ) {
2181 pWind->SetName( item.mName.Stripped().Translation() );
2182#ifndef __WXMAC__
2183 if (auto pButton = dynamic_cast< wxBitmapButton* >( pWind ))
2184 pButton->SetLabel( item.mName.Translation() );
2185#endif
2186 }
2187
2188 if ( !item.mNameSuffix.empty() )
2189 pWind->SetName(
2190 pWind->GetName() + " " + item.mNameSuffix.Translation() );
2191
2192 if (item.mFocused)
2193 pWind->SetFocus();
2194
2195 if (item.mDisabled)
2196 pWind->Enable( false );
2197
2198 for (auto &pair : item.mRootConnections)
2199 pWind->Connect( pair.first, pair.second, nullptr, pDlg );
2200 }
2201}
std::function< void(wxWindow *) > mValidatorSetter
Definition: ShuttleGui.h:215
std::vector< std::pair< wxEventType, wxObjectEventFunction > > mRootConnections
Definition: ShuttleGui.h:220
TranslatableString mToolTip
Definition: ShuttleGui.h:216
TranslatableString mName
Definition: ShuttleGui.h:217
TranslatableString mNameSuffix
Definition: ShuttleGui.h:218

References TranslatableString::empty(), DialogDefinition::Item::mDisabled, DialogDefinition::Item::mFocused, DialogDefinition::Item::mHasMinSize, DialogDefinition::Item::mMinSize, DialogDefinition::Item::mName, DialogDefinition::Item::mNameSuffix, DialogDefinition::Item::mRootConnections, DialogDefinition::Item::mToolTip, DialogDefinition::Item::mUseBestSize, DialogDefinition::Item::mValidatorSetter, DialogDefinition::Item::mWindowSize, TranslatableString::Stripped(), and TranslatableString::Translation().

Referenced by UpdateSizersCore().

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

◆ DoAddRadioButton()

wxRadioButton * ShuttleGuiBase::DoAddRadioButton ( const TranslatableString Prompt,
int  style,
int  selector,
int  initValue 
)
private

Unwrapped string value.

Todo:
This function and the next two, suitably adapted, could be used by TieRadioButton.

Definition at line 550 of file ShuttleGui.cpp.

552{
553 const auto translated = Prompt.Translation();
556 UseUpId();
558 return wxDynamicCast(wxWindow::FindWindowById( miId, mpDlg), wxRadioButton);
559 wxRadioButton * pRad;
560 mpWind = pRad = safenew wxRadioButton(GetParent(), miId, translated,
561 wxDefaultPosition, wxDefaultSize, GetStyle( style ) );
562 mpWind->SetName(wxStripMenuCodes(translated));
563 if ( style )
564 pRad->SetValue( true );
565 UpdateSizers();
566 pRad->SetValue( selector == initValue );
567 return pRad;
568}

References eIsCreating, GetParent(), GetStyle(), miId, mpDlg, mpWind, mShuttleMode, safenew, anonymous_namespace{AudacityDontAskAgainMessageDialog.cpp}::style, TranslatableString::Translation(), UpdateSizers(), and UseUpId().

Referenced by AddRadioButton(), and AddRadioButtonToGroup().

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

◆ DoDataShuttle()

void ShuttleGuiBase::DoDataShuttle ( const wxString &  Name,
WrappedType WrappedRef 
)
private

When we're exchanging with the configured shuttle rather than with the GUI We use this function.

Definition at line 1271 of file ShuttleGui.cpp.

1272{
1273 wxASSERT( mpShuttle );
1274 mpShuttle->TransferWrappedType( Name, WrappedRef );
1275}
std::unique_ptr< ShuttlePrefs > mpShuttle
Definition: ShuttleGui.h:539

References mpShuttle.

Referenced by EndRadioButtonGroup(), StartRadioButtonGroup(), TieCheckBox(), TieCheckBoxOnRight(), TieChoice(), TieIntegerTextBox(), TieNumericTextBox(), TieSlider(), TieSpinCtrl(), and TieTextBox().

Here is the caller graph for this function:

◆ DoInsertListColumns()

void ShuttleGuiBase::DoInsertListColumns ( wxListCtrl *  pListCtrl,
long  listControlStyles,
std::initializer_list< const ListControlColumn columns 
)
private

Definition at line 848 of file ShuttleGui.cpp.

852{
853 // Old comment from HistoryWindow.cpp follows
854 // -- is it still correct for wxWidgets 3?
855
856 // Do this BEFORE inserting the columns. On the Mac at least, the
857 // columns are deleted and later InsertItem()s will cause Audacity to crash.
858 for ( auto style = 1l; style <= listControlStyles; style <<= 1 )
859 if ( (style & listControlStyles) )
860 pListCtrl->SetSingleStyle(style, true);
861
862 long iCol = 0;
863 bool dummyColumn =
864 columns.size() > 0 && begin(columns)->format == wxLIST_FORMAT_RIGHT;
865
866 //A dummy first column, which is then deleted, is a workaround -
867 // under Windows the first column can't be right aligned.
868 if (dummyColumn)
869 pListCtrl->InsertColumn( iCol++, wxString{} );
870
871 for (auto &column : columns)
872 pListCtrl->InsertColumn(
873 iCol++, column.heading.Translation(), column.format, column.width );
874
875 if (dummyColumn)
876 pListCtrl->DeleteColumn( 0 );
877}
const char * begin(const char *str) noexcept
Definition: StringUtils.h:101

References details::begin(), and anonymous_namespace{AudacityDontAskAgainMessageDialog.cpp}::style.

Referenced by AddListControl(), and AddListControlReportMode().

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

◆ DoStep()

bool ShuttleGuiBase::DoStep ( int  iStep)

Code-Condenser function.

We have functions which need to do:

// Either: Values are coming in:
DoDataShuttle( SettingName, WrappedRef );
TieMyControl( Prompt, WrappedRef );
// Or: Values are going out:
TieMyControl( Prompt, WrappedRef );
DoDataShuttle( SettingName, WrappedRef );
void DoDataShuttle(const wxString &Name, WrappedType &WrappedRef)

So we make a list of all the possible steps, and have DoStep choose which ones are actually done, like this:

if( DoStep(1) ) DoFirstThing();
if( DoStep(2) ) DoSecondThing();
if( DoStep(3) ) DoThirdThing();
bool DoStep(int iStep)

The repeated choice logic can then be taken out of those functions.

JKC: This paves the way for doing data validation too, though when we add that we will need to renumber the steps.

Definition at line 1891 of file ShuttleGui.cpp.

1892{
1893 // Get value and create
1894 if( mShuttleMode == eIsCreating )
1895 {
1896 return (iStep==1) || (iStep==2);
1897 }
1898 // Like creating, get the value and set.
1900 {
1901 return (iStep==1) || (iStep==2);
1902 }
1904 {
1905 return (iStep==2) || (iStep==3);
1906 }
1908 return iStep ==2;
1909 wxASSERT( false );
1910 return false;
1911}
@ eIsSettingToDialog
Definition: ShuttleGui.h:39
@ eIsGettingFromDialog
Definition: ShuttleGui.h:38
@ eIsGettingMetadata
Definition: ShuttleGui.h:40

References eIsCreating, eIsGettingFromDialog, eIsGettingMetadata, eIsSettingToDialog, and mShuttleMode.

Referenced by TieCheckBox(), TieCheckBoxOnRight(), TieChoice(), TieIntegerTextBox(), TieNumericTextBox(), TieSlider(), TieSpinCtrl(), and TieTextBox().

Here is the caller graph for this function:

◆ DoTieCheckBox()

wxCheckBox * ShuttleGuiBase::DoTieCheckBox ( const TranslatableString Prompt,
WrappedType WrappedRef 
)
private

Definition at line 1283 of file ShuttleGui.cpp.

1284{
1285 HandleOptionality( Prompt );
1286 // The Add function does a UseUpId(), so don't do it here in that case.
1287 if( mShuttleMode == eIsCreating )
1288 return AddCheckBox( Prompt, WrappedRef.ReadAsString() == wxT("true"));
1289
1290 UseUpId();
1291
1292 wxWindow * pWnd = wxWindow::FindWindowById( miId, mpDlg);
1293 wxCheckBox * pCheckBox = wxDynamicCast(pWnd, wxCheckBox);
1294
1295 switch( mShuttleMode )
1296 {
1297 // IF setting internal storage from the controls.
1298 case eIsGettingMetadata:
1299 break;
1301 {
1302 wxASSERT( pCheckBox );
1303 WrappedRef.WriteToAsBool( pCheckBox->GetValue() );
1304 }
1305 break;
1306 case eIsSettingToDialog:
1307 {
1308 wxASSERT( pCheckBox );
1309 pCheckBox->SetValue( WrappedRef.ReadAsBool() );
1310 }
1311 break;
1312 default:
1313 wxASSERT( false );
1314 break;
1315 }
1316 return pCheckBox;
1317}
wxCheckBox * AddCheckBox(const TranslatableString &Prompt, bool Selected)
Definition: ShuttleGui.cpp:311
bool ReadAsBool()
void WriteToAsBool(const bool InBool)
wxString ReadAsString()
Definition: WrappedType.cpp:41

References AddCheckBox(), eIsCreating, eIsGettingFromDialog, eIsGettingMetadata, eIsSettingToDialog, HandleOptionality(), miId, mpDlg, mShuttleMode, WrappedType::ReadAsBool(), WrappedType::ReadAsString(), UseUpId(), WrappedType::WriteToAsBool(), and wxT().

Referenced by TieCheckBox(), and TieCheckBoxOnRight().

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

◆ DoTieCheckBoxOnRight()

wxCheckBox * ShuttleGuiBase::DoTieCheckBoxOnRight ( const TranslatableString Prompt,
WrappedType WrappedRef 
)
private

Definition at line 1319 of file ShuttleGui.cpp.

1320{
1321 HandleOptionality( Prompt );
1322 // The Add function does a UseUpId(), so don't do it here in that case.
1323 if( mShuttleMode == eIsCreating )
1324 return AddCheckBoxOnRight( Prompt, WrappedRef.ReadAsString() == wxT("true"));
1325
1326 UseUpId();
1327
1328 wxWindow * pWnd = wxWindow::FindWindowById( miId, mpDlg);
1329 wxCheckBox * pCheckBox = wxDynamicCast(pWnd, wxCheckBox);
1330
1331 switch( mShuttleMode )
1332 {
1333 // IF setting internal storage from the controls.
1334 case eIsGettingMetadata:
1335 break;
1337 {
1338 wxASSERT( pCheckBox );
1339 WrappedRef.WriteToAsBool( pCheckBox->GetValue() );
1340 }
1341 break;
1342 case eIsSettingToDialog:
1343 {
1344 wxASSERT( pCheckBox );
1345 pCheckBox->SetValue( WrappedRef.ReadAsBool() );
1346 }
1347 break;
1348 default:
1349 wxASSERT( false );
1350 break;
1351 }
1352 return pCheckBox;
1353}
wxCheckBox * AddCheckBoxOnRight(const TranslatableString &Prompt, bool Selected)
Definition: ShuttleGui.cpp:345

References AddCheckBoxOnRight(), eIsCreating, eIsGettingFromDialog, eIsGettingMetadata, eIsSettingToDialog, HandleOptionality(), miId, mpDlg, mShuttleMode, WrappedType::ReadAsBool(), WrappedType::ReadAsString(), UseUpId(), WrappedType::WriteToAsBool(), and wxT().

Referenced by TieCheckBoxOnRight().

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

◆ DoTieNumericTextBox()

wxTextCtrl * ShuttleGuiBase::DoTieNumericTextBox ( const TranslatableString Prompt,
WrappedType WrappedRef,
const int  nChars,
bool  acceptEnter = false 
)
private

Definition at line 1471 of file ShuttleGui.cpp.

1474{
1475 HandleOptionality( Prompt );
1476 // The Add function does a UseUpId(), so don't do it here in that case.
1477 if( mShuttleMode == eIsCreating )
1478 return AddNumericTextBox( Prompt, WrappedRef.ReadAsString(), nChars, acceptEnter );
1479
1480 UseUpId();
1481 wxTextCtrl * pTextBox=NULL;
1482
1483 wxWindow * pWnd = wxWindow::FindWindowById( miId, mpDlg);
1484 pTextBox = wxDynamicCast(pWnd, wxTextCtrl);
1485
1486 switch( mShuttleMode )
1487 {
1488 // IF setting internal storage from the controls.
1489 case eIsGettingMetadata:
1490 break;
1492 {
1493 wxASSERT( pTextBox );
1494 WrappedRef.WriteToAsString( pTextBox->GetValue() );
1495 }
1496 break;
1497 case eIsSettingToDialog:
1498 {
1499 wxASSERT( pTextBox );
1500 pTextBox->SetValue( WrappedRef.ReadAsString() );
1501 }
1502 break;
1503 default:
1504 wxASSERT( false );
1505 break;
1506 }
1507 return pTextBox;
1508}
wxTextCtrl * AddNumericTextBox(const TranslatableString &Caption, const wxString &Value, const int nChars, bool acceptEnter=false)
Definition: ShuttleGui.cpp:695
void WriteToAsString(const wxString &InStr)

References AddNumericTextBox(), eIsCreating, eIsGettingFromDialog, eIsGettingMetadata, eIsSettingToDialog, HandleOptionality(), miId, mpDlg, mShuttleMode, WrappedType::ReadAsString(), UseUpId(), and WrappedType::WriteToAsString().

Referenced by TieIntegerTextBox(), and TieNumericTextBox().

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

◆ DoTieSlider()

wxSlider * ShuttleGuiBase::DoTieSlider ( const TranslatableString Prompt,
WrappedType WrappedRef,
const int  max,
const int  min = 0 
)
private

Definition at line 1510 of file ShuttleGui.cpp.

1513{
1514 HandleOptionality( Prompt );
1515 // The Add function does a UseUpId(), so don't do it here in that case.
1516 if( mShuttleMode != eIsCreating )
1517 UseUpId();
1518 wxSlider * pSlider=NULL;
1519 switch( mShuttleMode )
1520 {
1521 case eIsCreating:
1522 {
1523 pSlider = AddSlider( Prompt, WrappedRef.ReadAsInt(), max, min );
1524 }
1525 break;
1526 // IF setting internal storage from the controls.
1527 case eIsGettingMetadata:
1528 break;
1530 {
1531 wxWindow * pWnd = wxWindow::FindWindowById( miId, mpDlg);
1532 pSlider = wxDynamicCast(pWnd, wxSlider);
1533 wxASSERT( pSlider );
1534 WrappedRef.WriteToAsInt( pSlider->GetValue() );
1535 }
1536 break;
1537 case eIsSettingToDialog:
1538 {
1539 wxWindow * pWnd = wxWindow::FindWindowById( miId, mpDlg);
1540 pSlider = wxDynamicCast(pWnd, wxSlider);
1541 wxASSERT( pSlider );
1542 pSlider->SetValue( WrappedRef.ReadAsInt() );
1543 }
1544 break;
1545 default:
1546 wxASSERT( false );
1547 break;
1548 }
1549 return pSlider;
1550}
int min(int a, int b)
wxSlider * AddSlider(const TranslatableString &Prompt, int pos, int Max, int Min=0)
Definition: ShuttleGui.cpp:591
void WriteToAsInt(const int InInt)
int ReadAsInt()
Definition: WrappedType.cpp:67

References AddSlider(), eIsCreating, eIsGettingFromDialog, eIsGettingMetadata, eIsSettingToDialog, HandleOptionality(), miId, min(), mpDlg, mShuttleMode, WrappedType::ReadAsInt(), UseUpId(), and WrappedType::WriteToAsInt().

Referenced by TieSlider().

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

◆ DoTieSpinControl()

SpinControl * ShuttleGuiBase::DoTieSpinControl ( const wxSize &  size,
const TranslatableString Prompt,
WrappedType WrappedRef,
const double  max,
const double  min = 0 
)
private

Definition at line 1394 of file ShuttleGui.cpp.

1397{
1398 HandleOptionality( Prompt );
1399 // The Add function does a UseUpId(), so don't do it here in that case.
1400 if( mShuttleMode == eIsCreating )
1401 return AddSpinControl(size, Prompt, WrappedRef.ReadAsDouble(), max, min);
1402
1403 UseUpId();
1404 SpinControl * pSpinCtrl=NULL;
1405
1406 wxWindow * pWnd = wxWindow::FindWindowById( miId, mpDlg);
1407 pSpinCtrl = dynamic_cast<SpinControl*>(pWnd);
1408
1409 switch( mShuttleMode )
1410 {
1411 // IF setting internal storage from the controls.
1412 case eIsGettingMetadata:
1413 break;
1415 {
1416 wxASSERT( pSpinCtrl );
1417 WrappedRef.WriteToAsDouble( pSpinCtrl->GetValue() );
1418 }
1419 break;
1420 case eIsSettingToDialog:
1421 {
1422 wxASSERT( pSpinCtrl );
1423 pSpinCtrl->SetValue( WrappedRef.ReadAsDouble() );
1424 }
1425 break;
1426 default:
1427 wxASSERT( false );
1428 break;
1429 }
1430 return pSpinCtrl;
1431}
SpinControl * AddSpinControl(const wxSize &size, const TranslatableString &Prompt, double Value, double Max, double Min)
Definition: ShuttleGui.cpp:640
double GetValue() const
Definition: SpinControl.cpp:90
void SetValue(double value)
Definition: SpinControl.cpp:85
double ReadAsDouble()
Definition: WrappedType.cpp:93
void WriteToAsDouble(const double InDouble)

References AddSpinControl(), eIsCreating, eIsGettingFromDialog, eIsGettingMetadata, eIsSettingToDialog, SpinControl::GetValue(), HandleOptionality(), miId, min(), mpDlg, mShuttleMode, WrappedType::ReadAsDouble(), SpinControl::SetValue(), size, UseUpId(), and WrappedType::WriteToAsDouble().

Referenced by TieSpinControl().

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

◆ DoTieSpinCtrl()

wxSpinCtrl * ShuttleGuiBase::DoTieSpinCtrl ( const TranslatableString Prompt,
WrappedType WrappedRef,
const int  max,
const int  min = 0 
)
private

Definition at line 1355 of file ShuttleGui.cpp.

1358{
1359 HandleOptionality( Prompt );
1360 // The Add function does a UseUpId(), so don't do it here in that case.
1361 if( mShuttleMode == eIsCreating )
1362 return AddSpinCtrl( Prompt, WrappedRef.ReadAsInt(), max, min );
1363
1364 UseUpId();
1365 wxSpinCtrl * pSpinCtrl=NULL;
1366
1367 wxWindow * pWnd = wxWindow::FindWindowById( miId, mpDlg);
1368 pSpinCtrl = wxDynamicCast(pWnd, wxSpinCtrl);
1369
1370 switch( mShuttleMode )
1371 {
1372 // IF setting internal storage from the controls.
1373 case eIsGettingMetadata:
1374 break;
1376 {
1377 wxASSERT( pSpinCtrl );
1378 WrappedRef.WriteToAsInt( pSpinCtrl->GetValue() );
1379 }
1380 break;
1381 case eIsSettingToDialog:
1382 {
1383 wxASSERT( pSpinCtrl );
1384 pSpinCtrl->SetValue( WrappedRef.ReadAsInt() );
1385 }
1386 break;
1387 default:
1388 wxASSERT( false );
1389 break;
1390 }
1391 return pSpinCtrl;
1392}
wxSpinCtrl * AddSpinCtrl(const TranslatableString &Prompt, int Value, int Max, int Min)
Definition: ShuttleGui.cpp:618

References AddSpinCtrl(), eIsCreating, eIsGettingFromDialog, eIsGettingMetadata, eIsSettingToDialog, HandleOptionality(), miId, min(), mpDlg, mShuttleMode, WrappedType::ReadAsInt(), UseUpId(), and WrappedType::WriteToAsInt().

Referenced by TieSpinCtrl().

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

◆ DoTieTextBox()

wxTextCtrl * ShuttleGuiBase::DoTieTextBox ( const TranslatableString Prompt,
WrappedType WrappedRef,
const int  nChars 
)
private

Definition at line 1433 of file ShuttleGui.cpp.

1435{
1436 HandleOptionality( Prompt );
1437 // The Add function does a UseUpId(), so don't do it here in that case.
1438 if( mShuttleMode == eIsCreating )
1439 return AddTextBox( Prompt, WrappedRef.ReadAsString(), nChars );
1440
1441 UseUpId();
1442 wxTextCtrl * pTextBox=NULL;
1443
1444 wxWindow * pWnd = wxWindow::FindWindowById( miId, mpDlg);
1445 pTextBox = wxDynamicCast(pWnd, wxTextCtrl);
1446
1447 switch( mShuttleMode )
1448 {
1449 // IF setting internal storage from the controls.
1450 case eIsGettingMetadata:
1451 break;
1453 {
1454 wxASSERT( pTextBox );
1455 WrappedRef.WriteToAsString( pTextBox->GetValue() );
1456 }
1457 break;
1458 case eIsSettingToDialog:
1459 {
1460 wxASSERT( pTextBox );
1461 pTextBox->SetValue( WrappedRef.ReadAsString() );
1462 }
1463 break;
1464 default:
1465 wxASSERT( false );
1466 break;
1467 }
1468 return pTextBox;
1469}
wxTextCtrl * AddTextBox(const TranslatableString &Caption, const wxString &Value, const int nChars)
Definition: ShuttleGui.cpp:659

References AddTextBox(), eIsCreating, eIsGettingFromDialog, eIsGettingMetadata, eIsSettingToDialog, HandleOptionality(), miId, mpDlg, mShuttleMode, WrappedType::ReadAsString(), UseUpId(), and WrappedType::WriteToAsString().

Referenced by TieTextBox().

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

◆ EndHorizontalLay()

void ShuttleGuiBase::EndHorizontalLay ( )

Definition at line 1201 of file ShuttleGui.cpp.

1202{
1203 if( mShuttleMode != eIsCreating )
1204 return;
1205 PopSizer();
1206}

References eIsCreating, mShuttleMode, and PopSizer().

Referenced by audacity::cloud::audiocom::ShareAudioDialog::Populate(), and audacity::cloud::audiocom::ShareAudioDialog::InitialStatePanel::PopulateInitialStatePanel().

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

◆ EndInvisiblePanel()

void ShuttleGuiBase::EndInvisiblePanel ( )

Definition at line 1179 of file ShuttleGui.cpp.

1180{
1181 EndPanel();
1182}

References EndPanel().

Referenced by audacity::cloud::audiocom::ShareAudioDialog::Populate(), audacity::cloud::audiocom::ShareAudioDialog::InitialStatePanel::PopulateInitialStatePanel(), and audacity::cloud::audiocom::ShareAudioDialog::ProgressPanel::PopulateProgressPanel().

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

◆ EndMultiColumn()

void ShuttleGuiBase::EndMultiColumn ( )

Definition at line 1262 of file ShuttleGui.cpp.

1263{
1264 if( mShuttleMode != eIsCreating )
1265 return;
1266 PopSizer();
1267}

References eIsCreating, mShuttleMode, and PopSizer().

Here is the call graph for this function:

◆ EndNotebook()

void ShuttleGuiBase::EndNotebook ( )

Definition at line 1064 of file ShuttleGui.cpp.

1065{
1066 //PopSizer();
1067 mpParent = mpParent->GetParent();
1068}

References mpParent.

◆ EndNotebookPage()

void ShuttleGuiBase::EndNotebookPage ( )

Definition at line 1115 of file ShuttleGui.cpp.

1116{
1117 if( mShuttleMode != eIsCreating )
1118 return;
1119 PopSizer();
1120 mpParent = mpParent->GetParent();
1121}

References eIsCreating, mpParent, mShuttleMode, and PopSizer().

Here is the call graph for this function:

◆ EndPanel()

void ShuttleGuiBase::EndPanel ( )

Definition at line 1042 of file ShuttleGui.cpp.

1043{
1044 if( mShuttleMode != eIsCreating )
1045 return;
1046 PopSizer();
1047 mpParent = mpParent->GetParent();
1048}

References eIsCreating, mpParent, mShuttleMode, and PopSizer().

Referenced by EndInvisiblePanel().

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

◆ EndRadioButtonGroup()

void ShuttleGuiBase::EndRadioButtonGroup ( )

Call this after any TieRadioButton calls. It's generic too. We don't need type-specific ones.

Definition at line 1676 of file ShuttleGui.cpp.

1677{
1678 // too few buttons?
1679 wxASSERT( mRadioCount == mRadioSymbols.size() );
1680
1683 mRadioValue.reset();// Clear it out...
1684 mRadioSettingName = wxT("");
1685 mRadioCount = -1; // So we detect a problem.
1686 mRadioSymbols = {};
1687}
std::vector< EnumValueSymbol > mRadioSymbols
Definition: ShuttleGui.h:583
std::optional< WrappedType > mRadioValue
The setting controlled by a group.
Definition: ShuttleGui.h:585
wxString mRadioSettingName
Definition: ShuttleGui.h:584
int mRadioCount
The wrapped value associated with the active radio button.
Definition: ShuttleGui.h:586

References DoDataShuttle(), eIsGettingFromDialog, mRadioCount, mRadioSettingName, mRadioSymbols, mRadioValue, mShuttleMode, and wxT().

Here is the call graph for this function:

◆ EndScroller()

void ShuttleGuiBase::EndScroller ( )

Definition at line 995 of file ShuttleGui.cpp.

996{
998 return;
999 wxSize ScrollSize = mpSizer->GetMinSize();
1000 int yMin = ScrollSize.y+4;
1001 int xMin = ScrollSize.x+4;
1002 if( yMin > 400)
1003 {
1004 yMin = 400;
1005 xMin+=50;// extra space for vertical scrollbar.
1006 }
1007
1008 mpParent->SetMinSize( wxSize(xMin, yMin) );
1009
1010 PopSizer();
1011 mpParent = mpParent->GetParent();
1012}
wxSizer * mpSizer
Definition: ShuttleGui.h:560

References eIsCreating, mpParent, mpSizer, mShuttleMode, and PopSizer().

Here is the call graph for this function:

◆ EndSimplebook()

void ShuttleGuiBase::EndSimplebook ( )

Definition at line 1085 of file ShuttleGui.cpp.

1086{
1087 //PopSizer();
1088 mpParent = mpParent->GetParent();
1089}

References mpParent.

◆ EndStatic()

void ShuttleGuiBase::EndStatic ( )

Definition at line 947 of file ShuttleGui.cpp.

948{
950 return;
951 PopSizer();
952 mpParent = mpParent->GetParent();
953}

References eIsCreating, mpParent, mShuttleMode, and PopSizer().

Here is the call graph for this function:

◆ EndThreeColumn()

void ShuttleGuiBase::EndThreeColumn ( )
inline

Definition at line 371 of file ShuttleGui.h.

371{EndMultiColumn();};
void EndMultiColumn()

◆ EndTwoColumn()

void ShuttleGuiBase::EndTwoColumn ( )
inline

Definition at line 369 of file ShuttleGui.h.

369{EndMultiColumn();};

◆ EndVerticalLay()

void ShuttleGuiBase::EndVerticalLay ( )

Definition at line 1227 of file ShuttleGui.cpp.

1228{
1229 if( mShuttleMode != eIsCreating )
1230 return;
1231 PopSizer();
1232}

References eIsCreating, mShuttleMode, and PopSizer().

Referenced by ShuttleGui::AddStandardButtons(), ErrorReportDialog::ErrorReportDialog(), audacity::cloud::audiocom::ShareAudioDialog::InitialStatePanel::PopulateInitialStatePanel(), and audacity::cloud::audiocom::ShareAudioDialog::ProgressPanel::PopulateProgressPanel().

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

◆ EndWrapLay()

void ShuttleGuiBase::EndWrapLay ( )

Definition at line 1245 of file ShuttleGui.cpp.

1246{
1248 return;
1249
1250 PopSizer();
1251}

References eIsCreating, mShuttleMode, and PopSizer().

Referenced by audacity::cloud::audiocom::ShareAudioDialog::ProgressPanel::PopulateProgressPanel().

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

◆ GetBorder()

int ShuttleGuiBase::GetBorder ( ) const
noexcept

Definition at line 196 of file ShuttleGui.cpp.

197{
198 return miBorder;
199}

References miBorder.

◆ GetParent()

wxWindow * ShuttleGuiBase::GetParent ( )
inline

◆ GetSizer()

wxSizer * ShuttleGuiBase::GetSizer ( )
inline

Definition at line 512 of file ShuttleGui.h.

512{return mpSizer;}

◆ GetStyle()

long ShuttleGuiBase::GetStyle ( long  Style)
protected

◆ HandleOptionality()

void ShuttleGuiBase::HandleOptionality ( const TranslatableString Prompt)

Definition at line 224 of file ShuttleGui.cpp.

225{
226 // If creating, will be handled by an AddPrompt.
228 return;
229 //wxLogDebug( "Optionality: [%s] Id:%i (%i)", Prompt.c_str(), miId, miIdSetByUser ) ;
230 if( mpbOptionalFlag ){
231 bool * pVar = mpbOptionalFlag;
232 mpbOptionalFlag = nullptr;
233 TieCheckBox( Prompt, *pVar);
234 }
235}

References eIsCreating, mpbOptionalFlag, mShuttleMode, and TieCheckBox().

Referenced by AddCheckBox(), AddCheckBoxOnRight(), AddChoice(), AddCombo(), AddConstTextBox(), AddNumericTextBox(), AddReadOnlyText(), AddSlider(), AddSpinControl(), AddSpinCtrl(), AddTextBox(), DoTieCheckBox(), DoTieCheckBoxOnRight(), DoTieNumericTextBox(), DoTieSlider(), DoTieSpinControl(), DoTieSpinCtrl(), DoTieTextBox(), and TieChoice().

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

◆ Init()

void ShuttleGuiBase::Init ( bool  vertical,
wxSize  minSize 
)

Definition at line 143 of file ShuttleGui.cpp.

144{
145 mpShuttle = NULL;
146 mpSizer = NULL;
147 mpWind = NULL;
148 mpSubSizer = NULL;
149
151 mRadioCount = -1;
152
153 miBorder = 5;
154 miProp=0;
156 miSizerProp=0;
157 mSizerDepth=-1;
158
159 ResetId();
160
162
164 return;
165
166 mpSizer = mpParent->GetSizer();
167
168#if 0
169 if( mpSizer == NULL )
170 {
171 wxWindow * pGrandParent = mpParent->GetParent();
172 if( pGrandParent )
173 {
174 mpSizer = pGrandParent->GetSizer();
175 }
176 }
177#endif
178
179 if( !mpSizer )
180 {
181 mpParent->SetSizer(
182 mpSizer = safenew wxBoxSizer(vertical ? wxVERTICAL : wxHORIZONTAL));
183 }
184 PushSizer();
185 mpSizer->SetMinSize(minSize);
186}
int miNoMatchSelector
Definition: ShuttleGui.h:541
std::unique_ptr< wxSizer > mpSubSizer
Definition: ShuttleGui.h:559

References eIsCreating, miBorder, miNoMatchSelector, miProp, miPropSetByUser, miSizerProp, mpParent, mpShuttle, mpSizer, mpSubSizer, mpWind, mRadioCount, mRadioSettingName, mShuttleMode, mSizerDepth, PushSizer(), ResetId(), safenew, and wxT().

Referenced by ShuttleGui::ShuttleGui(), and ShuttleGuiBase().

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

◆ PopSizer()

void ShuttleGuiBase::PopSizer ( )
protected

Definition at line 2270 of file ShuttleGui.cpp.

2271{
2272 mSizerDepth--;
2273 wxASSERT( mSizerDepth >=0 );
2275}
wxSizer * pSizerStack[nMaxNestedSizers]
Definition: ShuttleGui.h:537

References mpSizer, mSizerDepth, and pSizerStack.

Referenced by ShuttleGui::AddStandardButtons(), EndHorizontalLay(), EndMultiColumn(), EndNotebookPage(), EndPanel(), EndScroller(), EndStatic(), EndVerticalLay(), and EndWrapLay().

Here is the caller graph for this function:

◆ Prop()

ShuttleGuiBase & ShuttleGuiBase::Prop ( int  iProp)

Definition at line 907 of file ShuttleGui.cpp.

908{
909 miPropSetByUser = iProp;
910 return *this;
911}

References miPropSetByUser.

Referenced by ShuttleGui::Prop().

Here is the caller graph for this function:

◆ PushSizer()

void ShuttleGuiBase::PushSizer ( )
protected

Definition at line 2277 of file ShuttleGui.cpp.

2278{
2279 mSizerDepth++;
2280 wxASSERT( mSizerDepth < nMaxNestedSizers );
2282}
const int nMaxNestedSizers
Definition: ShuttleGui.h:33

References mpSizer, mSizerDepth, nMaxNestedSizers, and pSizerStack.

Referenced by Init(), StartInvisiblePanel(), StartNotebookPage(), StartPanel(), StartScroller(), and UpdateSizersCore().

Here is the caller graph for this function:

◆ ResetId()

void ShuttleGuiBase::ResetId ( )

Definition at line 188 of file ShuttleGui.cpp.

189{
190 miIdSetByUser = -1;
191 miId = -1;
192 miIdNext = 3000;
193}

References miId, miIdNext, and miIdSetByUser.

Referenced by Init().

Here is the caller graph for this function:

◆ SetBorder()

void ShuttleGuiBase::SetBorder ( int  Border)
inline

Definition at line 495 of file ShuttleGui.h.

495{miBorder = Border;};

Referenced by audacity::cloud::audiocom::ShareAudioDialog::Populate(), audacity::cloud::audiocom::ShareAudioDialog::InitialStatePanel::PopulateInitialStatePanel(), PitchAndSpeedDialog::PopulateOrExchange(), and audacity::cloud::audiocom::ShareAudioDialog::ProgressPanel::PopulateProgressPanel().

Here is the caller graph for this function:

◆ SetProportions()

void ShuttleGuiBase::SetProportions ( int  Default)
protected

Definition at line 2146 of file ShuttleGui.cpp.

2147{
2148 if( miPropSetByUser >=0 )
2149 {
2151 miPropSetByUser =-1;
2152 return;
2153 }
2154 miProp = Default;
2155}

References Default, miProp, and miPropSetByUser.

Referenced by AddGrid(), AddListBox(), AddListControl(), AddListControlReportMode(), AddTextWindow(), AddTree(), AddWindow(), StartInvisiblePanel(), StartNotebook(), StartNotebookPage(), StartPanel(), StartScroller(), and StartSimplebook().

Here is the caller graph for this function:

◆ SetSizerProportion()

void ShuttleGuiBase::SetSizerProportion ( int  iProp)
inline

Definition at line 497 of file ShuttleGui.h.

497{miSizerProp = iProp;};

◆ SetStretchyCol()

void ShuttleGuiBase::SetStretchyCol ( int  i)

Used to modify an already placed FlexGridSizer to make a column stretchy.

Definition at line 202 of file ShuttleGui.cpp.

203{
205 return;
206 wxFlexGridSizer *pSizer = wxDynamicCast(mpSizer, wxFlexGridSizer);
207 wxASSERT( pSizer );
208 pSizer->AddGrowableCol( i, 1 );
209}

References eIsCreating, mpSizer, and mShuttleMode.

◆ SetStretchyRow()

void ShuttleGuiBase::SetStretchyRow ( int  i)

Used to modify an already placed FlexGridSizer to make a row stretchy.

Definition at line 212 of file ShuttleGui.cpp.

213{
215 return;
216 wxFlexGridSizer *pSizer = wxDynamicCast(mpSizer, wxFlexGridSizer);
217 wxASSERT( pSizer );
218 pSizer->AddGrowableRow( i, 1 );
219}

References eIsCreating, mpSizer, and mShuttleMode.

◆ StartHorizontalLay()

void ShuttleGuiBase::StartHorizontalLay ( int  PositionFlags = wxALIGN_CENTRE,
int  iProp = 1 
)

Starts a Horizontal Layout.

  • Use wxEXPAND and 0 to expand horizontally but not vertically.
  • Use wxEXPAND and 1 to expand horizontally and vertically.
  • Use wxCENTRE and 1 for no expansion.
    Parameters
    PositionFlagTypically wxEXPAND or wxALIGN_CENTER.
    iPropProportionality for resizing.

Definition at line 1191 of file ShuttleGui.cpp.

1192{
1193 if( mShuttleMode != eIsCreating )
1194 return;
1195 miSizerProp=iProp;
1196 mpSubSizer = std::make_unique<wxBoxSizer>( wxHORIZONTAL );
1197 // PRL: wxALL has no effect because UpdateSizersCore ignores border
1198 UpdateSizersCore( false, PositionFlags | wxALL );
1199}

References eIsCreating, miSizerProp, mpSubSizer, mShuttleMode, and UpdateSizersCore().

Referenced by audacity::cloud::audiocom::ShareAudioDialog::Populate(), and audacity::cloud::audiocom::ShareAudioDialog::InitialStatePanel::PopulateInitialStatePanel().

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

◆ StartInvisiblePanel()

wxPanel * ShuttleGuiBase::StartInvisiblePanel ( int  border = 0)

Definition at line 1156 of file ShuttleGui.cpp.

1157{
1158 UseUpId();
1159 if( mShuttleMode != eIsCreating )
1160 return wxDynamicCast(wxWindow::FindWindowById( miId, mpDlg), wxPanel);
1161 wxPanel * pPanel;
1162 mpWind = pPanel = safenew wxPanelWrapper(GetParent(), miId, wxDefaultPosition, wxDefaultSize,
1163 wxNO_BORDER);
1164
1165 mpWind->SetBackgroundColour(
1166 wxSystemSettings::GetColour(wxSYS_COLOUR_BTNFACE)
1167 );
1168 SetProportions( 1 );
1169 miBorder = border;
1170 UpdateSizers(); // adds window in to current sizer.
1171
1172 // create a sizer within the window...
1173 mpParent = pPanel;
1174 pPanel->SetSizer(mpSizer = safenew wxBoxSizer(wxVERTICAL));
1175 PushSizer();
1176 return pPanel;
1177}

References eIsCreating, GetParent(), miBorder, miId, mpDlg, mpParent, mpSizer, mpWind, mShuttleMode, PushSizer(), safenew, SetProportions(), UpdateSizers(), and UseUpId().

Referenced by audacity::cloud::audiocom::ShareAudioDialog::Populate(), audacity::cloud::audiocom::ShareAudioDialog::InitialStatePanel::PopulateInitialStatePanel(), and audacity::cloud::audiocom::ShareAudioDialog::ProgressPanel::PopulateProgressPanel().

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

◆ StartMultiColumn()

void ShuttleGuiBase::StartMultiColumn ( int  nCols,
int  PositionFlags = wxALIGN_LEFT 
)

Definition at line 1253 of file ShuttleGui.cpp.

1254{
1255 if( mShuttleMode != eIsCreating )
1256 return;
1257 mpSubSizer = std::make_unique<wxFlexGridSizer>( nCols );
1258 // PRL: wxALL has no effect because UpdateSizersCore ignores border
1259 UpdateSizersCore( false, PositionFlags | wxALL );
1260}

References eIsCreating, mpSubSizer, mShuttleMode, and UpdateSizersCore().

Here is the call graph for this function:

◆ StartNotebook()

wxNotebook * ShuttleGuiBase::StartNotebook ( )

Definition at line 1050 of file ShuttleGui.cpp.

1051{
1052 UseUpId();
1053 if( mShuttleMode != eIsCreating )
1054 return wxDynamicCast(wxWindow::FindWindowById( miId, mpDlg), wxNotebook);
1055 wxNotebook * pNotebook;
1056 mpWind = pNotebook = safenew wxNotebook(GetParent(),
1057 miId, wxDefaultPosition, wxDefaultSize, GetStyle( 0 ));
1058 SetProportions( 1 );
1059 UpdateSizers();
1060 mpParent = pNotebook;
1061 return pNotebook;
1062}

References eIsCreating, GetParent(), GetStyle(), miId, mpDlg, mpParent, mpWind, mShuttleMode, safenew, SetProportions(), UpdateSizers(), and UseUpId().

Here is the call graph for this function:

◆ StartNotebookPage()

wxNotebookPage * ShuttleGuiBase::StartNotebookPage ( const TranslatableString Name)

Definition at line 1092 of file ShuttleGui.cpp.

1094{
1095 if( mShuttleMode != eIsCreating )
1096 return NULL;
1097// return wxDynamicCast(wxWindow::FindWindowById( miId, mpDlg), wx);
1098 auto pNotebook = static_cast< wxBookCtrlBase* >( mpParent );
1100 const auto translated = Name.Translation();
1101 pPage->SetName(translated);
1102
1103 pNotebook->AddPage(
1104 pPage,
1105 translated);
1106
1107 SetProportions( 1 );
1108 mpParent = pPage;
1109 pPage->SetSizer(mpSizer = safenew wxBoxSizer(wxVERTICAL));
1110 PushSizer();
1111 // UpdateSizers();
1112 return pPage;
1113}
wxWindow wxNotebookPage
Definition: ShuttleGui.h:60

References eIsCreating, GetParent(), mpParent, mpSizer, mShuttleMode, PushSizer(), safenew, and SetProportions().

Here is the call graph for this function:

◆ StartPanel()

wxPanel * ShuttleGuiBase::StartPanel ( int  iStyle = 0)

Definition at line 1014 of file ShuttleGui.cpp.

1015{
1016 UseUpId();
1017 if( mShuttleMode != eIsCreating )
1018 return wxDynamicCast(wxWindow::FindWindowById( miId, mpDlg), wxPanel);
1019 wxPanel * pPanel;
1020 mpWind = pPanel = safenew wxPanelWrapper( GetParent(), miId, wxDefaultPosition, wxDefaultSize,
1021 GetStyle( wxNO_BORDER ));
1022
1023 if( iStyle != 0 )
1024 {
1025 mpWind->SetBackgroundColour(
1026 iStyle==1
1027 ? wxColour( 190,200,230) :
1028 wxSystemSettings::GetColour(wxSYS_COLOUR_WINDOW)
1029 );
1030 }
1031 SetProportions(0);
1032 miBorder=2;
1033 UpdateSizers(); // adds window in to current sizer.
1034
1035 // create a sizer within the window...
1036 mpParent = pPanel;
1037 pPanel->SetSizer(mpSizer = safenew wxBoxSizer(wxVERTICAL));
1038 PushSizer();
1039 return pPanel;
1040}

References eIsCreating, GetParent(), GetStyle(), miBorder, miId, mpDlg, mpParent, mpSizer, mpWind, mShuttleMode, PushSizer(), safenew, SetProportions(), UpdateSizers(), and UseUpId().

Here is the call graph for this function:

◆ StartRadioButtonGroup()

void ShuttleGuiBase::StartRadioButtonGroup ( ChoiceSetting Setting)

Call this before any TieRadioButton calls.

Definition at line 1659 of file ShuttleGui.cpp.

1660{
1661 mRadioSymbols = Setting.GetSymbols();
1662
1663 // Configure the generic type mechanism to use OUR string.
1664 mRadioValueString = Setting.Default().Internal();
1665 mRadioValue.emplace( mRadioValueString );
1666
1667 // Now actually start the radio button group.
1668 mRadioSettingName = Setting.Key();
1669 mRadioCount = 0;
1670 if( mShuttleMode == eIsCreating )
1672}
Definition: Prefs.h:178
wxString mRadioValueString
The index of this radio item. -1 for none.
Definition: ShuttleGui.h:587

References DoDataShuttle(), eIsCreating, mRadioCount, mRadioSettingName, mRadioSymbols, mRadioValue, mRadioValueString, and mShuttleMode.

Here is the call graph for this function:

◆ StartScroller()

wxScrolledWindow * ShuttleGuiBase::StartScroller ( int  iStyle = 0)

This allows subsequent controls and static boxes to be in a scrolled panel. Very handy if you are running out of space on a dialog.

The iStyle parameter is used in some very hacky code that dynamically repopulates a dialog. It also controls the background colour. Look at the code for details.

Parameters
istyledeprecated parameter, but has been used for hacking.

Definition at line 963 of file ShuttleGui.cpp.

964{
965 UseUpId();
967 return wxDynamicCast(wxWindow::FindWindowById( miId, mpDlg), wxScrolledWindow);
968
969 wxScrolledWindow * pScroller;
970 mpWind = pScroller = safenew wxScrolledWindow(GetParent(), miId, wxDefaultPosition, wxDefaultSize);
971 pScroller->SetScrollRate( 20,20 );
972
973 // This fools NVDA into not saying "Panel" when the dialog gets focus
974 pScroller->SetName(wxT("\a"));
975 pScroller->SetLabel(wxT("\a"));
976
977 SetProportions( 1 );
978 if( iStyle==2 )
979 {
981 }
982 else
983 {
984 // mpWind->SetBackgroundColour(wxSystemSettings::GetColour(wxSYS_COLOUR_MENUBAR));
985 UpdateSizers(); // adds window in to current sizer.
986 }
987
988 // create a sizer within the window...
989 mpParent = pScroller;
990 pScroller->SetSizer(mpSizer = safenew wxBoxSizer(wxVERTICAL));
991 PushSizer();
992 return pScroller;
993}
void UpdateSizersAtStart()

References eIsCreating, GetParent(), miId, mpDlg, mpParent, mpSizer, mpWind, mShuttleMode, PushSizer(), safenew, SetProportions(), UpdateSizers(), UpdateSizersAtStart(), UseUpId(), and wxT().

Here is the call graph for this function:

◆ StartSimplebook()

wxSimplebook * ShuttleGuiBase::StartSimplebook ( )

Definition at line 1071 of file ShuttleGui.cpp.

1072{
1073 UseUpId();
1074 if( mShuttleMode != eIsCreating )
1075 return wxDynamicCast(wxWindow::FindWindowById( miId, mpDlg), wxSimplebook);
1076 wxSimplebook * pNotebook;
1077 mpWind = pNotebook = safenew wxSimplebook(GetParent(),
1078 miId, wxDefaultPosition, wxDefaultSize, GetStyle( 0 ));
1079 SetProportions( 1 );
1080 UpdateSizers();
1081 mpParent = pNotebook;
1082 return pNotebook;
1083}

References eIsCreating, GetParent(), GetStyle(), miId, mpDlg, mpParent, mpWind, mShuttleMode, safenew, SetProportions(), UpdateSizers(), and UseUpId().

Here is the call graph for this function:

◆ StartStatic()

wxStaticBox * ShuttleGuiBase::StartStatic ( const TranslatableString Str,
int  iProp = 0 
)

Starts a static box around a number of controls.

Parameters
StrThe text of the title for the box.
iPropThe resizing proportion value. Use iProp == 0 for a minimum sized static box. Use iProp == 1 for a box that grows if there is space to spare.

Definition at line 918 of file ShuttleGui.cpp.

919{
920 UseUpId();
922 return NULL;
923 auto translated = Str.Translation();
924 wxStaticBox * pBox = safenew wxStaticBoxWrapper(
925 GetParent(), miId, translated );
926 pBox->SetLabel( translated );
927 if (Str.empty()) {
928 // NVDA 2018.3 or later does not read the controls in a group box which has
929 // an accessibility name which is empty. Bug 2169.
930#if wxUSE_ACCESSIBILITY
931 // so that name can be set on a standard control
932 pBox->SetAccessible(safenew WindowAccessible(pBox));
933#endif
934 pBox->SetName(wxT("\a")); // non-empty string which screen readers do not read
935 }
936 else
937 pBox->SetName( wxStripMenuCodes( translated ) );
938 mpSubSizer = std::make_unique<wxStaticBoxSizer>(
939 pBox,
940 wxVERTICAL );
941 miSizerProp = iProp;
942 UpdateSizers();
943 mpParent = pBox;
944 return pBox;
945}

References eIsCreating, TranslatableString::empty(), GetParent(), miId, miSizerProp, mpParent, mpSubSizer, mShuttleMode, safenew, TranslatableString::Translation(), UpdateSizers(), UseUpId(), and wxT().

Here is the call graph for this function:

◆ StartThreeColumn()

void ShuttleGuiBase::StartThreeColumn ( )
inline

Definition at line 370 of file ShuttleGui.h.

370{StartMultiColumn(3);};
void StartMultiColumn(int nCols, int PositionFlags=wxALIGN_LEFT)

◆ StartTwoColumn()

void ShuttleGuiBase::StartTwoColumn ( )
inline

Definition at line 368 of file ShuttleGui.h.

368{StartMultiColumn(2);};

◆ StartVerticalLay() [1/2]

void ShuttleGuiBase::StartVerticalLay ( int  iProp = 1)

Definition at line 1208 of file ShuttleGui.cpp.

1209{
1210 if( mShuttleMode != eIsCreating )
1211 return;
1212 miSizerProp=iProp;
1213 mpSubSizer = std::make_unique<wxBoxSizer>( wxVERTICAL );
1214 UpdateSizers();
1215}

References eIsCreating, miSizerProp, mpSubSizer, mShuttleMode, and UpdateSizers().

Referenced by ShuttleGui::AddStandardButtons(), ErrorReportDialog::ErrorReportDialog(), audacity::cloud::audiocom::ShareAudioDialog::InitialStatePanel::PopulateInitialStatePanel(), and audacity::cloud::audiocom::ShareAudioDialog::ProgressPanel::PopulateProgressPanel().

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

◆ StartVerticalLay() [2/2]

void ShuttleGuiBase::StartVerticalLay ( int  PositionFlags,
int  iProp 
)

Definition at line 1217 of file ShuttleGui.cpp.

1218{
1219 if( mShuttleMode != eIsCreating )
1220 return;
1221 miSizerProp=iProp;
1222 mpSubSizer = std::make_unique<wxBoxSizer>( wxVERTICAL );
1223 // PRL: wxALL has no effect because UpdateSizersCore ignores border
1224 UpdateSizersCore( false, PositionFlags | wxALL );
1225}

References eIsCreating, miSizerProp, mpSubSizer, mShuttleMode, and UpdateSizersCore().

Here is the call graph for this function:

◆ StartWrapLay()

void ShuttleGuiBase::StartWrapLay ( int  PositionFlags = wxEXPAND,
int  iProp = 0 
)

Definition at line 1234 of file ShuttleGui.cpp.

1235{
1237 return;
1238
1239 miSizerProp = iProp;
1240 mpSubSizer = std::make_unique<wxWrapSizer>(wxHORIZONTAL, 0);
1241
1242 UpdateSizersCore(false, PositionFlags | wxALL);
1243}

References eIsCreating, miSizerProp, mpSubSizer, mShuttleMode, and UpdateSizersCore().

Referenced by audacity::cloud::audiocom::ShareAudioDialog::ProgressPanel::PopulateProgressPanel().

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

◆ TieCheckBox() [1/2]

wxCheckBox * ShuttleGuiBase::TieCheckBox ( const TranslatableString Prompt,
bool &  Var 
)

Definition at line 1693 of file ShuttleGui.cpp.

1694{
1695 WrappedType WrappedRef( Var );
1696 return DoTieCheckBox( Prompt, WrappedRef );
1697}
wxCheckBox * DoTieCheckBox(const TranslatableString &Prompt, WrappedType &WrappedRef)
Used in type conversions, this wrapper for ints, strings, doubles and enums provides conversions betw...
Definition: WrappedType.h:28

References DoTieCheckBox().

Referenced by AddPrompt(), HandleOptionality(), PitchAndSpeedDialog::PopulateOrExchange(), and anonymous_namespace{GetInfoCommand.cpp}::ShuttleGuiGetDefinition::TieCheckBox().

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

◆ TieCheckBox() [2/2]

wxCheckBox * ShuttleGuiBase::TieCheckBox ( const TranslatableString Prompt,
const BoolSetting Setting 
)
virtual

Variant of the standard TieCheckBox which does the two step exchange between gui and stack variable and stack variable and shuttle.

Reimplemented in anonymous_namespace{GetInfoCommand.cpp}::ShuttleGuiGetDefinition.

Definition at line 1916 of file ShuttleGui.cpp.

1919{
1920 wxCheckBox * pCheck=NULL;
1921
1922 auto Value = Setting.GetDefault();
1923 WrappedType WrappedRef( Value );
1924 if( DoStep(1) ) DoDataShuttle( Setting.GetPath(), WrappedRef );
1925 if( DoStep(2) ) pCheck = DoTieCheckBox( Prompt, WrappedRef );
1926 if( DoStep(3) ) DoDataShuttle( Setting.GetPath(), WrappedRef );
1927
1928 return pCheck;
1929}
const SettingPath & GetPath() const
Definition: Prefs.h:88
const T & GetDefault() const
Definition: Prefs.h:199

References DoDataShuttle(), DoStep(), DoTieCheckBox(), Setting< T >::GetDefault(), and SettingBase::GetPath().

Here is the call graph for this function:

◆ TieCheckBoxOnRight() [1/2]

wxCheckBox * ShuttleGuiBase::TieCheckBoxOnRight ( const TranslatableString Prompt,
bool &  Var 
)

Definition at line 1700 of file ShuttleGui.cpp.

1701{
1702 // Only does anything different if it's creating.
1703 WrappedType WrappedRef( Var );
1704 if( mShuttleMode == eIsCreating )
1705 return AddCheckBoxOnRight( Prompt, WrappedRef.ReadAsString() == wxT("true") );
1706 return DoTieCheckBox( Prompt, WrappedRef );
1707}

References AddCheckBoxOnRight(), DoTieCheckBox(), eIsCreating, mShuttleMode, WrappedType::ReadAsString(), and wxT().

Referenced by anonymous_namespace{GetInfoCommand.cpp}::ShuttleGuiGetDefinition::TieCheckBoxOnRight().

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

◆ TieCheckBoxOnRight() [2/2]

wxCheckBox * ShuttleGuiBase::TieCheckBoxOnRight ( const TranslatableString Prompt,
const BoolSetting Setting 
)
virtual

Variant of the standard TieCheckBox which does the two step exchange between gui and stack variable and stack variable and shuttle.

Reimplemented in anonymous_namespace{GetInfoCommand.cpp}::ShuttleGuiGetDefinition.

Definition at line 1933 of file ShuttleGui.cpp.

1936{
1937 wxCheckBox * pCheck=NULL;
1938
1939 auto Value = Setting.GetDefault();
1940 WrappedType WrappedRef( Value );
1941 if( DoStep(1) ) DoDataShuttle( Setting.GetPath(), WrappedRef );
1942 if( DoStep(2) ) pCheck = DoTieCheckBoxOnRight( Prompt, WrappedRef );
1943 if( DoStep(3) ) DoDataShuttle( Setting.GetPath(), WrappedRef );
1944
1945 return pCheck;
1946}
wxCheckBox * DoTieCheckBoxOnRight(const TranslatableString &Prompt, WrappedType &WrappedRef)

References DoDataShuttle(), DoStep(), DoTieCheckBoxOnRight(), Setting< T >::GetDefault(), and SettingBase::GetPath().

Here is the call graph for this function:

◆ TieChoice() [1/3]

wxChoice * ShuttleGuiBase::TieChoice ( const TranslatableString Prompt,
ChoiceSetting choiceSetting 
)
virtual

Variant of the standard TieChoice which does the two step exchange between gui and stack variable and stack variable and shuttle.

Parameters
PromptThe prompt shown beside the control.
SettingEncapsulates setting name, internal and visible choice strings, and a designation of one of those as default.

Reimplemented in anonymous_namespace{GetInfoCommand.cpp}::ShuttleGuiGetDefinition.

Definition at line 2045 of file ShuttleGui.cpp.

2047{
2048 // Do this to force any needed migrations first
2049 choiceSetting.Read();
2050
2051 const auto &symbols = choiceSetting.GetSymbols();
2052 const auto &SettingName = choiceSetting.Key();
2053 const auto &Default = choiceSetting.Default().Internal();
2054 const auto &Choices = symbols.GetMsgids();
2055 const auto &InternalChoices = symbols.GetInternals();
2056
2057 wxChoice * pChoice=(wxChoice*)NULL;
2058
2059 int TempIndex=0;
2060// int TempIndex = TranslateToIndex( Default, InternalChoices );
2061 wxString TempStr = Default;
2062 WrappedType WrappedRef( TempStr );
2063 // Get from prefs does 1 and 2.
2064 // Put to prefs does 2 and 3.
2065 if( DoStep(1) ) DoDataShuttle( SettingName, WrappedRef ); // Get Index from Prefs.
2066 if( DoStep(1) ) TempIndex = TranslateToIndex( TempStr, InternalChoices ); // To an index
2067 if( DoStep(2) ) pChoice = TieChoice( Prompt, TempIndex, Choices );
2068 if( DoStep(3) ) TempStr = TranslateFromIndex( TempIndex, InternalChoices ); // To a string
2069 if( DoStep(3) ) choiceSetting.Write(TempStr); // Put into Prefs.
2070 return pChoice;
2071}
bool Write(const wxString &value)
Definition: Prefs.cpp:424
const wxString & Key() const
Definition: Prefs.h:439
wxString Read() const
Definition: Prefs.cpp:388
const EnumValueSymbols & GetSymbols() const
Definition: Prefs.h:441
const EnumValueSymbol & Default() const
Definition: Prefs.cpp:380
const wxString & Internal() const
wxChoice * TieChoice(const TranslatableString &Prompt, TranslatableString &Selected, const TranslatableStrings &choices)
int TranslateToIndex(const wxString &Value, const wxArrayStringEx &Choices)
String-to-Index.
wxString TranslateFromIndex(const int nIn, const wxArrayStringEx &Choices)
Index-to-String.

References ChoiceSetting::Default(), Default, DoDataShuttle(), DoStep(), ChoiceSetting::GetSymbols(), ComponentInterfaceSymbol::Internal(), ChoiceSetting::Key(), ChoiceSetting::Read(), TieChoice(), TranslateFromIndex(), TranslateToIndex(), and ChoiceSetting::Write().

Here is the call graph for this function:

◆ TieChoice() [2/3]

wxChoice * ShuttleGuiBase::TieChoice ( const TranslatableString Prompt,
int &  Selected,
const TranslatableStrings choices 
)

Definition at line 1553 of file ShuttleGui.cpp.

1557{
1558 HandleOptionality( Prompt );
1559
1560 // The Add function does a UseUpId(), so don't do it here in that case.
1561 if( mShuttleMode != eIsCreating )
1562 UseUpId();
1563
1564 wxChoice * pChoice=NULL;
1565 switch( mShuttleMode )
1566 {
1567 case eIsCreating:
1568 {
1569 pChoice = AddChoice( Prompt, choices, Selected );
1570 ShuttleGui::SetMinSize(pChoice, choices);
1571 }
1572 break;
1573 // IF setting internal storage from the controls.
1574 case eIsGettingMetadata:
1575 break;
1577 {
1578 wxWindow * pWnd = wxWindow::FindWindowById( miId, mpDlg);
1579 pChoice = wxDynamicCast(pWnd, wxChoice);
1580 wxASSERT( pChoice );
1581 Selected = pChoice->GetSelection();
1582 }
1583 break;
1584 case eIsSettingToDialog:
1585 {
1586 wxWindow * pWnd = wxWindow::FindWindowById( miId, mpDlg);
1587 pChoice = wxDynamicCast(pWnd, wxChoice);
1588 wxASSERT( pChoice );
1589 pChoice->SetSelection( Selected );
1590 }
1591 break;
1592 default:
1593 wxASSERT( false );
1594 break;
1595 }
1596 return pChoice;
1597}
static void SetMinSize(wxWindow *window, const TranslatableStrings &items)

References AddChoice(), eIsCreating, eIsGettingFromDialog, eIsGettingMetadata, eIsSettingToDialog, HandleOptionality(), miId, mpDlg, mShuttleMode, ShuttleGui::SetMinSize(), and UseUpId().

Here is the call graph for this function:

◆ TieChoice() [3/3]

wxChoice * ShuttleGuiBase::TieChoice ( const TranslatableString Prompt,
TranslatableString Selected,
const TranslatableStrings choices 
)

Definition at line 1801 of file ShuttleGui.cpp.

1805{
1806 int Index = make_iterator_range( choices ).index( Selected );
1807 auto result = TieChoice( Prompt, Index, choices );
1808 if ( Index >= 0 && Index < choices.size() )
1809 Selected = choices[ Index ];
1810 else
1811 Selected = {};
1812 return result;
1813}

References make_iterator_range(), and TieChoice().

Referenced by anonymous_namespace{GetInfoCommand.cpp}::ShuttleGuiGetDefinition::TieChoice(), TieChoice(), and TieNumberAsChoice().

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

◆ TieIntegerTextBox()

wxTextCtrl * ShuttleGuiBase::TieIntegerTextBox ( const TranslatableString Prompt,
const IntSetting Setting,
const int  nChars 
)
virtual

Variant of the standard TieTextBox which does the two step exchange between gui and stack variable and stack variable and shuttle. This one does it for integer values...

Reimplemented in anonymous_namespace{GetInfoCommand.cpp}::ShuttleGuiGetDefinition.

Definition at line 2006 of file ShuttleGui.cpp.

2010{
2011 wxTextCtrl * pText=(wxTextCtrl*)NULL;
2012
2013 auto Value = Setting.GetDefault();
2014 WrappedType WrappedRef( Value );
2015 if( DoStep(1) ) DoDataShuttle( Setting.GetPath(), WrappedRef );
2016 if( DoStep(2) ) pText = DoTieNumericTextBox( Prompt, WrappedRef, nChars );
2017 if( DoStep(3) ) DoDataShuttle( Setting.GetPath(), WrappedRef );
2018 return pText;
2019}
wxTextCtrl * DoTieNumericTextBox(const TranslatableString &Prompt, WrappedType &WrappedRef, const int nChars, bool acceptEnter=false)

References DoDataShuttle(), DoStep(), DoTieNumericTextBox(), Setting< T >::GetDefault(), and SettingBase::GetPath().

Referenced by anonymous_namespace{GetInfoCommand.cpp}::ShuttleGuiGetDefinition::TieIntegerTextBox().

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

◆ TieNumberAsChoice()

wxChoice * ShuttleGuiBase::TieNumberAsChoice ( const TranslatableString Prompt,
IntSetting Setting,
const TranslatableStrings Choices,
const std::vector< int > *  pInternalChoices = nullptr,
int  iNoMatchSelector = 0 
)
virtual

Variant of the standard TieChoice which does the two step exchange between gui and stack variable and stack variable and shuttle. The Translated choices and default are integers, not Strings. Behaves identically to the previous, but is meant for use when the choices are non-exhaustive and there is a companion control for arbitrary entry.

Parameters
PromptThe prompt shown beside the control.
SettingNameThe setting name as stored in gPrefs
DefaultThe default integer value for this control
ChoicesAn array of choices that appear on screen.
pInternalChoicesThe corresponding values (as an integer array) if null, then use 0, 1, 2, ...

Reimplemented in anonymous_namespace{GetInfoCommand.cpp}::ShuttleGuiGetDefinition.

Definition at line 2084 of file ShuttleGui.cpp.

2089{
2090 auto fn = [](int arg){ return wxString::Format( "%d", arg ); };
2091
2092 wxArrayStringEx InternalChoices;
2093 if ( pInternalChoices )
2094 InternalChoices =
2095 transform_container<wxArrayStringEx>(*pInternalChoices, fn);
2096 else
2097 for ( int ii = 0; ii < (int)Choices.size(); ++ii )
2098 InternalChoices.push_back( fn( ii ) );
2099
2100 const auto Default = Setting.GetDefault();
2101
2102 miNoMatchSelector = iNoMatchSelector;
2103
2104 long defaultIndex;
2105 if ( pInternalChoices )
2106 defaultIndex = make_iterator_range( *pInternalChoices ).index( Default );
2107 else
2108 defaultIndex = Default;
2109 if ( defaultIndex < 0 || defaultIndex >= (int)Choices.size() )
2110 defaultIndex = -1;
2111
2112 ChoiceSetting choiceSetting{
2113 Setting,
2114 {
2115 ByColumns,
2116 Choices,
2117 InternalChoices,
2118 },
2119 defaultIndex
2120 };
2121
2122 return ShuttleGuiBase::TieChoice(Prompt, choiceSetting);
2123}
ByColumns_t ByColumns
Definition: Prefs.cpp:515
static const auto fn
Extend wxArrayString with move operations and construction and insertion fromstd::initializer_list.

References ByColumns, Default, fn, Setting< T >::GetDefault(), make_iterator_range(), miNoMatchSelector, and TieChoice().

Referenced by anonymous_namespace{GetInfoCommand.cpp}::ShuttleGuiGetDefinition::TieNumberAsChoice().

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

◆ TieNumericTextBox() [1/3]

wxTextCtrl * ShuttleGuiBase::TieNumericTextBox ( const TranslatableString Prompt,
const DoubleSetting Setting,
const int  nChars,
bool  acceptEnter = false 
)
virtual

Variant of the standard TieTextBox which does the two step exchange between gui and stack variable and stack variable and shuttle. This one does it for double values...

Reimplemented in anonymous_namespace{GetInfoCommand.cpp}::ShuttleGuiGetDefinition.

Definition at line 2024 of file ShuttleGui.cpp.

2028{
2029 wxTextCtrl * pText=(wxTextCtrl*)NULL;
2030
2031 auto Value = Setting.GetDefault();
2032 WrappedType WrappedRef( Value );
2033 if( DoStep(1) ) DoDataShuttle( Setting.GetPath(), WrappedRef );
2034 if( DoStep(2) ) pText = DoTieNumericTextBox( Prompt, WrappedRef, nChars, acceptEnter );
2035 if( DoStep(3) ) DoDataShuttle( Setting.GetPath(), WrappedRef );
2036 return pText;
2037}

References DoDataShuttle(), DoStep(), DoTieNumericTextBox(), Setting< T >::GetDefault(), and SettingBase::GetPath().

Here is the call graph for this function:

◆ TieNumericTextBox() [2/3]

wxTextCtrl * ShuttleGuiBase::TieNumericTextBox ( const TranslatableString Prompt,
double &  Value,
const int  nChars = 0,
bool  acceptEnter = false 
)

Definition at line 1753 of file ShuttleGui.cpp.

1756{
1757 WrappedType WrappedRef( Value );
1758 return DoTieNumericTextBox( Prompt, WrappedRef, nChars, acceptEnter );
1759}

References DoTieNumericTextBox().

Here is the call graph for this function:

◆ TieNumericTextBox() [3/3]

wxTextCtrl * ShuttleGuiBase::TieNumericTextBox ( const TranslatableString Prompt,
int &  Value,
const int  nChars = 0,
bool  acceptEnter = false 
)

Definition at line 1745 of file ShuttleGui.cpp.

1748{
1749 WrappedType WrappedRef(Value);
1750 return DoTieNumericTextBox(Prompt, WrappedRef, nChars, acceptEnter);
1751}

References DoTieNumericTextBox().

Referenced by anonymous_namespace{GetInfoCommand.cpp}::ShuttleGuiGetDefinition::TieNumericTextBox().

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

◆ TieRadioButton()

wxRadioButton * ShuttleGuiBase::TieRadioButton ( )

This function must be within a StartRadioButtonGroup - EndRadioButtonGroup pair.

Definition at line 1600 of file ShuttleGui.cpp.

1601{
1602 wxASSERT( mRadioCount >= 0); // Did you remember to use StartRadioButtonGroup() ?
1603
1604 EnumValueSymbol symbol;
1605 if (mRadioCount >= 0 && mRadioCount < (int)mRadioSymbols.size() )
1606 symbol = mRadioSymbols[ mRadioCount ];
1607
1608 // In what follows, WrappedRef is used in read only mode, but we
1609 // don't have a 'read-only' version, so we copy to deal with the constness.
1610 auto Temp = symbol.Internal();
1611 wxASSERT( !Temp.empty() ); // More buttons than values?
1612
1613 WrappedType WrappedRef( Temp );
1614
1615 mRadioCount++;
1616
1617 UseUpId();
1618 wxRadioButton * pRadioButton = NULL;
1619
1620 switch( mShuttleMode )
1621 {
1622 case eIsCreating:
1623 {
1624 const auto &Prompt = symbol.Translation();
1625
1626 mpWind = pRadioButton = safenew wxRadioButton(GetParent(), miId, Prompt,
1627 wxDefaultPosition, wxDefaultSize,
1628 (mRadioCount==1)?wxRB_GROUP:0);
1629
1630 wxASSERT( WrappedRef.IsString() );
1631 wxASSERT( mRadioValue->IsString() );
1632 const bool value =
1633 (WrappedRef.ReadAsString() == mRadioValue->ReadAsString() );
1634 pRadioButton->SetValue( value );
1635
1636 pRadioButton->SetName(wxStripMenuCodes(Prompt));
1637 UpdateSizers();
1638 }
1639 break;
1640 case eIsGettingMetadata:
1641 break;
1643 {
1644 wxWindow * pWnd = wxWindow::FindWindowById( miId, mpDlg);
1645 pRadioButton = wxDynamicCast(pWnd, wxRadioButton);
1646 wxASSERT( pRadioButton );
1647 if( pRadioButton->GetValue() )
1648 mRadioValue->WriteToAsString( WrappedRef.ReadAsString() );
1649 }
1650 break;
1651 default:
1652 wxASSERT( false );
1653 break;
1654 }
1655 return pRadioButton;
1656}
ComponentInterfaceSymbol pairs a persistent string identifier used internally with an optional,...
const wxString Translation() const

References eIsCreating, eIsGettingFromDialog, eIsGettingMetadata, GetParent(), ComponentInterfaceSymbol::Internal(), WrappedType::IsString(), miId, mpDlg, mpWind, mRadioCount, mRadioSymbols, mRadioValue, mShuttleMode, WrappedType::ReadAsString(), safenew, ComponentInterfaceSymbol::Translation(), UpdateSizers(), and UseUpId().

Here is the call graph for this function:

◆ TieSlider() [1/4]

wxSlider * ShuttleGuiBase::TieSlider ( const TranslatableString Prompt,
const IntSetting Setting,
const int  max,
const int  min = 0 
)
virtual

Variant of the standard TieSlider which does the two step exchange between gui and stack variable and stack variable and shuttle.

Reimplemented in anonymous_namespace{GetInfoCommand.cpp}::ShuttleGuiGetDefinition.

Definition at line 1950 of file ShuttleGui.cpp.

1955{
1956 wxSlider * pSlider=NULL;
1957
1958 auto Value = Setting.GetDefault();
1959 WrappedType WrappedRef( Value );
1960 if( DoStep(1) ) DoDataShuttle( Setting.GetPath(), WrappedRef );
1961 if( DoStep(2) ) pSlider = DoTieSlider( Prompt, WrappedRef, max, min );
1962 if( DoStep(3) ) DoDataShuttle( Setting.GetPath(), WrappedRef );
1963
1964 return pSlider;
1965}
wxSlider * DoTieSlider(const TranslatableString &Prompt, WrappedType &WrappedRef, const int max, const int min=0)

References DoDataShuttle(), DoStep(), DoTieSlider(), Setting< T >::GetDefault(), SettingBase::GetPath(), and min().

Here is the call graph for this function:

◆ TieSlider() [2/4]

wxSlider * ShuttleGuiBase::TieSlider ( const TranslatableString Prompt,
double &  pos,
const double  max,
const double  min = 0.0 
)

Definition at line 1768 of file ShuttleGui.cpp.

1771{
1772 WrappedType WrappedRef( pos );
1773 return DoTieSlider( Prompt, WrappedRef, max, min );
1774}

References DoTieSlider(), and min().

Here is the call graph for this function:

◆ TieSlider() [3/4]

wxSlider * ShuttleGuiBase::TieSlider ( const TranslatableString Prompt,
float &  pos,
const float  fMin,
const float  fMax 
)

Definition at line 1776 of file ShuttleGui.cpp.

1779{
1780 const float RoundFix=0.0000001f;
1781 int iVal=(pos-fMin+RoundFix)*100.0/(fMax-fMin);
1782 wxSlider * pWnd = TieSlider( Prompt, iVal, 100 );
1783 pos = iVal*(fMax-fMin)*0.01+fMin;
1784 return pWnd;
1785}
wxSlider * TieSlider(const TranslatableString &Prompt, int &pos, const int max, const int min=0)

References TieSlider().

Here is the call graph for this function:

◆ TieSlider() [4/4]

wxSlider * ShuttleGuiBase::TieSlider ( const TranslatableString Prompt,
int &  pos,
const int  max,
const int  min = 0 
)

Definition at line 1761 of file ShuttleGui.cpp.

1763{
1764 WrappedType WrappedRef( pos );
1765 return DoTieSlider( Prompt, WrappedRef, max, min );
1766}

References DoTieSlider(), and min().

Referenced by anonymous_namespace{GetInfoCommand.cpp}::ShuttleGuiGetDefinition::TieSlider(), TieSlider(), and TieVSlider().

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

◆ TieSpinControl()

SpinControl * ShuttleGuiBase::TieSpinControl ( const wxSize &  size,
const TranslatableString Prompt,
double &  Value,
const double  max,
const double  min = 0 
)

Definition at line 1716 of file ShuttleGui.cpp.

1719{
1720 WrappedType WrappedRef(Value);
1721 return DoTieSpinControl(size, Prompt, WrappedRef, max, min);
1722}
SpinControl * DoTieSpinControl(const wxSize &size, const TranslatableString &Prompt, WrappedType &WrappedRef, const double max, const double min=0)

References DoTieSpinControl(), min(), and size.

Referenced by PitchAndSpeedDialog::PopulateOrExchange().

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

◆ TieSpinCtrl() [1/2]

wxSpinCtrl * ShuttleGuiBase::TieSpinCtrl ( const TranslatableString Prompt,
const IntSetting Setting,
const int  max,
const int  min 
)
virtual

Variant of the standard TieSpinCtrl which does the two step exchange between gui and stack variable and stack variable and shuttle.

Reimplemented in anonymous_namespace{GetInfoCommand.cpp}::ShuttleGuiGetDefinition.

Definition at line 1969 of file ShuttleGui.cpp.

1974{
1975 wxSpinCtrl * pSpinCtrl=NULL;
1976
1977 auto Value = Setting.GetDefault();
1978 WrappedType WrappedRef( Value );
1979 if( DoStep(1) ) DoDataShuttle( Setting.GetPath(), WrappedRef );
1980 if( DoStep(2) ) pSpinCtrl = DoTieSpinCtrl( Prompt, WrappedRef, max, min );
1981 if( DoStep(3) ) DoDataShuttle( Setting.GetPath(), WrappedRef );
1982
1983 return pSpinCtrl;
1984}
wxSpinCtrl * DoTieSpinCtrl(const TranslatableString &Prompt, WrappedType &WrappedRef, const int max, const int min=0)

References DoDataShuttle(), DoStep(), DoTieSpinCtrl(), Setting< T >::GetDefault(), SettingBase::GetPath(), and min().

Here is the call graph for this function:

◆ TieSpinCtrl() [2/2]

wxSpinCtrl * ShuttleGuiBase::TieSpinCtrl ( const TranslatableString Prompt,
int &  Value,
const int  max,
const int  min = 0 
)

Definition at line 1709 of file ShuttleGui.cpp.

1711{
1712 WrappedType WrappedRef(Value);
1713 return DoTieSpinCtrl( Prompt, WrappedRef, max, min );
1714}

References DoTieSpinCtrl(), and min().

Referenced by PitchAndSpeedDialog::PopulateOrExchange(), and anonymous_namespace{GetInfoCommand.cpp}::ShuttleGuiGetDefinition::TieSpinCtrl().

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

◆ TieTextBox() [1/4]

wxTextCtrl * ShuttleGuiBase::TieTextBox ( const TranslatableString Caption,
wxString &  Value,
const int  nChars = 0 
)

Definition at line 1724 of file ShuttleGui.cpp.

1726{
1727 WrappedType WrappedRef(Selected);
1728 return DoTieTextBox( Prompt, WrappedRef, nChars );
1729}
wxTextCtrl * DoTieTextBox(const TranslatableString &Prompt, WrappedType &WrappedRef, const int nChars)

References DoTieTextBox().

Referenced by anonymous_namespace{GetInfoCommand.cpp}::ShuttleGuiGetDefinition::TieTextBox().

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

◆ TieTextBox() [2/4]

wxTextCtrl * ShuttleGuiBase::TieTextBox ( const TranslatableString Prompt,
const StringSetting Setting,
const int  nChars 
)
virtual

Variant of the standard TieTextBox which does the two step exchange between gui and stack variable and stack variable and shuttle.

Reimplemented in anonymous_namespace{GetInfoCommand.cpp}::ShuttleGuiGetDefinition.

Definition at line 1988 of file ShuttleGui.cpp.

1992{
1993 wxTextCtrl * pText=(wxTextCtrl*)NULL;
1994
1995 auto Value = Setting.GetDefault();
1996 WrappedType WrappedRef( Value );
1997 if( DoStep(1) ) DoDataShuttle( Setting.GetPath(), WrappedRef );
1998 if( DoStep(2) ) pText = DoTieTextBox( Prompt, WrappedRef, nChars );
1999 if( DoStep(3) ) DoDataShuttle( Setting.GetPath(), WrappedRef );
2000 return pText;
2001}

References DoDataShuttle(), DoStep(), DoTieTextBox(), Setting< T >::GetDefault(), and SettingBase::GetPath().

Here is the call graph for this function:

◆ TieTextBox() [3/4]

wxTextCtrl * ShuttleGuiBase::TieTextBox ( const TranslatableString Prompt,
double &  Value,
const int  nChars = 0 
)

Definition at line 1738 of file ShuttleGui.cpp.

1740{
1741 WrappedType WrappedRef( Value );
1742 return DoTieTextBox( Prompt, WrappedRef, nChars );
1743}

References DoTieTextBox().

Here is the call graph for this function:

◆ TieTextBox() [4/4]

wxTextCtrl * ShuttleGuiBase::TieTextBox ( const TranslatableString Prompt,
int &  Selected,
const int  nChars = 0 
)

Definition at line 1731 of file ShuttleGui.cpp.

1733{
1734 WrappedType WrappedRef( Selected );
1735 return DoTieTextBox( Prompt, WrappedRef, nChars );
1736}

References DoTieTextBox().

Here is the call graph for this function:

◆ TieVSlider()

wxSlider * ShuttleGuiBase::TieVSlider ( const TranslatableString Prompt,
float &  pos,
const float  fMin,
const float  fMax 
)

Definition at line 1787 of file ShuttleGui.cpp.

1790{
1791 int iVal=(pos-fMin)*100.0/(fMax-fMin);
1792// if( mShuttleMode == eIsCreating )
1793// {
1794// return AddVSlider( Prompt, iVal, 100 );
1795// }
1796 wxSlider * pWnd = TieSlider( Prompt, iVal, 100 );
1797 pos = iVal*(fMax-fMin)*0.01+fMin;
1798 return pWnd;
1799}

References TieSlider().

Here is the call graph for this function:

◆ TranslateFromIndex()

wxString ShuttleGuiBase::TranslateFromIndex ( const int  nIn,
const wxArrayStringEx Choices 
)

Index-to-String.

Definition at line 1833 of file ShuttleGui.cpp.

1834{
1835 int n = nIn;
1836 if( n== wxNOT_FOUND )
1839 if( n < (int)Choices.size() )
1840 {
1841 return Choices[n];
1842 }
1843 return wxT("");
1844}

References miNoMatchSelector, and wxT().

Referenced by TieChoice().

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

◆ TranslateToIndex()

int ShuttleGuiBase::TranslateToIndex ( const wxString &  Value,
const wxArrayStringEx Choices 
)

String-to-Index.

Definition at line 1823 of file ShuttleGui.cpp.

1824{
1825 int n = make_iterator_range( Choices ).index( Value );
1826 if( n == wxNOT_FOUND )
1829 return n;
1830}

References make_iterator_range(), and miNoMatchSelector.

Referenced by TieChoice().

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

◆ UpdateSizers()

void ShuttleGuiBase::UpdateSizers ( )
protected

Definition at line 2258 of file ShuttleGui.cpp.

2259{ UpdateSizersCore( false, wxEXPAND | wxALL );}

References UpdateSizersCore().

Referenced by AddCheckBox(), AddCheckBoxOnRight(), AddChoice(), AddCombo(), AddConstTextBox(), AddFixedText(), AddGrid(), AddListBox(), AddListControl(), AddListControlReportMode(), AddNumericTextBox(), AddReadOnlyText(), AddSlider(), AddSpinControl(), AddSpinCtrl(), ShuttleGui::AddStandardButtons(), AddTextBox(), AddTextWindow(), AddTitle(), AddTree(), AddVariableText(), DoAddRadioButton(), StartInvisiblePanel(), StartNotebook(), StartPanel(), StartScroller(), StartSimplebook(), StartStatic(), StartVerticalLay(), and TieRadioButton().

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

◆ UpdateSizersAtStart()

void ShuttleGuiBase::UpdateSizersAtStart ( )
protected

Definition at line 2267 of file ShuttleGui.cpp.

2268{ UpdateSizersCore( true, wxEXPAND | wxALL );}

References UpdateSizersCore().

Referenced by StartScroller().

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

◆ UpdateSizersC()

void ShuttleGuiBase::UpdateSizersC ( )
protected

Definition at line 2262 of file ShuttleGui.cpp.

2263{ UpdateSizersCore( false, wxALIGN_CENTRE | wxALL );}

References UpdateSizersCore().

Referenced by AddFixedText(), AddIcon(), and AddVariableText().

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

◆ UpdateSizersCore()

void ShuttleGuiBase::UpdateSizersCore ( bool  bPrepend,
int  Flags,
bool  prompt = false 
)
protected

Definition at line 2204 of file ShuttleGui.cpp.

2205{
2206 if( mpWind && mpParent )
2207 {
2208 int useFlags = Flags;
2209
2210 if ( !prompt && mItem.mWindowPositionFlags )
2211 // override the given Flags
2212 useFlags = mItem.mWindowPositionFlags;
2213
2214 if (!prompt)
2215 ApplyItem( 0, mItem, mpWind, mpDlg );
2216
2217 if( mpSizer){
2218 if( bPrepend )
2219 {
2220 mpSizer->Prepend(mpWind, miProp, useFlags, miBorder);
2221 }
2222 else
2223 {
2224 mpSizer->Add(mpWind, miProp, useFlags, miBorder);
2225 }
2226 }
2227
2228 if (!prompt) {
2229 ApplyItem( 1, mItem, mpWind, mpDlg );
2230 // Reset to defaults
2231 mItem = {};
2232 }
2233 }
2234
2235 if( mpSubSizer && mpSizer )
2236 {
2237 // When adding sizers into sizers, don't add a border.
2238 // unless it's a static box sizer.
2239 wxSizer *const pSubSizer = mpSubSizer.get();
2240 if (wxDynamicCast(pSubSizer, wxStaticBoxSizer))
2241 {
2242 mpSizer->Add( mpSubSizer.release(), miSizerProp, Flags , miBorder);
2243 }
2244 else
2245 {
2246 mpSizer->Add( mpSubSizer.release(), miSizerProp, Flags ,0);//miBorder);
2247 }
2248 mpSizer = pSubSizer;
2249 PushSizer();
2250 }
2251
2252 mpWind = NULL;
2253 miProp = 0;
2254 miSizerProp =0;
2255}
static void ApplyItem(int step, const DialogDefinition::Item &item, wxWindow *pWind, wxWindow *pDlg)

References ApplyItem(), miBorder, miProp, miSizerProp, mItem, mpDlg, mpParent, mpSizer, mpSubSizer, mpWind, DialogDefinition::Item::mWindowPositionFlags, and PushSizer().

Referenced by AddBitmapButton(), AddButton(), AddPrompt(), AddUnits(), AddVariableText(), AddWindow(), StartHorizontalLay(), StartMultiColumn(), StartVerticalLay(), StartWrapLay(), UpdateSizers(), UpdateSizersAtStart(), and UpdateSizersC().

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

◆ UseUpId()

void ShuttleGuiBase::UseUpId ( )

The Ids increment as we add NEW controls. However, the user can force the id manually, for example if they need a specific Id for a button, and then let it resume normal numbering later. UseUpId() sets miId to the next Id, either using the user specicfied one, or resuming the sequence.

Definition at line 2135 of file ShuttleGui.cpp.

2136{
2137 if( miIdSetByUser > 0)
2138 {
2140 miIdSetByUser = -1;
2141 return;
2142 }
2143 miId = miIdNext++;
2144}

References miId, miIdNext, and miIdSetByUser.

Referenced by AddBitmapButton(), AddButton(), AddCheckBox(), AddCheckBoxOnRight(), AddChoice(), AddCombo(), AddConstTextBox(), AddFixedText(), AddGrid(), AddIcon(), AddListBox(), AddListControl(), AddListControlReportMode(), AddNumericTextBox(), AddReadOnlyText(), AddSlider(), AddSpinControl(), AddSpinCtrl(), AddTextBox(), AddTextWindow(), AddTree(), AddVariableText(), DoAddRadioButton(), DoTieCheckBox(), DoTieCheckBoxOnRight(), DoTieNumericTextBox(), DoTieSlider(), DoTieSpinControl(), DoTieSpinCtrl(), DoTieTextBox(), StartInvisiblePanel(), StartNotebook(), StartPanel(), StartScroller(), StartSimplebook(), StartStatic(), TieChoice(), and TieRadioButton().

Here is the caller graph for this function:

Member Data Documentation

◆ miBorder

int ShuttleGuiBase::miBorder
protected

Definition at line 547 of file ShuttleGui.h.

Referenced by GetBorder(), Init(), StartInvisiblePanel(), StartPanel(), and UpdateSizersCore().

◆ miId

int ShuttleGuiBase::miId
protected

◆ miIdNext

int ShuttleGuiBase::miIdNext
protected

Definition at line 552 of file ShuttleGui.h.

Referenced by ResetId(), and UseUpId().

◆ miIdSetByUser

int ShuttleGuiBase::miIdSetByUser
protected

Definition at line 553 of file ShuttleGui.h.

Referenced by ShuttleGui::Id(), ResetId(), and UseUpId().

◆ miNoMatchSelector

int ShuttleGuiBase::miNoMatchSelector
protected

Controls source/destination of shuttled data. You can leave this NULL if you are shuttling to variables

Definition at line 541 of file ShuttleGui.h.

Referenced by Init(), TieNumberAsChoice(), TranslateFromIndex(), and TranslateToIndex().

◆ miProp

int ShuttleGuiBase::miProp
protected

◆ miPropSetByUser

int ShuttleGuiBase::miPropSetByUser
protected

Definition at line 555 of file ShuttleGui.h.

Referenced by Init(), Prop(), and SetProportions().

◆ miSizerProp

int ShuttleGuiBase::miSizerProp
protected

◆ mItem

DialogDefinition::Item ShuttleGuiBase::mItem
protected

Definition at line 592 of file ShuttleGui.h.

Referenced by AddReadOnlyText(), AddSlider(), GetStyle(), and UpdateSizersCore().

◆ mpbOptionalFlag

bool* ShuttleGuiBase::mpbOptionalFlag
protected

◆ mpDlg

wxWindow* const ShuttleGuiBase::mpDlg
protected

◆ mpParent

wxWindow* ShuttleGuiBase::mpParent
protected

◆ mpShuttle

std::unique_ptr<ShuttlePrefs> ShuttleGuiBase::mpShuttle
protected

Definition at line 539 of file ShuttleGui.h.

Referenced by DoDataShuttle(), Init(), and ShuttleGui::ShuttleGui().

◆ mpSizer

wxSizer* ShuttleGuiBase::mpSizer
protected

◆ mpSubSizer

std::unique_ptr<wxSizer> ShuttleGuiBase::mpSubSizer
protected

◆ mpWind

wxWindow* ShuttleGuiBase::mpWind
protected

◆ mRadioCount

int ShuttleGuiBase::mRadioCount
private

The wrapped value associated with the active radio button.

Definition at line 586 of file ShuttleGui.h.

Referenced by EndRadioButtonGroup(), Init(), StartRadioButtonGroup(), and TieRadioButton().

◆ mRadioSettingName

wxString ShuttleGuiBase::mRadioSettingName
private

Definition at line 584 of file ShuttleGui.h.

Referenced by EndRadioButtonGroup(), Init(), and StartRadioButtonGroup().

◆ mRadioSymbols

std::vector<EnumValueSymbol> ShuttleGuiBase::mRadioSymbols
private

Definition at line 583 of file ShuttleGui.h.

Referenced by EndRadioButtonGroup(), StartRadioButtonGroup(), and TieRadioButton().

◆ mRadioValue

std::optional<WrappedType> ShuttleGuiBase::mRadioValue
private

The setting controlled by a group.

Definition at line 585 of file ShuttleGui.h.

Referenced by EndRadioButtonGroup(), StartRadioButtonGroup(), and TieRadioButton().

◆ mRadioValueString

wxString ShuttleGuiBase::mRadioValueString
private

The index of this radio item. -1 for none.

Definition at line 587 of file ShuttleGui.h.

Referenced by StartRadioButtonGroup().

◆ mShuttleMode

teShuttleMode ShuttleGuiBase::mShuttleMode
protected

◆ mSizerDepth

int ShuttleGuiBase::mSizerDepth
protected

Definition at line 546 of file ShuttleGui.h.

Referenced by Init(), PopSizer(), and PushSizer().

◆ pSizerStack

wxSizer* ShuttleGuiBase::pSizerStack[nMaxNestedSizers]
protected

Definition at line 537 of file ShuttleGui.h.

Referenced by PopSizer(), and PushSizer().


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