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 | wxSUNKEN_BORDER ));
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 2159 of file ShuttleGui.cpp.

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

1273{
1274 wxASSERT( mpShuttle );
1275 mpShuttle->TransferWrappedType( Name, WrappedRef );
1276}
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 1892 of file ShuttleGui.cpp.

1893{
1894 // Get value and create
1895 if( mShuttleMode == eIsCreating )
1896 {
1897 return (iStep==1) || (iStep==2);
1898 }
1899 // Like creating, get the value and set.
1901 {
1902 return (iStep==1) || (iStep==2);
1903 }
1905 {
1906 return (iStep==2) || (iStep==3);
1907 }
1909 return iStep ==2;
1910 wxASSERT( false );
1911 return false;
1912}
@ 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 1284 of file ShuttleGui.cpp.

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

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

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

1514{
1515 HandleOptionality( Prompt );
1516 // The Add function does a UseUpId(), so don't do it here in that case.
1517 if( mShuttleMode != eIsCreating )
1518 UseUpId();
1519 wxSlider * pSlider=NULL;
1520 switch( mShuttleMode )
1521 {
1522 case eIsCreating:
1523 {
1524 pSlider = AddSlider( Prompt, WrappedRef.ReadAsInt(), max, min );
1525 }
1526 break;
1527 // IF setting internal storage from the controls.
1528 case eIsGettingMetadata:
1529 break;
1531 {
1532 wxWindow * pWnd = wxWindow::FindWindowById( miId, mpDlg);
1533 pSlider = wxDynamicCast(pWnd, wxSlider);
1534 wxASSERT( pSlider );
1535 WrappedRef.WriteToAsInt( pSlider->GetValue() );
1536 }
1537 break;
1538 case eIsSettingToDialog:
1539 {
1540 wxWindow * pWnd = wxWindow::FindWindowById( miId, mpDlg);
1541 pSlider = wxDynamicCast(pWnd, wxSlider);
1542 wxASSERT( pSlider );
1543 pSlider->SetValue( WrappedRef.ReadAsInt() );
1544 }
1545 break;
1546 default:
1547 wxASSERT( false );
1548 break;
1549 }
1550 return pSlider;
1551}
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 1395 of file ShuttleGui.cpp.

1398{
1399 HandleOptionality( Prompt );
1400 // The Add function does a UseUpId(), so don't do it here in that case.
1401 if( mShuttleMode == eIsCreating )
1402 return AddSpinControl(size, Prompt, WrappedRef.ReadAsDouble(), max, min);
1403
1404 UseUpId();
1405 SpinControl * pSpinCtrl=NULL;
1406
1407 wxWindow * pWnd = wxWindow::FindWindowById( miId, mpDlg);
1408 pSpinCtrl = dynamic_cast<SpinControl*>(pWnd);
1409
1410 switch( mShuttleMode )
1411 {
1412 // IF setting internal storage from the controls.
1413 case eIsGettingMetadata:
1414 break;
1416 {
1417 wxASSERT( pSpinCtrl );
1418 WrappedRef.WriteToAsDouble( pSpinCtrl->GetValue() );
1419 }
1420 break;
1421 case eIsSettingToDialog:
1422 {
1423 wxASSERT( pSpinCtrl );
1424 pSpinCtrl->SetValue( WrappedRef.ReadAsDouble() );
1425 }
1426 break;
1427 default:
1428 wxASSERT( false );
1429 break;
1430 }
1431 return pSpinCtrl;
1432}
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 1356 of file ShuttleGui.cpp.

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

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

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

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 1180 of file ShuttleGui.cpp.

1181{
1182 EndPanel();
1183}

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 1263 of file ShuttleGui.cpp.

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

References eIsCreating, mShuttleMode, and PopSizer().

Here is the call graph for this function:

◆ EndNotebook()

void ShuttleGuiBase::EndNotebook ( )

Definition at line 1065 of file ShuttleGui.cpp.

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

References mpParent.

◆ EndNotebookPage()

void ShuttleGuiBase::EndNotebookPage ( )

Definition at line 1116 of file ShuttleGui.cpp.

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

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

Here is the call graph for this function:

◆ EndPanel()

void ShuttleGuiBase::EndPanel ( )

Definition at line 1043 of file ShuttleGui.cpp.

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

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 1677 of file ShuttleGui.cpp.

1678{
1679 // too few buttons?
1680 wxASSERT( mRadioCount == mRadioSymbols.size() );
1681
1684 mRadioValue.reset();// Clear it out...
1685 mRadioSettingName = wxT("");
1686 mRadioCount = -1; // So we detect a problem.
1687 mRadioSymbols = {};
1688}
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 996 of file ShuttleGui.cpp.

997{
999 return;
1000 wxSize ScrollSize = mpSizer->GetMinSize();
1001 int yMin = ScrollSize.y+4;
1002 int xMin = ScrollSize.x+4;
1003 if( yMin > 400)
1004 {
1005 yMin = 400;
1006 xMin+=50;// extra space for vertical scrollbar.
1007 }
1008
1009 mpParent->SetMinSize( wxSize(xMin, yMin) );
1010
1011 PopSizer();
1012 mpParent = mpParent->GetParent();
1013}
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 1086 of file ShuttleGui.cpp.

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

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 1228 of file ShuttleGui.cpp.

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

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 1246 of file ShuttleGui.cpp.

1247{
1249 return;
1250
1251 PopSizer();
1252}

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 2271 of file ShuttleGui.cpp.

2272{
2273 mSizerDepth--;
2274 wxASSERT( mSizerDepth >=0 );
2276}
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 2278 of file ShuttleGui.cpp.

2279{
2280 mSizerDepth++;
2281 wxASSERT( mSizerDepth < nMaxNestedSizers );
2283}
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 2147 of file ShuttleGui.cpp.

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

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 1192 of file ShuttleGui.cpp.

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

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 1157 of file ShuttleGui.cpp.

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

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 1254 of file ShuttleGui.cpp.

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

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

Here is the call graph for this function:

◆ StartNotebook()

wxNotebook * ShuttleGuiBase::StartNotebook ( )

Definition at line 1051 of file ShuttleGui.cpp.

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

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 1093 of file ShuttleGui.cpp.

1095{
1096 if( mShuttleMode != eIsCreating )
1097 return NULL;
1098// return wxDynamicCast(wxWindow::FindWindowById( miId, mpDlg), wx);
1099 auto pNotebook = static_cast< wxBookCtrlBase* >( mpParent );
1101 const auto translated = Name.Translation();
1102 pPage->SetName(translated);
1103
1104 pNotebook->AddPage(
1105 pPage,
1106 translated);
1107
1108 SetProportions( 1 );
1109 mpParent = pPage;
1110 pPage->SetSizer(mpSizer = safenew wxBoxSizer(wxVERTICAL));
1111 PushSizer();
1112 // UpdateSizers();
1113 return pPage;
1114}
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 1015 of file ShuttleGui.cpp.

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

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 1660 of file ShuttleGui.cpp.

1661{
1662 mRadioSymbols = Setting.GetSymbols();
1663
1664 // Configure the generic type mechanism to use OUR string.
1665 mRadioValueString = Setting.Default().Internal();
1666 mRadioValue.emplace( mRadioValueString );
1667
1668 // Now actually start the radio button group.
1669 mRadioSettingName = Setting.Key();
1670 mRadioCount = 0;
1671 if( mShuttleMode == eIsCreating )
1673}
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 GetStyle( wxSUNKEN_BORDER ) );
972 pScroller->SetScrollRate( 20,20 );
973
974 // This fools NVDA into not saying "Panel" when the dialog gets focus
975 pScroller->SetName(wxT("\a"));
976 pScroller->SetLabel(wxT("\a"));
977
978 SetProportions( 1 );
979 if( iStyle==2 )
980 {
982 }
983 else
984 {
985 // mpWind->SetBackgroundColour(wxSystemSettings::GetColour(wxSYS_COLOUR_MENUBAR));
986 UpdateSizers(); // adds window in to current sizer.
987 }
988
989 // create a sizer within the window...
990 mpParent = pScroller;
991 pScroller->SetSizer(mpSizer = safenew wxBoxSizer(wxVERTICAL));
992 PushSizer();
993 return pScroller;
994}
void UpdateSizersAtStart()

References eIsCreating, GetParent(), GetStyle(), 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 1072 of file ShuttleGui.cpp.

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

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 1209 of file ShuttleGui.cpp.

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

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 1218 of file ShuttleGui.cpp.

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

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 1235 of file ShuttleGui.cpp.

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

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 1694 of file ShuttleGui.cpp.

1695{
1696 WrappedType WrappedRef( Var );
1697 return DoTieCheckBox( Prompt, WrappedRef );
1698}
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 1917 of file ShuttleGui.cpp.

1920{
1921 wxCheckBox * pCheck=NULL;
1922
1923 auto Value = Setting.GetDefault();
1924 WrappedType WrappedRef( Value );
1925 if( DoStep(1) ) DoDataShuttle( Setting.GetPath(), WrappedRef );
1926 if( DoStep(2) ) pCheck = DoTieCheckBox( Prompt, WrappedRef );
1927 if( DoStep(3) ) DoDataShuttle( Setting.GetPath(), WrappedRef );
1928
1929 return pCheck;
1930}
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 1701 of file ShuttleGui.cpp.

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

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 1934 of file ShuttleGui.cpp.

1937{
1938 wxCheckBox * pCheck=NULL;
1939
1940 auto Value = Setting.GetDefault();
1941 WrappedType WrappedRef( Value );
1942 if( DoStep(1) ) DoDataShuttle( Setting.GetPath(), WrappedRef );
1943 if( DoStep(2) ) pCheck = DoTieCheckBoxOnRight( Prompt, WrappedRef );
1944 if( DoStep(3) ) DoDataShuttle( Setting.GetPath(), WrappedRef );
1945
1946 return pCheck;
1947}
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 2046 of file ShuttleGui.cpp.

2048{
2049 // Do this to force any needed migrations first
2050 choiceSetting.Read();
2051
2052 const auto &symbols = choiceSetting.GetSymbols();
2053 const auto &SettingName = choiceSetting.Key();
2054 const auto &Default = choiceSetting.Default().Internal();
2055 const auto &Choices = symbols.GetMsgids();
2056 const auto &InternalChoices = symbols.GetInternals();
2057
2058 wxChoice * pChoice=(wxChoice*)NULL;
2059
2060 int TempIndex=0;
2061// int TempIndex = TranslateToIndex( Default, InternalChoices );
2062 wxString TempStr = Default;
2063 WrappedType WrappedRef( TempStr );
2064 // Get from prefs does 1 and 2.
2065 // Put to prefs does 2 and 3.
2066 if( DoStep(1) ) DoDataShuttle( SettingName, WrappedRef ); // Get Index from Prefs.
2067 if( DoStep(1) ) TempIndex = TranslateToIndex( TempStr, InternalChoices ); // To an index
2068 if( DoStep(2) ) pChoice = TieChoice( Prompt, TempIndex, Choices );
2069 if( DoStep(3) ) TempStr = TranslateFromIndex( TempIndex, InternalChoices ); // To a string
2070 if( DoStep(3) ) choiceSetting.Write(TempStr); // Put into Prefs.
2071 return pChoice;
2072}
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 1554 of file ShuttleGui.cpp.

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

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

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 2007 of file ShuttleGui.cpp.

2011{
2012 wxTextCtrl * pText=(wxTextCtrl*)NULL;
2013
2014 auto Value = Setting.GetDefault();
2015 WrappedType WrappedRef( Value );
2016 if( DoStep(1) ) DoDataShuttle( Setting.GetPath(), WrappedRef );
2017 if( DoStep(2) ) pText = DoTieNumericTextBox( Prompt, WrappedRef, nChars );
2018 if( DoStep(3) ) DoDataShuttle( Setting.GetPath(), WrappedRef );
2019 return pText;
2020}
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 2085 of file ShuttleGui.cpp.

2090{
2091 auto fn = [](int arg){ return wxString::Format( "%d", arg ); };
2092
2093 wxArrayStringEx InternalChoices;
2094 if ( pInternalChoices )
2095 InternalChoices =
2096 transform_container<wxArrayStringEx>(*pInternalChoices, fn);
2097 else
2098 for ( int ii = 0; ii < (int)Choices.size(); ++ii )
2099 InternalChoices.push_back( fn( ii ) );
2100
2101 const auto Default = Setting.GetDefault();
2102
2103 miNoMatchSelector = iNoMatchSelector;
2104
2105 long defaultIndex;
2106 if ( pInternalChoices )
2107 defaultIndex = make_iterator_range( *pInternalChoices ).index( Default );
2108 else
2109 defaultIndex = Default;
2110 if ( defaultIndex < 0 || defaultIndex >= (int)Choices.size() )
2111 defaultIndex = -1;
2112
2113 ChoiceSetting choiceSetting{
2114 Setting,
2115 {
2116 ByColumns,
2117 Choices,
2118 InternalChoices,
2119 },
2120 defaultIndex
2121 };
2122
2123 return ShuttleGuiBase::TieChoice(Prompt, choiceSetting);
2124}
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 2025 of file ShuttleGui.cpp.

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

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 1754 of file ShuttleGui.cpp.

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

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 1746 of file ShuttleGui.cpp.

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

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 1601 of file ShuttleGui.cpp.

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

1956{
1957 wxSlider * pSlider=NULL;
1958
1959 auto Value = Setting.GetDefault();
1960 WrappedType WrappedRef( Value );
1961 if( DoStep(1) ) DoDataShuttle( Setting.GetPath(), WrappedRef );
1962 if( DoStep(2) ) pSlider = DoTieSlider( Prompt, WrappedRef, max, min );
1963 if( DoStep(3) ) DoDataShuttle( Setting.GetPath(), WrappedRef );
1964
1965 return pSlider;
1966}
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 1769 of file ShuttleGui.cpp.

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

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 1777 of file ShuttleGui.cpp.

1780{
1781 const float RoundFix=0.0000001f;
1782 int iVal=(pos-fMin+RoundFix)*100.0/(fMax-fMin);
1783 wxSlider * pWnd = TieSlider( Prompt, iVal, 100 );
1784 pos = iVal*(fMax-fMin)*0.01+fMin;
1785 return pWnd;
1786}
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 1762 of file ShuttleGui.cpp.

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

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 1717 of file ShuttleGui.cpp.

1720{
1721 WrappedType WrappedRef(Value);
1722 return DoTieSpinControl(size, Prompt, WrappedRef, max, min);
1723}
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 1970 of file ShuttleGui.cpp.

1975{
1976 wxSpinCtrl * pSpinCtrl=NULL;
1977
1978 auto Value = Setting.GetDefault();
1979 WrappedType WrappedRef( Value );
1980 if( DoStep(1) ) DoDataShuttle( Setting.GetPath(), WrappedRef );
1981 if( DoStep(2) ) pSpinCtrl = DoTieSpinCtrl( Prompt, WrappedRef, max, min );
1982 if( DoStep(3) ) DoDataShuttle( Setting.GetPath(), WrappedRef );
1983
1984 return pSpinCtrl;
1985}
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 1710 of file ShuttleGui.cpp.

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

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 1725 of file ShuttleGui.cpp.

1727{
1728 WrappedType WrappedRef(Selected);
1729 return DoTieTextBox( Prompt, WrappedRef, nChars );
1730}
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 1989 of file ShuttleGui.cpp.

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

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 1739 of file ShuttleGui.cpp.

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

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 1732 of file ShuttleGui.cpp.

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

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 1788 of file ShuttleGui.cpp.

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

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 1834 of file ShuttleGui.cpp.

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

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 1824 of file ShuttleGui.cpp.

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

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 2259 of file ShuttleGui.cpp.

2260{ 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 2268 of file ShuttleGui.cpp.

2269{ 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 2263 of file ShuttleGui.cpp.

2264{ 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 2205 of file ShuttleGui.cpp.

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

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

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: