Audacity  2.2.2
ShuttleGui.cpp
Go to the documentation of this file.
1 /**********************************************************************
2 
3  Audacity: A Digital Audio Editor
4 
5  ShuttleGui.cpp
6 
7  James Crook
8 
9  Audacity is free software.
10  This file is licensed under the wxWidgets license, see License.txt
11 
12 **********************************************************************//***************************************************************//***************************************************************//***************************************************************//******************************************************************/
94 
95 
96 #include "Audacity.h"
97 #include "Experimental.h"
98 #include "Prefs.h"
99 #include "Shuttle.h"
100 #include "ShuttleGui.h"
101 
102 #include "MemoryX.h"
103 #include <wx/wx.h>
104 #include <wx/wxprec.h>
105 #include <wx/listctrl.h>
106 #include <wx/notebook.h>
107 #include <wx/treectrl.h>
108 #include <wx/spinctrl.h>
109 #include <wx/bmpbuttn.h>
110 #include "../include/audacity/IdentInterface.h"
111 #include "Internat.h"
112 #include "WrappedType.h"
113 #include "widgets/wxPanelWrapper.h"
114 #include "AllThemeResources.h"
115 
116 #if wxUSE_ACCESSIBILITY
118 #endif
119 
120 ShuttleGuiBase::ShuttleGuiBase(wxWindow * pParent, teShuttleMode ShuttleMode )
121 {
122  wxASSERT( (pParent != NULL ) || ( ShuttleMode != eIsCreating));
123  mpbOptionalFlag = nullptr;
124  mpParent = pParent;
125  mShuttleMode = ShuttleMode;
126  mpDlg = pParent;
127  Init();
128 }
129 
131 {
132 }
133 
135 {
136  mpShuttle = NULL;
137  mpSizer = NULL;
138  mpWind = NULL;
139  mpSubSizer = NULL;
140 
141  mSettingName = wxT("");
142  mRadioCount = -1;
143 
144  miBorder = 5;
145  miStyle = 0;
146  miProp=0;
147  miPropSetByUser=-1;
148  miSizerProp=0;
149  mSizerDepth=-1;
150 
151  ResetId();
152 
153  miNoMatchSelector = 0;
154 
155  if( mShuttleMode != eIsCreating )
156  return;
157 
158  mpSizer = mpParent->GetSizer();
159 
160 #if 0
161  if( mpSizer == NULL )
162  {
163  wxWindow * pGrandParent = mpParent->GetParent();
164  if( pGrandParent )
165  {
166  mpSizer = pGrandParent->GetSizer();
167  }
168  }
169 #endif
170 
171  if( !mpSizer )
172  {
173  mpParent->SetSizer(mpSizer = safenew wxBoxSizer(wxVERTICAL));
174  }
175  PushSizer();
176  mpSizer->SetMinSize(250,100);
177 }
178 
180 {
181  miIdSetByUser = -1;
182  miId = -1;
183  miIdNext = 3000;
184 }
185 
186 void ShuttleGuiBase::EnableCtrl( bool bEnable )
187 {
188  if( mShuttleMode != eIsCreating )
189  return;
190  mpLastWind->Enable( bEnable );
191 }
192 
194 void ShuttleGuiBase::SetSizeHints( int minX, int minY )
195 {
196  if( mShuttleMode != eIsCreating )
197  return;
198  mpLastWind->SetSizeHints( minX, minY );
199 }
200 
201 
204 {
205  if( mShuttleMode != eIsCreating )
206  return;
207  wxFlexGridSizer *pSizer = wxDynamicCast(mpSizer, wxFlexGridSizer);
208  wxASSERT( pSizer );
209  pSizer->AddGrowableCol( i, 1 );
210 }
211 
214 {
215  if( mShuttleMode != eIsCreating )
216  return;
217  wxFlexGridSizer *pSizer = wxDynamicCast(mpSizer, wxFlexGridSizer);
218  wxASSERT( pSizer );
219  pSizer->AddGrowableRow( i, 1 );
220 }
221 
222 
223 //---- Add Functions.
224 
225 void ShuttleGuiBase::HandleOptionality(const wxString &Prompt)
226 {
227  // If creating, will be handled by an AddPrompt.
228  if( mShuttleMode == eIsCreating )
229  return;
230  //wxLogDebug( "Optionality: [%s] Id:%i (%i)", Prompt.c_str(), miId, miIdSetByUser ) ;
231  if( mpbOptionalFlag ){
232  bool * pVar = mpbOptionalFlag;
233  mpbOptionalFlag = nullptr;
234  TieCheckBox( Prompt, *pVar);
235  }
236 }
237 
239 void ShuttleGuiBase::AddPrompt(const wxString &Prompt)
240 {
241  if( mShuttleMode != eIsCreating )
242  return;
243  //wxLogDebug( "Prompt: [%s] Id:%i (%i)", Prompt.c_str(), miId, miIdSetByUser ) ;
244  if( mpbOptionalFlag ){
245  bool * pVar = mpbOptionalFlag;
246  mpbOptionalFlag = nullptr;
247  TieCheckBox( "", *pVar);
248  //return;
249  }
250  if( Prompt.IsEmpty() )
251  return;
252  miProp=1;
253  mpWind = safenew wxStaticText(GetParent(), -1, Prompt, wxDefaultPosition, wxDefaultSize,
254  Style( wxALIGN_RIGHT ));
255  mpWind->SetName(wxStripMenuCodes(Prompt)); // fix for bug 577 (NVDA/Narrator screen readers do not read static text in dialogs)
256  UpdateSizersCore( false, wxALL | wxALIGN_CENTRE_VERTICAL );
257 }
258 
260 void ShuttleGuiBase::AddUnits(const wxString &Prompt)
261 {
262  if( Prompt.IsEmpty() )
263  return;
264  if( mShuttleMode != eIsCreating )
265  return;
266  miProp=1;
267  mpWind = safenew wxStaticText(GetParent(), -1, Prompt, wxDefaultPosition, wxDefaultSize,
268  Style( wxALIGN_LEFT ));
269  mpWind->SetName(Prompt); // fix for bug 577 (NVDA/Narrator screen readers do not read static text in dialogs)
270  UpdateSizersCore( false, wxALL | wxALIGN_CENTRE_VERTICAL );
271 }
272 
274 void ShuttleGuiBase::AddTitle(const wxString &Prompt)
275 {
276  if( Prompt.IsEmpty() )
277  return;
278  if( mShuttleMode != eIsCreating )
279  return;
280  mpWind = safenew wxStaticText(GetParent(), -1, Prompt, wxDefaultPosition, wxDefaultSize,
281  Style( wxALIGN_CENTRE ));
282  mpWind->SetName(Prompt); // fix for bug 577 (NVDA/Narrator screen readers do not read static text in dialogs)
283  UpdateSizers();
284 }
285 
288 wxWindow * ShuttleGuiBase::AddWindow(wxWindow * pWindow, int Flags )
289 {
290  if( mShuttleMode != eIsCreating )
291  return pWindow;
292  mpWind = pWindow;
293  SetProportions( 0 );
294  UpdateSizersCore(false, Flags);
295  return pWindow;
296 }
297 
298 wxCheckBox * ShuttleGuiBase::AddCheckBox( const wxString &Prompt, const wxString &Selected)
299 {
300  HandleOptionality( Prompt );
301  wxString realPrompt = Prompt;
302  if( mpbOptionalFlag )
303  {
304  AddPrompt( "");
305  //realPrompt = wxT("");
306  }
307 
308  UseUpId();
309  if( mShuttleMode != eIsCreating )
310  return wxDynamicCast(wxWindow::FindWindowById( miId, mpDlg), wxCheckBox);
311  wxCheckBox * pCheckBox;
312  miProp=0;
313  mpWind = pCheckBox = safenew wxCheckBox(GetParent(), miId, realPrompt, wxDefaultPosition, wxDefaultSize,
314  Style( 0 ));
315  pCheckBox->SetValue(Selected == wxT("true"));
316  if (realPrompt.IsEmpty()) {
317  // NVDA 2018.3 does not read controls which are buttons, check boxes or radio buttons which have
318  // an accessibility name which is empty. Bug 1980.
319 #if wxUSE_ACCESSIBILITY
320  // so that name can be set on a standard control
321  pCheckBox->SetAccessible(safenew WindowAccessible(pCheckBox));
322 #endif
323  pCheckBox->SetName(wxT("\a")); // non-empty string which screen readers do not read
324  }
325  UpdateSizers();
326  return pCheckBox;
327 }
328 
332 wxCheckBox * ShuttleGuiBase::AddCheckBoxOnRight( const wxString &Prompt, const wxString &Selected)
333 {
334  HandleOptionality( Prompt );
335  AddPrompt( Prompt );
336  UseUpId();
337  if( mShuttleMode != eIsCreating )
338  return wxDynamicCast(wxWindow::FindWindowById( miId, mpDlg), wxCheckBox);
339  wxCheckBox * pCheckBox;
340  miProp=0;
341  mpWind = pCheckBox = safenew wxCheckBox(GetParent(), miId, wxT(""), wxDefaultPosition, wxDefaultSize,
342  Style( 0 ));
343  pCheckBox->SetValue(Selected==wxT("true"));
344  pCheckBox->SetName(wxStripMenuCodes(Prompt));
345  UpdateSizers();
346  return pCheckBox;
347 }
348 
349 wxButton * ShuttleGuiBase::AddButton(const wxString &Text, int PositionFlags)
350 {
351  UseUpId();
352  if( mShuttleMode != eIsCreating )
353  return wxDynamicCast(wxWindow::FindWindowById( miId, mpDlg), wxButton);
354  wxButton * pBtn;
355  mpWind = pBtn = safenew wxButton(GetParent(), miId, Text, wxDefaultPosition, wxDefaultSize,
356  Style( 0 ) );
357  mpWind->SetName(wxStripMenuCodes(Text));
358  miProp=0;
359  UpdateSizersCore(false, PositionFlags | wxALL);
360  return pBtn;
361 }
362 
363 wxBitmapButton * ShuttleGuiBase::AddBitmapButton(const wxBitmap &Bitmap, int PositionFlags)
364 {
365  UseUpId();
366  if( mShuttleMode != eIsCreating )
367  return wxDynamicCast(wxWindow::FindWindowById( miId, mpDlg), wxBitmapButton);
368  wxBitmapButton * pBtn;
369  mpWind = pBtn = safenew wxBitmapButton(GetParent(), miId, Bitmap,
370  wxDefaultPosition, wxDefaultSize, Style( wxNO_BORDER ) );
371  pBtn->SetBackgroundColour(
372  wxColour( 246,246,243));
373 // wxSystemSettings::GetColour(wxSYS_COLOUR_BTNFACE));
374  miProp=0;
375  UpdateSizersCore(false, PositionFlags | wxALL);
376  return pBtn;
377 }
378 
379 wxChoice * ShuttleGuiBase::AddChoice( const wxString &Prompt, const wxString &Selected, const wxArrayString * pChoices )
380 {
381  HandleOptionality( Prompt );
382  AddPrompt( Prompt );
383  UseUpId();
384  if( mShuttleMode != eIsCreating )
385  return wxDynamicCast(wxWindow::FindWindowById( miId, mpDlg), wxChoice);
386  wxChoice * pChoice;
387  miProp=0;
388 
389  mpWind = pChoice = safenew wxChoice(
390  GetParent(),
391  miId,
392  wxDefaultPosition,
393  wxDefaultSize,
394  *pChoices,
395  Style( 0 ) );
396 
397  pChoice->SetSizeHints( 180,-1);// Use -1 for 'default size' - Platform specific.
398  pChoice->SetName(wxStripMenuCodes(Prompt));
399  pChoice->SetStringSelection( Selected );
400 
401  UpdateSizers();
402  return pChoice;
403 }
404 
405 void ShuttleGuiBase::AddFixedText(const wxString &Str, bool bCenter)
406 {
407  UseUpId();
408  if( mShuttleMode != eIsCreating )
409  return;
410  mpWind = safenew wxStaticText(GetParent(), miId, Str, wxDefaultPosition, wxDefaultSize,
411  Style( wxALIGN_LEFT ));
412  mpWind->SetName(wxStripMenuCodes(Str)); // fix for bug 577 (NVDA/Narrator screen readers do not read static text in dialogs)
413  if( bCenter )
414  {
415  miProp=1;
416  UpdateSizersC();
417  }
418  else
419  UpdateSizers();
420 }
421 
422 wxStaticText * ShuttleGuiBase::AddVariableText(const wxString &Str, bool bCenter, int PositionFlags)
423 {
424  UseUpId();
425  if( mShuttleMode != eIsCreating )
426  return wxDynamicCast(wxWindow::FindWindowById( miId, mpDlg), wxStaticText);
427 
428  wxStaticText *pStatic;
429  mpWind = pStatic = safenew wxStaticText(GetParent(), miId, Str, wxDefaultPosition, wxDefaultSize,
430  Style( wxALIGN_LEFT ));
431  mpWind->SetName(wxStripMenuCodes(Str)); // fix for bug 577 (NVDA/Narrator screen readers do not read static text in dialogs)
432  if( bCenter )
433  {
434  miProp=1;
435  if( PositionFlags )
436  UpdateSizersCore( false, PositionFlags );
437  else
438  UpdateSizersC();
439  }
440  else
441  if( PositionFlags )
442  UpdateSizersCore( false, PositionFlags );
443  else
444  UpdateSizers();
445  return pStatic;
446 }
447 
448 wxComboBox * ShuttleGuiBase::AddCombo( const wxString &Prompt, const wxString &Selected,const wxArrayString * pChoices, long style )
449 {
450  HandleOptionality( Prompt );
451  AddPrompt( Prompt );
452  UseUpId();
453  if( mShuttleMode != eIsCreating )
454  return wxDynamicCast(wxWindow::FindWindowById( miId, mpDlg), wxComboBox);
455  wxComboBox * pCombo;
456  miProp=0;
457 
458  int n = pChoices->GetCount();
459  if( n>50 ) n=50;
460  int i;
461  wxString Choices[50];
462  for(i=0;i<n;i++)
463  {
464  Choices[i] = (*pChoices)[i];
465  }
466 
467  mpWind = pCombo = safenew wxComboBox(GetParent(), miId, Selected, wxDefaultPosition, wxDefaultSize,
468  n, Choices, Style( style ));
469  mpWind->SetName(wxStripMenuCodes(Prompt));
470 
471  UpdateSizers();
472  return pCombo;
473 }
474 
475 
476 wxRadioButton * ShuttleGuiBase::AddRadioButton(const wxString &Prompt)
477 {
480  UseUpId();
481  if( mShuttleMode != eIsCreating )
482  return wxDynamicCast(wxWindow::FindWindowById( miId, mpDlg), wxRadioButton);
483  wxRadioButton * pRad;
484  mpWind = pRad = safenew wxRadioButton(GetParent(), miId, Prompt,
485  wxDefaultPosition, wxDefaultSize, Style( wxRB_GROUP ) );
486  mpWind->SetName(wxStripMenuCodes(Prompt));
487  pRad->SetValue(true );
488  UpdateSizers();
489  return pRad;
490 }
491 
492 wxRadioButton * ShuttleGuiBase::AddRadioButtonToGroup(const wxString &Prompt)
493 {
494  UseUpId();
495  if( mShuttleMode != eIsCreating )
496  return wxDynamicCast(wxWindow::FindWindowById( miId, mpDlg), wxRadioButton);
497  wxRadioButton * pRad;
498  mpWind = pRad = safenew wxRadioButton(GetParent(), miId, Prompt,
499  wxDefaultPosition, wxDefaultSize, Style( 0 ) );
500  mpWind->SetName(wxStripMenuCodes(Prompt));
501  UpdateSizers();
502  return pRad;
503 }
504 
505 wxSlider * ShuttleGuiBase::AddSlider(const wxString &Prompt, int pos, int Max, int Min)
506 {
507  HandleOptionality( Prompt );
508  AddPrompt( Prompt );
509  UseUpId();
510  if( mShuttleMode != eIsCreating )
511  return wxDynamicCast(wxWindow::FindWindowById( miId, mpDlg), wxSlider);
512  wxSlider * pSlider;
513  mpWind = pSlider = safenew wxSlider(GetParent(), miId,
514  pos, Min, Max,
515  wxDefaultPosition, wxDefaultSize,
516  Style( wxSL_HORIZONTAL | wxSL_LABELS | wxSL_AUTOTICKS )
517  );
518 #if wxUSE_ACCESSIBILITY
519  // so that name can be set on a standard control
520  mpWind->SetAccessible(safenew WindowAccessible(mpWind));
521 #endif
522  mpWind->SetName(wxStripMenuCodes(Prompt));
523  miProp=1;
524  UpdateSizers();
525  return pSlider;
526 }
527 
528 wxSpinCtrl * ShuttleGuiBase::AddSpinCtrl(const wxString &Prompt, int Value, int Max, int Min)
529 {
530  HandleOptionality( Prompt );
531  AddPrompt( Prompt );
532  UseUpId();
533  if( mShuttleMode != eIsCreating )
534  return wxDynamicCast(wxWindow::FindWindowById( miId, mpDlg), wxSpinCtrl);
535  wxSpinCtrl * pSpinCtrl;
536  mpWind = pSpinCtrl = safenew wxSpinCtrl(GetParent(), miId,
537  wxEmptyString,
538  wxDefaultPosition, wxDefaultSize,
539  Style( wxSP_VERTICAL | wxSP_ARROW_KEYS ),
540  Min, Max, Value
541  );
542  mpWind->SetName(wxStripMenuCodes(Prompt));
543  miProp=1;
544  UpdateSizers();
545  return pSpinCtrl;
546 }
547 
548 wxTextCtrl * ShuttleGuiBase::AddTextBox(const wxString &Caption, const wxString &Value, const int nChars)
549 {
550  HandleOptionality( Caption );
551  AddPrompt( Caption );
552  UseUpId();
553  if( mShuttleMode != eIsCreating )
554  return wxDynamicCast(wxWindow::FindWindowById( miId, mpDlg), wxTextCtrl);
555  wxTextCtrl * pTextCtrl;
556  wxSize Size(wxDefaultSize);
557  if( nChars > 0 )
558  {
559  Size.SetWidth( nChars *5 );
560  }
561  miProp=0;
562 
563 #ifdef EXPERIMENTAL_RIGHT_ALIGNED_TEXTBOXES
564  long flags = wxTE_RIGHT;
565 #else
566  long flags = wxTE_LEFT;
567 #endif
568 
569  mpWind = pTextCtrl = safenew wxTextCtrl(GetParent(), miId, Value,
570  wxDefaultPosition, Size, Style( flags ));
571 #if wxUSE_ACCESSIBILITY
572  // so that name can be set on a standard control
573  mpWind->SetAccessible(safenew WindowAccessible(mpWind));
574 #endif
575  mpWind->SetName(wxStripMenuCodes(Caption));
576  UpdateSizers();
577  return pTextCtrl;
578 }
579 
580 wxTextCtrl * ShuttleGuiBase::AddNumericTextBox(const wxString &Caption, const wxString &Value, const int nChars)
581 {
582  HandleOptionality( Caption );
583  AddPrompt( Caption );
584  UseUpId();
585  if( mShuttleMode != eIsCreating )
586  return wxDynamicCast(wxWindow::FindWindowById( miId, mpDlg), wxTextCtrl);
587  wxTextCtrl * pTextCtrl;
588  wxSize Size(wxDefaultSize);
589  if( nChars > 0 )
590  {
591  Size.SetWidth( nChars *5 );
592  }
593  miProp=0;
594 
595 #ifdef EXPERIMENTAL_RIGHT_ALIGNED_TEXTBOXES
596  long flags = wxTE_RIGHT;
597 #else
598  long flags = wxTE_LEFT;
599 #endif
600 
601  wxTextValidator Validator(wxFILTER_NUMERIC);
602  mpWind = pTextCtrl = safenew wxTextCtrl(GetParent(), miId, Value,
603  wxDefaultPosition, Size, Style( flags ),
604  Validator // It's OK to pass this. It will be cloned.
605  );
606 #if wxUSE_ACCESSIBILITY
607  // so that name can be set on a standard control
608  mpWind->SetAccessible(safenew WindowAccessible(mpWind));
609 #endif
610  mpWind->SetName(wxStripMenuCodes(Caption));
611  UpdateSizers();
612  return pTextCtrl;
613 }
614 
616 wxTextCtrl * ShuttleGuiBase::AddTextWindow(const wxString &Value)
617 {
618  UseUpId();
619  if( mShuttleMode != eIsCreating )
620  return wxDynamicCast(wxWindow::FindWindowById( miId, mpDlg), wxTextCtrl);
621  wxTextCtrl * pTextCtrl;
622  SetProportions( 1 );
623  mpWind = pTextCtrl = safenew wxTextCtrl(GetParent(), miId, Value,
624  wxDefaultPosition, wxDefaultSize, Style( wxTE_MULTILINE ));
625 #if wxUSE_ACCESSIBILITY
626  // so that name can be set on a standard control
627  mpWind->SetAccessible(safenew WindowAccessible(mpWind));
628 #endif
629  UpdateSizers();
630  // Start off at start of window...
631  pTextCtrl->SetInsertionPoint( 0 );
632  pTextCtrl->ShowPosition( 0 );
633  return pTextCtrl;
634 }
635 
637 void ShuttleGuiBase::AddConstTextBox(const wxString &Prompt, const wxString &Value)
638 {
639  HandleOptionality( Prompt );
640  AddPrompt( Prompt );
641  UseUpId();
642  if( mShuttleMode != eIsCreating )
643  return;
644 // return wxDynamicCast(wxWindow::FindWindowById( miId, mpDlg), wx);
645  miProp=0;
646  UpdateSizers();
647  miProp=0;
648  mpWind = safenew wxStaticText(GetParent(), miId, Value, wxDefaultPosition, wxDefaultSize,
649  Style( 0 ));
650  mpWind->SetName(Value); // fix for bug 577 (NVDA/Narrator screen readers do not read static text in dialogs)
651  UpdateSizers();
652 }
653 
654 wxListBox * ShuttleGuiBase::AddListBox(const wxArrayString * pChoices, long style)
655 {
656  UseUpId();
657  if( mShuttleMode != eIsCreating )
658  return wxDynamicCast(wxWindow::FindWindowById( miId, mpDlg), wxListBox);
659  wxListBox * pListBox;
660  SetProportions( 1 );
661  mpWind = pListBox = safenew wxListBox(GetParent(), miId,
662  wxDefaultPosition, wxDefaultSize,*pChoices, style);
663  pListBox->SetMinSize( wxSize( 120,150 ));
664  UpdateSizers();
665  return pListBox;
666 }
667 
668 
670 {
671  UseUpId();
672  if( mShuttleMode != eIsCreating )
673  return wxDynamicCast(wxWindow::FindWindowById( miId, mpDlg), wxListCtrl);
674  wxListCtrl * pListCtrl;
675  SetProportions( 1 );
676  mpWind = pListCtrl = safenew wxListCtrl(GetParent(), miId,
677  wxDefaultPosition, wxDefaultSize, Style( wxLC_ICON ));
678  pListCtrl->SetMinSize( wxSize( 120,150 ));
679  UpdateSizers();
680  return pListCtrl;
681 }
682 
684 {
685  UseUpId();
686  if( mShuttleMode != eIsCreating )
687  return wxDynamicCast(wxWindow::FindWindowById( miId, mpDlg), wxGrid);
688  wxGrid * pGrid;
689  SetProportions( 1 );
690  mpWind = pGrid = safenew wxGrid(GetParent(), miId, wxDefaultPosition,
691  wxDefaultSize, Style( wxWANTS_CHARS ));
692  pGrid->SetMinSize( wxSize( 120, 150 ));
693  UpdateSizers();
694  return pGrid;
695 }
696 
698 {
699  UseUpId();
700  if( mShuttleMode != eIsCreating )
701  return wxDynamicCast(wxWindow::FindWindowById( miId, mpDlg), wxListCtrl);
702  wxListCtrl * pListCtrl;
703  SetProportions( 1 );
704  mpWind = pListCtrl = safenew wxListCtrl(GetParent(), miId,
705  wxDefaultPosition, wxSize(230,120),//wxDefaultSize,
706  Style( wxLC_REPORT | wxLC_HRULES | wxLC_VRULES | wxSUNKEN_BORDER ));
707 // pListCtrl->SetMinSize( wxSize( 120,150 ));
708  UpdateSizers();
709  return pListCtrl;
710 }
711 
713 {
714  UseUpId();
715  if( mShuttleMode != eIsCreating )
716  return wxDynamicCast(wxWindow::FindWindowById( miId, mpDlg), wxTreeCtrl);
717  wxTreeCtrl * pTreeCtrl;
718  SetProportions( 1 );
719  mpWind = pTreeCtrl = safenew wxTreeCtrl(GetParent(), miId, wxDefaultPosition, wxDefaultSize,
720  Style( wxTR_HAS_BUTTONS ));
721  pTreeCtrl->SetMinSize( wxSize( 120,650 ));
722  UpdateSizers();
723  return pTreeCtrl;
724 }
725 
726 void ShuttleGuiBase::AddIcon(wxBitmap *pBmp)
727 {
728  UseUpId();
729  if( mShuttleMode != eIsCreating )
730 // return wxDynamicCast(wxWindow::FindWindowById( miId, mpDlg), wx);
731  return;
732  wxBitmapButton * pBtn;
733  mpWind = pBtn = safenew wxBitmapButton(GetParent(), miId, *pBmp,
734  wxDefaultPosition, wxDefaultSize, Style( wxBU_AUTODRAW ) );
735  pBtn->SetWindowStyle( 0 );
736  UpdateSizersC();
737 }
738 
740 {
741  miPropSetByUser = iProp;
742  return *this;
743 }
744 
746 {
747  auto menuBar = std::make_unique<wxMenuBar>();
748  mpMenuBar = menuBar.get();
749 
750  wxFrame * pFrame = (wxFrame*)mpParent;
751  pFrame->SetThemeEnabled( true );
752  mpMenuBar->SetThemeEnabled( true );
753  pFrame->SetMenuBar(menuBar.release());
754 
755  return mpMenuBar;
756 }
757 
758 wxMenu * ShuttleGuiBase::AddMenu( const wxString & Title )
759 {
760  mpMenuBar->Append( (mpMenu = safenew wxMenu), Title );
761  return mpMenu;
762 }
763 
764 
765 
771 wxStaticBox * ShuttleGuiBase::StartStatic(const wxString &Str, int iProp)
772 {
773  UseUpId();
774  if( mShuttleMode != eIsCreating )
775  return NULL;
776  wxStaticBox * pBox = safenew wxStaticBox(GetParent(), miId,
777  Str );
778  pBox->SetLabel( Str );
779  pBox->SetName(wxStripMenuCodes(Str));
780  mpSubSizer = std::make_unique<wxStaticBoxSizer>(
781  pBox,
782  wxVERTICAL );
783  miSizerProp = iProp;
784  UpdateSizers();
785  return pBox;
786 }
787 
789 {
790  if( mShuttleMode != eIsCreating )
791  return;
792  PopSizer();
793 }
794 
803 wxScrolledWindow * ShuttleGuiBase::StartScroller(int iStyle)
804 {
805  UseUpId();
806  if( mShuttleMode != eIsCreating )
807  return wxDynamicCast(wxWindow::FindWindowById( miId, mpDlg), wxScrolledWindow);
808 
809  wxScrolledWindow * pScroller;
810  mpWind = pScroller = safenew wxScrolledWindow(GetParent(), miId, wxDefaultPosition, wxDefaultSize,
811  Style( wxSUNKEN_BORDER ) );
812  pScroller->SetScrollRate( 20,20 );
813 
814  // This fools NVDA into not saying "Panel" when the dialog gets focus
815  pScroller->SetName(wxT("\a"));
816  pScroller->SetLabel(wxT("\a"));
817 
818  SetProportions( 1 );
819  if( iStyle==2 )
820  {
822  }
823  else
824  {
825  // mpWind->SetBackgroundColour(wxSystemSettings::GetColour(wxSYS_COLOUR_MENUBAR));
826  UpdateSizers(); // adds window in to current sizer.
827  }
828 
829  // create a sizer within the window...
830  mpParent = pScroller;
831  pScroller->SetSizer(mpSizer = safenew wxBoxSizer(wxVERTICAL));
832  PushSizer();
833  return pScroller;
834 }
835 
837 {
838  if( mShuttleMode != eIsCreating )
839  return;
840  wxSize ScrollSize = mpSizer->GetMinSize();
841  int yMin = ScrollSize.y+4;
842  int xMin = ScrollSize.x+4;
843  if( yMin > 400)
844  {
845  yMin = 400;
846  xMin+=50;// extra space for vertical scrollbar.
847  }
848 
849  mpParent->SetMinSize( wxSize(xMin, yMin) );
850 
851  PopSizer();
852  mpParent = mpParent->GetParent();
853 }
854 
855 wxPanel * ShuttleGuiBase::StartPanel(int iStyle)
856 {
857  UseUpId();
858  if( mShuttleMode != eIsCreating )
859  return wxDynamicCast(wxWindow::FindWindowById( miId, mpDlg), wxPanel);
860  wxPanel * pPanel;
861  mpWind = pPanel = safenew wxPanelWrapper( GetParent(), miId, wxDefaultPosition, wxDefaultSize,
862  Style( wxNO_BORDER ));
863 
864  if( iStyle != 0 )
865  {
866  mpWind->SetBackgroundColour(
867  iStyle==1
868  ? wxColour( 190,200,230) :
869  wxSystemSettings::GetColour(wxSYS_COLOUR_WINDOW)
870  );
871  }
872  SetProportions(0);
873  miBorder=2;
874  UpdateSizers(); // adds window in to current sizer.
875 
876  // create a sizer within the window...
877  mpParent = pPanel;
878  pPanel->SetSizer(mpSizer = safenew wxBoxSizer(wxVERTICAL));
879  PushSizer();
880  return pPanel;
881 }
882 
884 {
885  if( mShuttleMode != eIsCreating )
886  return;
887  PopSizer();
888  mpParent = mpParent->GetParent();
889 }
890 
892 {
893  UseUpId();
894  if( mShuttleMode != eIsCreating )
895  return wxDynamicCast(wxWindow::FindWindowById( miId, mpDlg), wxNotebook);
896  wxNotebook * pNotebook;
897  mpWind = pNotebook = safenew wxNotebook(GetParent(),
898  miId, wxDefaultPosition, wxDefaultSize, Style( 0 ));
899  SetProportions( 1 );
900  UpdateSizers();
901  mpParent = pNotebook;
902  return pNotebook;
903 }
904 
906 {
907  //PopSizer();
908  mpParent = mpParent->GetParent();
909 }
910 
911 
913 {
914  if( mShuttleMode != eIsCreating )
915  return NULL;
916 // return wxDynamicCast(wxWindow::FindWindowById( miId, mpDlg), wx);
917  wxNotebook * pNotebook = (wxNotebook*)mpParent;
919  pPage->SetName(Name);
920 
921  pNotebook->AddPage(
922  pPage,
923  Name);
924  PushSizer();
925 
926  SetProportions( 1 );
927  mpParent = pPage;
928  pPage->SetSizer(mpSizer = safenew wxBoxSizer(wxVERTICAL));
929  mpSizer->SetMinSize(250, 500);
930  // UpdateSizers();
931  return pPage;
932 }
933 
934 void ShuttleGuiBase::StartNotebookPage( const wxString & Name, wxNotebookPage * pPage )
935 {
936  if( mShuttleMode != eIsCreating )
937  return;
938 // return wxDynamicCast(wxWindow::FindWindowById( miId, mpDlg), wx);
939  wxNotebook * pNotebook = (wxNotebook*)mpParent;
940 // wxNotebookPage * pPage = safenew wxPanelWrapper(GetParent());
941  pPage->Create( mpParent, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL, wxT("panel"));
942  pPage->SetName(Name);
943 
944  pNotebook->AddPage(
945  pPage,
946  Name);
947  PushSizer();
948 
949  SetProportions( 1 );
950  mpParent = pPage;
951  pPage->SetSizer(mpSizer = safenew wxBoxSizer(wxVERTICAL));
952  mpSizer->SetMinSize(250, 500);
953  // UpdateSizers();
954 }
955 
957 {
958  if( mShuttleMode != eIsCreating )
959  return;
960  PopSizer();
961  mpParent = mpParent->GetParent();
962 }
963 
964 // Doxygen description is at the start of the file
965 // this is a wxPanel with erase background disabled.
966 class InvisiblePanel final : public wxPanelWrapper
967 {
968 public:
970  wxWindow* parent,
971  wxWindowID id = -1,
972  const wxPoint& pos = wxDefaultPosition,
973  const wxSize& size = wxDefaultSize,
974  long style = wxTAB_TRAVERSAL ) :
975  wxPanelWrapper( parent, id, pos, size, style )
976  {
977  };
979  void OnPaint( wxPaintEvent &event );
980  void OnErase(wxEraseEvent &/*evt*/){;};
981  DECLARE_EVENT_TABLE()
982 };
983 
984 
985 BEGIN_EVENT_TABLE(InvisiblePanel, wxPanelWrapper)
986 // EVT_PAINT(InvisiblePanel::OnPaint)
987  EVT_ERASE_BACKGROUND( InvisiblePanel::OnErase)
989 
990 void InvisiblePanel::OnPaint( wxPaintEvent & WXUNUSED(event))
991 {
992  // Don't repaint my background.
993  wxPaintDC dc(this);
994  // event.Skip(); // swallow the paint event.
995 }
996 
998 {
999  UseUpId();
1000  if( mShuttleMode != eIsCreating )
1001  return wxDynamicCast(wxWindow::FindWindowById( miId, mpDlg), wxPanel);
1002  wxPanel * pPanel;
1003  mpWind = pPanel = safenew wxPanelWrapper(GetParent(), miId, wxDefaultPosition, wxDefaultSize,
1004  wxNO_BORDER);
1005 
1006  mpWind->SetBackgroundColour(
1007  wxSystemSettings::GetColour(wxSYS_COLOUR_BTNFACE)
1008  );
1009  SetProportions( 1 );
1010  miBorder=0;
1011  UpdateSizers(); // adds window in to current sizer.
1012 
1013  // create a sizer within the window...
1014  mpParent = pPanel;
1015  pPanel->SetSizer(mpSizer = safenew wxBoxSizer(wxVERTICAL));
1016  PushSizer();
1017  return pPanel;
1018 }
1019 
1021 {
1022  EndPanel();
1023 }
1024 
1025 
1032 void ShuttleGuiBase::StartHorizontalLay( int PositionFlags, int iProp)
1033 {
1034  if( mShuttleMode != eIsCreating )
1035  return;
1036  miSizerProp=iProp;
1037  mpSubSizer = std::make_unique<wxBoxSizer>( wxHORIZONTAL );
1038  UpdateSizersCore( false, PositionFlags | wxALL );
1039 }
1040 
1042 {
1043  if( mShuttleMode != eIsCreating )
1044  return;
1045  PopSizer();
1046 }
1047 
1049 {
1050  if( mShuttleMode != eIsCreating )
1051  return;
1052  miSizerProp=iProp;
1053  mpSubSizer = std::make_unique<wxBoxSizer>( wxVERTICAL );
1054  UpdateSizers();
1055 }
1056 
1057 void ShuttleGuiBase::StartVerticalLay(int PositionFlags, int iProp)
1058 {
1059  if( mShuttleMode != eIsCreating )
1060  return;
1061  miSizerProp=iProp;
1062  mpSubSizer = std::make_unique<wxBoxSizer>( wxVERTICAL );
1063  UpdateSizersCore( false, PositionFlags | wxALL );
1064 }
1065 
1067 {
1068  if( mShuttleMode != eIsCreating )
1069  return;
1070  PopSizer();
1071 }
1072 
1073 void ShuttleGuiBase::StartMultiColumn(int nCols, int PositionFlags)
1074 {
1075  if( mShuttleMode != eIsCreating )
1076  return;
1077  mpSubSizer = std::make_unique<wxFlexGridSizer>( nCols );
1078  UpdateSizersCore( false, PositionFlags | wxALL );
1079 }
1080 
1082 {
1083  if( mShuttleMode != eIsCreating )
1084  return;
1085  PopSizer();
1086 }
1087 
1090 void ShuttleGuiBase::DoDataShuttle( const wxString &Name, WrappedType & WrappedRef )
1091 {
1092  wxASSERT( mpShuttle );
1093  mpShuttle->TransferWrappedType( Name, WrappedRef );
1094 }
1095 
1096 //-----------------------------------------------------------------------//
1097 
1098 // We now have a group of tie functions which are generic in the type
1099 // they bind to (i.e. WrappedType).
1100 // The type specific versions are much shorter and are later
1101 // in this file.
1102 wxCheckBox * ShuttleGuiBase::TieCheckBox(const wxString &Prompt, WrappedType & WrappedRef)
1103 {
1104  HandleOptionality( Prompt );
1105  // The Add function does a UseUpId(), so don't do it here in that case.
1106  if( mShuttleMode == eIsCreating )
1107  return AddCheckBox( Prompt, WrappedRef.ReadAsString());
1108 
1109  UseUpId();
1110 
1111  wxWindow * pWnd = wxWindow::FindWindowById( miId, mpDlg);
1112  wxCheckBox * pCheckBox = wxDynamicCast(pWnd, wxCheckBox);
1113 
1114  switch( mShuttleMode )
1115  {
1116  // IF setting internal storage from the controls.
1117  case eIsGettingMetadata:
1118  break;
1119  case eIsGettingFromDialog:
1120  {
1121  wxASSERT( pCheckBox );
1122  WrappedRef.WriteToAsBool( pCheckBox->GetValue() );
1123  }
1124  break;
1125  case eIsSettingToDialog:
1126  {
1127  wxASSERT( pCheckBox );
1128  pCheckBox->SetValue( WrappedRef.ReadAsBool() );
1129  }
1130  break;
1131  // IF Saving settings to external storage...
1132  // or IF Getting settings from external storage.
1133  case eIsSavingViaShuttle:
1134  case eIsGettingViaShuttle:
1135  DoDataShuttle( Prompt, WrappedRef );
1136  break;
1137  default:
1138  wxASSERT( false );
1139  break;
1140  }
1141  return pCheckBox;
1142 }
1143 
1144 wxCheckBox * ShuttleGuiBase::TieCheckBoxOnRight(const wxString &Prompt, WrappedType & WrappedRef)
1145 {
1146  HandleOptionality( Prompt );
1147  // The Add function does a UseUpId(), so don't do it here in that case.
1148  if( mShuttleMode == eIsCreating )
1149  return AddCheckBoxOnRight( Prompt, WrappedRef.ReadAsString());
1150  UseUpId();
1151 
1152  wxWindow * pWnd = wxWindow::FindWindowById( miId, mpDlg);
1153  wxCheckBox * pCheckBox = wxDynamicCast(pWnd, wxCheckBox);
1154 
1155  switch( mShuttleMode )
1156  {
1157  // IF setting internal storage from the controls.
1158  case eIsGettingMetadata:
1159  break;
1160  case eIsGettingFromDialog:
1161  {
1162  wxASSERT( pCheckBox );
1163  WrappedRef.WriteToAsBool( pCheckBox->GetValue() );
1164  }
1165  break;
1166  case eIsSettingToDialog:
1167  {
1168  wxASSERT( pCheckBox );
1169  pCheckBox->SetValue( WrappedRef.ReadAsBool() );
1170  }
1171  break;
1172  // IF Saving settings to external storage...
1173  // or IF Getting settings from external storage.
1174  case eIsSavingViaShuttle:
1175  case eIsGettingViaShuttle:
1176  DoDataShuttle( Prompt, WrappedRef );
1177  break;
1178  default:
1179  wxASSERT( false );
1180  break;
1181  }
1182  return pCheckBox;
1183 }
1184 
1185 wxSpinCtrl * ShuttleGuiBase::TieSpinCtrl( const wxString &Prompt, WrappedType & WrappedRef, const int max, const int min )
1186 {
1187  HandleOptionality( Prompt );
1188  // The Add function does a UseUpId(), so don't do it here in that case.
1189  if( mShuttleMode == eIsCreating )
1190  return AddSpinCtrl( Prompt, WrappedRef.ReadAsInt(), max, min );
1191 
1192  UseUpId();
1193  wxSpinCtrl * pSpinCtrl=NULL;
1194 
1195  wxWindow * pWnd = wxWindow::FindWindowById( miId, mpDlg);
1196  pSpinCtrl = wxDynamicCast(pWnd, wxSpinCtrl);
1197 
1198  switch( mShuttleMode )
1199  {
1200  // IF setting internal storage from the controls.
1201  case eIsGettingMetadata:
1202  break;
1203  case eIsGettingFromDialog:
1204  {
1205  wxASSERT( pSpinCtrl );
1206  WrappedRef.WriteToAsInt( pSpinCtrl->GetValue() );
1207  }
1208  break;
1209  case eIsSettingToDialog:
1210  {
1211  wxASSERT( pSpinCtrl );
1212  pSpinCtrl->SetValue( WrappedRef.ReadAsInt() );
1213  }
1214  break;
1215  // IF Saving settings to external storage...
1216  // or IF Getting settings from external storage.
1217  case eIsGettingViaShuttle:
1218  case eIsSavingViaShuttle:
1219  DoDataShuttle( Prompt, WrappedRef );
1220  break;
1221  default:
1222  wxASSERT( false );
1223  break;
1224  }
1225  return pSpinCtrl;
1226 }
1227 
1228 wxTextCtrl * ShuttleGuiBase::TieTextBox( const wxString &Prompt, WrappedType & WrappedRef, const int nChars)
1229 {
1230  HandleOptionality( Prompt );
1231  // The Add function does a UseUpId(), so don't do it here in that case.
1232  if( mShuttleMode == eIsCreating )
1233  return AddTextBox( Prompt, WrappedRef.ReadAsString(), nChars );
1234 
1235  UseUpId();
1236  wxTextCtrl * pTextBox=NULL;
1237 
1238  wxWindow * pWnd = wxWindow::FindWindowById( miId, mpDlg);
1239  pTextBox = wxDynamicCast(pWnd, wxTextCtrl);
1240 
1241  switch( mShuttleMode )
1242  {
1243  // IF setting internal storage from the controls.
1244  case eIsGettingMetadata:
1245  break;
1246  case eIsGettingFromDialog:
1247  {
1248  wxASSERT( pTextBox );
1249  WrappedRef.WriteToAsString( pTextBox->GetValue() );
1250  }
1251  break;
1252  case eIsSettingToDialog:
1253  {
1254  wxASSERT( pTextBox );
1255  pTextBox->SetValue( WrappedRef.ReadAsString() );
1256  }
1257  break;
1258  // IF Saving settings to external storage...
1259  // or IF Getting settings from external storage.
1260  case eIsGettingViaShuttle:
1261  case eIsSavingViaShuttle:
1262  DoDataShuttle( Prompt, WrappedRef );
1263  break;
1264  default:
1265  wxASSERT( false );
1266  break;
1267  }
1268  return pTextBox;
1269 }
1270 
1271 wxTextCtrl * ShuttleGuiBase::TieNumericTextBox( const wxString &Prompt, WrappedType & WrappedRef, const int nChars)
1272 {
1273  HandleOptionality( Prompt );
1274  // The Add function does a UseUpId(), so don't do it here in that case.
1275  if( mShuttleMode == eIsCreating )
1276  return AddNumericTextBox( Prompt, WrappedRef.ReadAsString(), nChars );
1277 
1278  UseUpId();
1279  wxTextCtrl * pTextBox=NULL;
1280 
1281  wxWindow * pWnd = wxWindow::FindWindowById( miId, mpDlg);
1282  pTextBox = wxDynamicCast(pWnd, wxTextCtrl);
1283 
1284  switch( mShuttleMode )
1285  {
1286  // IF setting internal storage from the controls.
1287  case eIsGettingMetadata:
1288  break;
1289  case eIsGettingFromDialog:
1290  {
1291  wxASSERT( pTextBox );
1292  WrappedRef.WriteToAsString( pTextBox->GetValue() );
1293  }
1294  break;
1295  case eIsSettingToDialog:
1296  {
1297  wxASSERT( pTextBox );
1298  pTextBox->SetValue( WrappedRef.ReadAsString() );
1299  }
1300  break;
1301  // IF Saving settings to external storage...
1302  // or IF Getting settings from external storage.
1303  case eIsGettingViaShuttle:
1304  case eIsSavingViaShuttle:
1305  DoDataShuttle( Prompt, WrappedRef );
1306  break;
1307  default:
1308  wxASSERT( false );
1309  break;
1310  }
1311  return pTextBox;
1312 }
1313 
1314 wxSlider * ShuttleGuiBase::TieSlider( const wxString &Prompt, WrappedType & WrappedRef, const int max, int min )
1315 {
1316  HandleOptionality( Prompt );
1317  // The Add function does a UseUpId(), so don't do it here in that case.
1318  if( mShuttleMode != eIsCreating )
1319  UseUpId();
1320  wxSlider * pSlider=NULL;
1321  switch( mShuttleMode )
1322  {
1323  case eIsCreating:
1324  {
1325  pSlider = AddSlider( Prompt, WrappedRef.ReadAsInt(), max, min );
1326  }
1327  break;
1328  // IF setting internal storage from the controls.
1329  case eIsGettingMetadata:
1330  break;
1331  case eIsGettingFromDialog:
1332  {
1333  wxWindow * pWnd = wxWindow::FindWindowById( miId, mpDlg);
1334  pSlider = wxDynamicCast(pWnd, wxSlider);
1335  wxASSERT( pSlider );
1336  WrappedRef.WriteToAsInt( pSlider->GetValue() );
1337  }
1338  break;
1339  case eIsSettingToDialog:
1340  {
1341  wxWindow * pWnd = wxWindow::FindWindowById( miId, mpDlg);
1342  pSlider = wxDynamicCast(pWnd, wxSlider);
1343  wxASSERT( pSlider );
1344  pSlider->SetValue( WrappedRef.ReadAsInt() );
1345  }
1346  break;
1347  // IF Saving settings to external storage...
1348  // or IF Getting settings from external storage.
1349  case eIsSavingViaShuttle:
1350  case eIsGettingViaShuttle:
1351  DoDataShuttle( Prompt, WrappedRef );
1352  break;
1353  default:
1354  wxASSERT( false );
1355  break;
1356  }
1357  return pSlider;
1358 }
1359 
1360 
1362  const wxString &Prompt,
1363  WrappedType &WrappedRef,
1364  const wxArrayString * pChoices )
1365 {
1366  HandleOptionality( Prompt );
1367 
1368  // The Add function does a UseUpId(), so don't do it here in that case.
1369  if( mShuttleMode != eIsCreating )
1370  UseUpId();
1371 
1372  wxChoice * pChoice=NULL;
1373  switch( mShuttleMode )
1374  {
1375  case eIsCreating:
1376  {
1377  if( WrappedRef.IsString() )
1378  pChoice = AddChoice( Prompt, WrappedRef.ReadAsString(), pChoices );
1379  else
1380  {
1381  wxString Temp;
1382  if( pChoices && ( WrappedRef.ReadAsInt() < (int)pChoices->GetCount() ) )
1383  {
1384  Temp = (*pChoices)[WrappedRef.ReadAsInt()];
1385  }
1386  pChoice = AddChoice( Prompt, Temp, pChoices );
1387  }
1388  }
1389  break;
1390  // IF setting internal storage from the controls.
1391  case eIsGettingMetadata:
1392  break;
1393  case eIsGettingFromDialog:
1394  {
1395  wxWindow * pWnd = wxWindow::FindWindowById( miId, mpDlg);
1396  pChoice = wxDynamicCast(pWnd, wxChoice);
1397  wxASSERT( pChoice );
1398  if( WrappedRef.IsString())
1399  WrappedRef.WriteToAsString( pChoice->GetStringSelection());
1400  else
1401  WrappedRef.WriteToAsInt( pChoice->GetSelection() );
1402  }
1403  break;
1404  case eIsSettingToDialog:
1405  {
1406  wxWindow * pWnd = wxWindow::FindWindowById( miId, mpDlg);
1407  pChoice = wxDynamicCast(pWnd, wxChoice);
1408  wxASSERT( pChoice );
1409  if( WrappedRef.IsString() )
1410  pChoice->SetStringSelection( WrappedRef.ReadAsString() );
1411  else
1412  pChoice->SetSelection( WrappedRef.ReadAsInt() );
1413  }
1414  break;
1415  // IF Saving settings to external storage...
1416  // or IF Getting settings from external storage.
1417  case eIsSavingViaShuttle:
1418  case eIsGettingViaShuttle:
1419  DoDataShuttle( Prompt, WrappedRef );
1420  break;
1421  default:
1422  wxASSERT( false );
1423  break;
1424  }
1425  SetSizeHints(*pChoices);
1426  return pChoice;
1427 }
1428 
1429 wxRadioButton * ShuttleGuiBase::TieRadioButton(const wxString &Prompt, WrappedType & WrappedRef)
1430 {
1431  wxASSERT( mRadioCount >= 0); // Did you remember to use StartRadioButtonGroup() ?
1432  mRadioCount++;
1433  UseUpId();
1434  wxRadioButton * pRadioButton = NULL;
1435 
1436  switch( mShuttleMode )
1437  {
1438  case eIsCreating:
1439  {
1440  mpWind = pRadioButton = safenew wxRadioButton(GetParent(), miId, Prompt,
1441  wxDefaultPosition, wxDefaultSize,
1442  (mRadioCount==1)?wxRB_GROUP:0);
1443  pRadioButton->SetValue(WrappedRef.ValuesMatch( mRadioValue ));
1444  pRadioButton->SetName(wxStripMenuCodes(Prompt));
1445  UpdateSizers();
1446  }
1447  break;
1448  case eIsGettingMetadata:
1449  break;
1450  case eIsGettingFromDialog:
1451  {
1452  wxWindow * pWnd = wxWindow::FindWindowById( miId, mpDlg);
1453  pRadioButton = wxDynamicCast(pWnd, wxRadioButton);
1454  wxASSERT( pRadioButton );
1455  if( pRadioButton->GetValue() )
1456  {
1457  mRadioValue.WriteToAsWrappedType( WrappedRef );
1458  }
1459  }
1460  break;
1461  default:
1462  wxASSERT( false );
1463  break;
1464  }
1465  return pRadioButton;
1466 }
1467 
1471 void ShuttleGuiBase::StartRadioButtonGroup( const wxString & SettingName )
1472 {
1473  wxASSERT( mRadioValue.eWrappedType != eWrappedNotSet );
1474  mSettingName = SettingName;
1475  mRadioCount = 0;
1476  if( mShuttleMode == eIsCreating )
1477  DoDataShuttle( SettingName, mRadioValue );
1478 }
1479 
1483 {
1486  mRadioValue.Init();// Clear it out...
1487  mSettingName = wxT("");
1488  mRadioCount = -1; // So we detect a problem.
1489 }
1490 
1491 //-----------------------------------------------------------------------//
1492 //-- Now we are into type specific Tie() functions.
1493 //-- These are all 'one-step' tie functions.
1494 
1495 wxCheckBox * ShuttleGuiBase::TieCheckBox(const wxString &Prompt, bool &Var)
1496 {
1497  WrappedType WrappedRef( Var );
1498  return TieCheckBox( Prompt, WrappedRef );
1499 }
1500 
1501 // See comment in AddCheckBoxOnRight() for why we have this variant.
1502 wxCheckBox * ShuttleGuiBase::TieCheckBoxOnRight(const wxString &Prompt, bool &Var)
1503 {
1504  // Only odes anything different if it's creating.
1505  WrappedType WrappedRef( Var );
1506  if( mShuttleMode == eIsCreating )
1507  return AddCheckBoxOnRight( Prompt, WrappedRef.ReadAsString() );
1508  return TieCheckBox( Prompt, WrappedRef );
1509 }
1510 
1511 wxSpinCtrl * ShuttleGuiBase::TieSpinCtrl( const wxString &Prompt, int &Value, const int max, const int min )
1512 {
1513  WrappedType WrappedRef(Value);
1514  return TieSpinCtrl( Prompt, WrappedRef, max, min );
1515 }
1516 
1517 wxTextCtrl * ShuttleGuiBase::TieTextBox( const wxString &Prompt, wxString &Selected, const int nChars)
1518 {
1519  WrappedType WrappedRef(Selected);
1520  return TieTextBox( Prompt, WrappedRef, nChars );
1521 }
1522 
1523 wxTextCtrl * ShuttleGuiBase::TieTextBox( const wxString &Prompt, int &Selected, const int nChars)
1524 {
1525  WrappedType WrappedRef( Selected );
1526  return TieTextBox( Prompt, WrappedRef, nChars );
1527 }
1528 
1529 wxTextCtrl * ShuttleGuiBase::TieTextBox( const wxString &Prompt, double &Value, const int nChars)
1530 {
1531  WrappedType WrappedRef( Value );
1532  return TieTextBox( Prompt, WrappedRef, nChars );
1533 }
1534 
1535 wxTextCtrl * ShuttleGuiBase::TieNumericTextBox( const wxString &Prompt, wxString &Selected, const int nChars)
1536 {
1537  WrappedType WrappedRef(Selected);
1538  return TieNumericTextBox( Prompt, WrappedRef, nChars );
1539 }
1540 
1541 wxTextCtrl * ShuttleGuiBase::TieNumericTextBox( const wxString &Prompt, int &Selected, const int nChars)
1542 {
1543  WrappedType WrappedRef( Selected );
1544  return TieNumericTextBox( Prompt, WrappedRef, nChars );
1545 }
1546 
1547 wxTextCtrl * ShuttleGuiBase::TieNumericTextBox( const wxString &Prompt, double &Value, const int nChars)
1548 {
1549  WrappedType WrappedRef( Value );
1550  return TieNumericTextBox( Prompt, WrappedRef, nChars );
1551 }
1552 
1553 wxSlider * ShuttleGuiBase::TieSlider( const wxString &Prompt, int &pos, const int max, const int min )
1554 {
1555  WrappedType WrappedRef( pos );
1556  return TieSlider( Prompt, WrappedRef, max, min );
1557 }
1558 
1559 wxSlider * ShuttleGuiBase::TieSlider( const wxString &Prompt, double &pos, const double max, const double min )
1560 {
1561  WrappedType WrappedRef( pos );
1562  return TieSlider( Prompt, WrappedRef, max, min );
1563 }
1564 
1565 wxSlider * ShuttleGuiBase::TieSlider( const wxString &Prompt, float &pos, const float fMin, const float fMax)
1566 {
1567  const float RoundFix=0.0000001f;
1568  int iVal=(pos-fMin+RoundFix)*100.0/(fMax-fMin);
1569  wxSlider * pWnd = TieSlider( Prompt, iVal, 100 );
1570  pos = iVal*(fMax-fMin)*0.01+fMin;
1571  return pWnd;
1572 }
1573 
1574 wxSlider * ShuttleGuiBase::TieVSlider( const wxString &Prompt, float &pos, const float fMin, const float fMax)
1575 {
1576  int iVal=(pos-fMin)*100.0/(fMax-fMin);
1577 // if( mShuttleMode == eIsCreating )
1578 // {
1579 // return AddVSlider( Prompt, iVal, 100 );
1580 // }
1581  wxSlider * pWnd = TieSlider( Prompt, iVal, 100 );
1582  pos = iVal*(fMax-fMin)*0.01+fMin;
1583  return pWnd;
1584 }
1585 
1587  const wxString &Prompt,
1588  wxString &Selected,
1589  const wxArrayString * pChoices )
1590 {
1591  WrappedType WrappedRef( Selected );
1592  return TieChoice( Prompt, WrappedRef, pChoices );
1593 }
1594 
1596  const wxString &Prompt,
1597  int &Selected,
1598  const wxArrayString * pChoices )
1599 {
1600  WrappedType WrappedRef( Selected );
1601  return TieChoice( Prompt, WrappedRef, pChoices );
1602 }
1603 
1604 //-----------------------------------------------------------------------//
1605 
1606 // ShuttleGui utility functions to look things up in a list.
1607 // If not present, we use the configured default index value.
1608 
1609 //-----------------------------------------------------------------------//
1610 
1612 int ShuttleGuiBase::TranslateToIndex( const wxString &Value, const wxArrayString &Choices )
1613 {
1614  int n = Choices.Index( Value );
1615  if( n== wxNOT_FOUND )
1617  miNoMatchSelector = 0;
1618  return n;
1619 }
1620 
1622 wxString ShuttleGuiBase::TranslateFromIndex( const int nIn, const wxArrayString &Choices )
1623 {
1624  int n = nIn;
1625  if( n== wxNOT_FOUND )
1627  miNoMatchSelector = 0;
1628  if( n < (int)Choices.GetCount() )
1629  {
1630  return Choices[n];
1631  }
1632  return wxT("");
1633 }
1634 
1636 int ShuttleGuiBase::TranslateToIndex( const int Value, const std::vector<int> &Choices )
1637 {
1638  int n = make_iterator_range(Choices).index( Value );
1639  if( n == wxNOT_FOUND )
1641  miNoMatchSelector = 0;
1642  return n;
1643 }
1644 
1646 int ShuttleGuiBase::TranslateFromIndex( const int nIn, const std::vector<int> &Choices )
1647 {
1648  int n = nIn;
1649  if( n== wxNOT_FOUND )
1651  miNoMatchSelector = 0;
1652  if( n < (int)Choices.size() )
1653  {
1654  return Choices[n];
1655  }
1656  return 0;
1657 }
1658 
1659 //-----------------------------------------------------------------------//
1660 
1661 
1662 // ShuttleGui code uses the model that you read into program variables
1663 // and write out from program variables.
1664 
1665 // In programs like Audacity which don't use internal program variables
1666 // you have to do both steps in one go, using variants of the standard
1667 // 'Tie' functions which call the underlying Tie functions twice.
1668 
1669 //----------------------------------------------------------------------//
1670 
1671 
1704 bool ShuttleGuiBase::DoStep( int iStep )
1705 {
1706  // Get value and create
1707  if( mShuttleMode == eIsCreating )
1708  {
1709  return (iStep==1) || (iStep==2);
1710  }
1711  // Like creating, get the value and set.
1713  {
1714  return (iStep==1) || (iStep==2);
1715  }
1717  {
1718  return (iStep==2) || (iStep==3);
1719  }
1721  return iStep ==2;
1722  wxASSERT( false );
1723  return false;
1724 }
1725 
1726 
1730  const wxString &Prompt,
1731  const wxString &SettingName,
1732  const bool bDefault)
1733 {
1734  wxCheckBox * pCheck=NULL;
1735 
1736  bool bValue=bDefault;
1737  WrappedType WrappedRef( bValue );
1738  if( DoStep(1) ) DoDataShuttle( SettingName, WrappedRef );
1739  if( DoStep(2) ) pCheck = TieCheckBox( Prompt, WrappedRef );
1740  if( DoStep(3) ) DoDataShuttle( SettingName, WrappedRef );
1741 
1742  return pCheck;
1743 }
1744 
1748  const wxString &Prompt,
1749  const wxString &SettingName,
1750  const bool bDefault)
1751 {
1752  wxCheckBox * pCheck=NULL;
1753 
1754  bool bValue=bDefault;
1755  WrappedType WrappedRef( bValue );
1756  if( DoStep(1) ) DoDataShuttle( SettingName, WrappedRef );
1757  if( DoStep(2) ) pCheck = TieCheckBoxOnRight( Prompt, WrappedRef );
1758  if( DoStep(3) ) DoDataShuttle( SettingName, WrappedRef );
1759 
1760  return pCheck;
1761 }
1762 
1766  const wxString &Prompt,
1767  const wxString &SettingName,
1768  const int iDefault,
1769  const int max,
1770  const int min)
1771 {
1772  wxSlider * pSlider=NULL;
1773 
1774  int iValue=iDefault;
1775  WrappedType WrappedRef( iValue );
1776  if( DoStep(1) ) DoDataShuttle( SettingName, WrappedRef );
1777  if( DoStep(2) ) pSlider = TieSlider( Prompt, WrappedRef, max, min );
1778  if( DoStep(3) ) DoDataShuttle( SettingName, WrappedRef );
1779 
1780  return pSlider;
1781 }
1782 
1786  const wxString &Prompt,
1787  const wxString &SettingName,
1788  const int Value,
1789  const int max,
1790  const int min)
1791 {
1792  wxSpinCtrl * pSpinCtrl=NULL;
1793 
1794  int iValue = Value;
1795  WrappedType WrappedRef( iValue );
1796  if( DoStep(1) ) DoDataShuttle( SettingName, WrappedRef );
1797  if( DoStep(2) ) pSpinCtrl = TieSpinCtrl( Prompt, WrappedRef, max, min );
1798  if( DoStep(3) ) DoDataShuttle( SettingName, WrappedRef );
1799 
1800  return pSpinCtrl;
1801 }
1802 
1806  const wxString & Prompt,
1807  const wxString & SettingName,
1808  const wxString & Default,
1809  const int nChars)
1810 {
1811  wxTextCtrl * pText=(wxTextCtrl*)NULL;
1812 
1813  wxString Temp = Default;
1814  WrappedType WrappedRef( Temp );
1815  if( DoStep(1) ) DoDataShuttle( SettingName, WrappedRef );
1816  if( DoStep(2) ) pText = TieTextBox( Prompt, WrappedRef, nChars );
1817  if( DoStep(3) ) DoDataShuttle( SettingName, WrappedRef );
1818  return pText;
1819 }
1820 
1824  const wxString & Prompt,
1825  const wxString & SettingName,
1826  const wxString & Default,
1827  const int nChars)
1828 {
1829  wxTextCtrl * pText=(wxTextCtrl*)NULL;
1830 
1831  wxString Temp = Default;
1832  WrappedType WrappedRef( Temp );
1833  if( DoStep(1) ) DoDataShuttle( SettingName, WrappedRef );
1834  if( DoStep(2) ) pText = TieNumericTextBox( Prompt, WrappedRef, nChars );
1835  if( DoStep(3) ) DoDataShuttle( SettingName, WrappedRef );
1836  return pText;
1837 }
1842  const wxString & Prompt,
1843  const wxString & SettingName,
1844  const double & Default,
1845  const int nChars)
1846 {
1847  wxTextCtrl * pText=(wxTextCtrl*)NULL;
1848 
1849  double Temp = Default;
1850  WrappedType WrappedRef( Temp );
1851  if( DoStep(1) ) DoDataShuttle( SettingName, WrappedRef );
1852  if( DoStep(2) ) pText = TieTextBox( Prompt, WrappedRef, nChars );
1853  if( DoStep(3) ) DoDataShuttle( SettingName, WrappedRef );
1854  return pText;
1855 }
1856 
1861  const wxString & Prompt,
1862  const wxString & SettingName,
1863  const double & Default,
1864  const int nChars)
1865 {
1866  wxTextCtrl * pText=(wxTextCtrl*)NULL;
1867 
1868  double Temp = Default;
1869  WrappedType WrappedRef( Temp );
1870  if( DoStep(1) ) DoDataShuttle( SettingName, WrappedRef );
1871  if( DoStep(2) ) pText = TieNumericTextBox( Prompt, WrappedRef, nChars );
1872  if( DoStep(3) ) DoDataShuttle( SettingName, WrappedRef );
1873  return pText;
1874 }
1875 
1883  const wxString &Prompt,
1884  EnumSetting &enumSetting )
1885 {
1886  // Do this to force any needed migrations first
1887  enumSetting.Read();
1888 
1889  wxArrayString visibleChoices, internalChoices;
1890  for (const auto &ident : enumSetting) {
1891  visibleChoices.push_back( ident.Translation() );
1892  internalChoices.push_back( ident.Internal() );
1893  }
1894  return TieChoice(
1895  Prompt, enumSetting.Key(), enumSetting.Default().Internal(),
1896  visibleChoices, internalChoices );
1897 }
1898 
1907  const wxString &Prompt,
1908  const wxString &SettingName,
1909  const wxString &Default,
1910  const wxArrayString & Choices,
1911  const wxArrayString & InternalChoices)
1912 {
1913  wxChoice * pChoice=(wxChoice*)NULL;
1914 
1915  int TempIndex=0;
1916 // int TempIndex = TranslateToIndex( Default, InternalChoices );
1917  wxString TempStr = Default;
1918  WrappedType WrappedRef( TempStr );
1919  // Get from prefs does 1 and 2.
1920  // Put to prefs does 2 and 3.
1921  if( DoStep(1) ) DoDataShuttle( SettingName, WrappedRef ); // Get Index from Prefs.
1922  if( DoStep(1) ) TempIndex = TranslateToIndex( TempStr, InternalChoices ); // To an index
1923  if( DoStep(2) ) pChoice = TieChoice( Prompt, TempIndex, &Choices ); // Get/Put index from GUI.
1924  if( DoStep(3) ) TempStr = TranslateFromIndex( TempIndex, InternalChoices ); // To a string
1925  if( DoStep(3) ) DoDataShuttle( SettingName, WrappedRef ); // Put into Prefs.
1926  return pChoice;
1927 }
1928 
1939  const wxString &Prompt,
1940  const wxString &SettingName,
1941  const int Default,
1942  const wxArrayString & Choices,
1943  const std::vector<int> & InternalChoices)
1944 {
1945  wxChoice * pChoice=(wxChoice*)NULL;
1946 
1947  int TempIndex=0;
1948  int TranslatedInt = Default;
1949  WrappedType WrappedRef( TranslatedInt );
1950  // Get from prefs does 1 and 2.
1951  // Put to prefs does 2 and 3.
1952  if( DoStep(1) ) DoDataShuttle( SettingName, WrappedRef ); // Get Int from Prefs.
1953  if( DoStep(1) ) TempIndex = TranslateToIndex( TranslatedInt, InternalChoices ); // Int to an index.
1954  if( DoStep(2) ) pChoice = TieChoice( Prompt, TempIndex, &Choices ); // Get/Put index from GUI.
1955  if( DoStep(3) ) TranslatedInt = TranslateFromIndex( TempIndex, InternalChoices ); // Index to int
1956  if( DoStep(3) ) DoDataShuttle( SettingName, WrappedRef ); // Put into Prefs.
1957  return pChoice;
1958 }
1959 
1971  const wxString &Prompt,
1972  const wxString &SettingName,
1973  const int Default,
1974  const wxArrayString & Choices,
1975  const std::vector<int> & InternalChoices)
1976 {
1978  Prompt, SettingName, Default, Choices, InternalChoices );
1979 }
1980 
1983 void ShuttleGuiBase::StartRadioButtonGroup( const wxString & SettingName, const int iDefaultValue )
1984 {
1985  // Configure the generic type mechanism to use OUR integer.
1986  mRadioValueInt = iDefaultValue;
1988  // Now actually start the radio button group.
1989  StartRadioButtonGroup( SettingName );
1990 }
1991 
1994 void ShuttleGuiBase::StartRadioButtonGroup( const wxString & SettingName, const wxString & DefaultValue )
1995 {
1996  // Configure the generic type mechanism to use OUR string.
1997  mRadioValueString = DefaultValue;
1999  // Now actually start the radio button group.
2000  StartRadioButtonGroup( SettingName );
2001 }
2002 
2003 
2006  const wxString &Prompt,
2007  const int iValue)
2008 {
2009  int iTemp = iValue;
2010  WrappedType WrappedRef( iTemp );
2011  return TieRadioButton( Prompt, WrappedRef );
2012 }
2013 
2016  const wxString &Prompt,
2017  const wxString &Value)
2018 {
2019  // In what follows, WrappedRef is used in read only mode, but we
2020  // don't have a 'read-only' version, so we copy to deal with the constness.
2021  wxString Temp = Value;
2022  WrappedType WrappedRef( Temp );
2023  return TieRadioButton( Prompt, WrappedRef );
2024 }
2025 
2026 //------------------------------------------------------------------//
2027 
2028 // We're now into ShuttleGuiBase sizer and misc functions.
2029 
2037 {
2038  if( miIdSetByUser > 0)
2039  {
2040  miId = miIdSetByUser;
2041  miIdSetByUser = -1;
2042  return;
2043  }
2044  miId = miIdNext++;
2045 }
2046 
2048 {
2049  if( miPropSetByUser >=0 )
2050  {
2052  miPropSetByUser =-1;
2053  return;
2054  }
2055  miProp = Default;
2056 }
2057 
2058 
2059 void ShuttleGuiBase::UpdateSizersCore(bool bPrepend, int Flags)
2060 {
2061  if( mpWind && mpParent )
2062  {
2063  if( mpSizer){
2064  if( bPrepend )
2065  {
2066  mpSizer->Prepend(mpWind, miProp, Flags,miBorder);
2067  }
2068  else
2069  {
2070  mpSizer->Add(mpWind, miProp, Flags,miBorder);
2071  }
2072  }
2073  }
2074 
2075  if( mpSubSizer && mpSizer )
2076  {
2077  // When adding sizers into sizers, don't add a border.
2078  // unless it's a static box sizer.
2079  wxSizer *const pSubSizer = mpSubSizer.get();
2080  if (wxDynamicCast(pSubSizer, wxStaticBoxSizer))
2081  {
2082  mpSizer->Add( mpSubSizer.release(), miSizerProp, Flags , miBorder);
2083  }
2084  else
2085  {
2086  mpSizer->Add( mpSubSizer.release(), miSizerProp, Flags ,0);//miBorder);
2087  }
2088  mpSizer = pSubSizer;
2089  PushSizer();
2090  }
2091  mpLastWind = mpWind;
2092  mpWind = NULL;
2093  miProp = 0;
2094  miSizerProp =0;
2095 }
2096 
2097 // Sizer is added into parent sizer, and will expand/shrink.
2099 { UpdateSizersCore( false, wxEXPAND | wxALL );}
2100 
2101 // Sizer is added into parent sizer, centred
2103 { UpdateSizersCore( false, wxALIGN_CENTRE | wxALL );}
2104 
2105 // Sizer is added into parent sizer, and will expand/shrink.
2106 // added to start of sizer list.
2108 { UpdateSizersCore( true, wxEXPAND | wxALL );}
2109 
2111 {
2112  mSizerDepth--;
2113  wxASSERT( mSizerDepth >=0 );
2115 }
2116 
2118 {
2119  mSizerDepth++;
2120  wxASSERT( mSizerDepth < nMaxNestedSizers );
2122 }
2123 
2124 long ShuttleGuiBase::Style( long style )
2125 {
2126  if( miStyle )
2127  style = miStyle;
2128  miStyle = 0;
2129  return style;
2130 }
2131 
2132 // A rarely used helper function that sets a pointer
2133 // ONLY if the value it is to be set to is non NULL.
2134 void SetIfCreated( wxChoice * &Var, wxChoice * Val )
2135 {
2136  if( Val != NULL )
2137  Var = Val;
2138 };
2139 void SetIfCreated( wxTextCtrl * &Var, wxTextCtrl * Val )
2140 {
2141  if( Val != NULL )
2142  Var = Val;
2143 };
2144 void SetIfCreated( wxStaticText *&Var, wxStaticText * Val )
2145 {
2146  if( Val != NULL )
2147  Var = Val;
2148 };
2149 
2150 #ifdef EXPERIMENTAL_TRACK_PANEL
2151 // Additional includes down here, to make it easier to split this into
2152 // two files at some later date.
2153 #include "../extnpanel-src/GuiWaveTrack.h"
2154 #endif
2155 #include "./widgets/Ruler.h"
2157 #include "ShuttlePrefs.h"
2158 
2159 ShuttleGui::ShuttleGui(wxWindow * pParent, teShuttleMode ShuttleMode) :
2160  ShuttleGuiBase( pParent, ShuttleMode )
2161 {
2162  if( ShuttleMode == eIsCreatingFromPrefs )
2163  {
2165  Init(); // Wasn't fully done in base constructor because it is only done when eIsCreating is set.
2166  }
2167  else if( ShuttleMode == eIsSavingToPrefs )
2168  {
2170  }
2171  else
2172  {
2173  return;
2174  }
2175 
2176  mpShuttle = std::make_unique<ShuttlePrefs>();
2177  // In this case the client is the GUI, so if creating we do want to
2178  // store in the client.
2179  mpShuttle->mbStoreInClient = (mShuttleMode == eIsCreating );
2180 };
2181 
2183 {
2184 }
2185 
2186 // Now we have Audacity specific shuttle functions.
2188 {
2189  miIdSetByUser = id;
2190  return *this;
2191 }
2192 
2194  mpbOptionalFlag = &bVar;
2195  return *this;
2196 };
2197 
2198 
2199 GuiWaveTrack * ShuttleGui::AddGuiWaveTrack( const wxString & WXUNUSED(Name))
2200 {
2201 #ifdef EXPERIMENTAL_TRACK_PANEL
2202  UseUpId();
2203  if( mShuttleMode != eIsCreating )
2204  return (GuiWaveTrack*)NULL;
2205 // return wxDynamicCast(wxWindow::FindWindowById( miId, mpDlg), GuiWaveTrack);
2206  GuiWaveTrack * pGuiWaveTrack;
2207  miProp=1;
2208  mpWind = pGuiWaveTrack = safenew GuiWaveTrack(mpParent, miId, Name);
2209  mpWind->SetMinSize(wxSize(100,50));
2210  UpdateSizers();
2211  return pGuiWaveTrack;
2212 #else
2213  return NULL;
2214 #endif
2215 }
2216 
2218 {
2219  UseUpId();
2220  if( mShuttleMode != eIsCreating )
2221  return (AttachableScrollBar*)NULL;
2222 // return wxDynamicCast(wxWindow::FindWindowById( miId, mpDlg), AttachableScrollBar);
2223  AttachableScrollBar * pAttachableScrollBar;
2224  miProp=0;
2225  mpWind = pAttachableScrollBar = safenew AttachableScrollBar(
2226  mpParent,
2227  miId,
2228  wxDefaultPosition,
2229  wxDefaultSize,
2230  style
2231  );
2232  mpWind->SetMinSize(wxSize(10,20));
2233  UpdateSizers();
2234  return pAttachableScrollBar;
2235 }
2236 
2237 std::unique_ptr<wxSizer> CreateStdButtonSizer(wxWindow *parent, long buttons, wxWindow *extra)
2238 {
2239  wxASSERT(parent != NULL); // To justify safenew
2240 
2241  int margin;
2242  {
2243 #if defined(__WXMAC__)
2244  margin = 12;
2245 #elif defined(__WXGTK20__)
2246  margin = 12;
2247 #elif defined(__WXMSW__)
2248  wxButton b(parent, 0, wxEmptyString);
2249  margin = b.ConvertDialogToPixels(wxSize(2, 0)).x;
2250 #else
2251  wxButton b(parent, 0, wxEmptyString);
2252  margin = b->ConvertDialogToPixels(wxSize(4, 0)).x;
2253 #endif
2254  }
2255 
2256  wxButton *b = NULL;
2257  auto bs = std::make_unique<wxStdDialogButtonSizer>();
2258 
2259  if( buttons & eOkButton )
2260  {
2261  b = safenew wxButton(parent, wxID_OK);
2262  b->SetDefault();
2263  bs->AddButton( b );
2264  }
2265 
2266  if( buttons & eCancelButton )
2267  {
2268  bs->AddButton(safenew wxButton(parent, wxID_CANCEL));
2269  }
2270 
2271  if( buttons & eYesButton )
2272  {
2273  b = safenew wxButton(parent, wxID_YES);
2274  b->SetDefault();
2275  bs->AddButton( b );
2276  }
2277 
2278  if( buttons & eNoButton )
2279  {
2280  bs->AddButton(safenew wxButton(parent, wxID_NO));
2281  }
2282 
2283  if( buttons & eApplyButton )
2284  {
2285  b = safenew wxButton(parent, wxID_APPLY);
2286  b->SetDefault();
2287  bs->AddButton( b );
2288  }
2289 
2290  if( buttons & eCloseButton )
2291  {
2292  bs->AddButton(safenew wxButton(parent, wxID_CANCEL, _("&Close")));
2293  }
2294 
2295  if( buttons & eHelpButton )
2296  {
2297  // Replace standard Help button with smaller icon button.
2298  // bs->AddButton(safenew wxButton(parent, wxID_HELP));
2299  b = safenew wxBitmapButton(parent, wxID_HELP, theTheme.Bitmap( bmpHelpIcon ));
2300  b->SetToolTip( _("Help") );
2301  b->SetLabel(_("Help")); // for screen readers
2302  bs->AddButton( b );
2303  }
2304 
2305  if (buttons & ePreviewButton)
2306  {
2307  bs->Add(safenew wxButton(parent, ePreviewID, _("&Preview")), 0, wxALIGN_CENTER | wxLEFT | wxRIGHT, margin);
2308  }
2309  if (buttons & ePreviewDryButton)
2310  {
2311  bs->Add(safenew wxButton(parent, ePreviewDryID, _("Dry Previe&w")), 0, wxALIGN_CENTER | wxLEFT | wxRIGHT, margin);
2312  bs->Add( 20, 0 );
2313  }
2314 
2315  if( buttons & eSettingsButton )
2316  {
2317  bs->Add(safenew wxButton(parent, eSettingsID, _("&Settings")), 0, wxALIGN_CENTER | wxLEFT | wxRIGHT, margin);
2318  bs->Add( 20, 0 );
2319  }
2320 
2321  if( extra )
2322  {
2323  bs->Add( extra, 0, wxALIGN_CENTER | wxLEFT | wxRIGHT, margin );
2324  bs->Add( 40, 0 );
2325  }
2326 
2327  bs->AddStretchSpacer();
2328  bs->Realize();
2329 
2330  // Add any buttons that need to cuddle up to the right hand cluster
2331  if( buttons & eDebugButton )
2332  {
2333  size_t lastLastSpacer = 0;
2334  size_t lastSpacer = 0;
2335  wxSizerItemList & list = bs->GetChildren();
2336  for( size_t i = 0, cnt = list.GetCount(); i < cnt; i++ )
2337  {
2338  if( list[i]->IsSpacer() )
2339  {
2340  lastSpacer = i;
2341  }
2342  else
2343  {
2344  lastLastSpacer = lastSpacer;
2345  }
2346  }
2347 
2348  b = safenew wxButton(parent, eDebugID, _("Debu&g"));
2349  bs->Insert( lastLastSpacer + 1, b, 0, wxALIGN_CENTER | wxLEFT | wxRIGHT, margin );
2350  }
2351 
2352  auto s = std::make_unique<wxBoxSizer>( wxVERTICAL );
2353  s->Add( bs.release(), 1, wxEXPAND | wxALL, 7 );
2354  s->Add( 0, 3 ); // a little extra space
2355 
2356  return std::unique_ptr<wxSizer>{ s.release() };
2357 }
2358 
2359 void ShuttleGui::AddStandardButtons(long buttons, wxButton *extra)
2360 {
2361  if( mShuttleMode != eIsCreating )
2362  return;
2363 
2364  StartVerticalLay( false );
2365 
2366  miSizerProp = false;
2367  mpSubSizer = CreateStdButtonSizer( mpParent, buttons, extra );
2368  UpdateSizers();
2369  PopSizer();
2370 
2371  EndVerticalLay();
2372 }
2373 
2374 wxSizerItem * ShuttleGui::AddSpace( int width, int height )
2375 {
2376  if( mShuttleMode != eIsCreating )
2377  return NULL;
2378  SetProportions(0);
2379  return mpSizer->Add( width, height, miProp);
2380 }
2381 
2382 void ShuttleGuiBase::SetSizeHints( wxWindow *window, const wxArrayString & items )
2383 {
2384  int maxw = 0;
2385 
2386  for( size_t i = 0; i < items.GetCount(); i++ )
2387  {
2388  int x;
2389  int y;
2390 
2391  window->GetTextExtent(items[i], &x, &y );
2392  if( x > maxw )
2393  {
2394  maxw = x;
2395  }
2396  }
2397 
2398  // Would be nice to know the sizes of the button and borders, but this is
2399  // the best we can do for now.
2400 #if defined(__WXMAC__)
2401  maxw += 50;
2402 #elif defined(__WXMSW__)
2403  maxw += 50;
2404 #elif defined(__WXGTK__)
2405  maxw += 50;
2406 #else
2407  maxw += 50;
2408 #endif
2409 
2410  window->SetSizeHints( maxw, -1 );
2411 }
2412 
2413 void ShuttleGuiBase::SetSizeHints( const wxArrayString & items )
2414 {
2415  if( mShuttleMode != eIsCreating )
2416  return;
2417 
2418  SetSizeHints( mpLastWind, items );
2419 }
2420 
2421 /********************************* GetDefinition ******************************/
2422 
2424  wxWindow * pParent,CommandMessageTarget & target )
2425 : ShuttleGui( pParent, eIsGettingMetadata ),
2427 {
2428 
2429 }
2431 {
2432 }
2433 
2435  const wxString &Prompt,
2436  const wxString &SettingName,
2437  const bool bDefault)
2438 {
2439  StartStruct();
2440  AddItem( SettingName, "id" );
2441  AddItem( Prompt, "prompt" );
2442  AddItem( "bool", "type" );
2443  AddBool( bDefault, "default" );
2444  EndStruct();
2445  return ShuttleGui::TieCheckBox( Prompt, SettingName, bDefault );
2446 }
2448  const wxString &Prompt,
2449  const wxString &SettingName,
2450  const bool bDefault)
2451 {
2452  StartStruct();
2453  AddItem( SettingName, "id" );
2454  AddItem( Prompt, "prompt" );
2455  AddItem( "bool", "type" );
2456  AddBool( bDefault, "default" );
2457  EndStruct();
2458  return ShuttleGui::TieCheckBoxOnRight( Prompt, SettingName, bDefault );
2459 }
2461  const wxString &Prompt,
2462  const wxString &SettingName,
2463  const wxString &Default,
2464  const wxArrayString &Choices,
2465  const wxArrayString & InternalChoices )
2466 {
2467  StartStruct();
2468  AddItem( SettingName, "id" );
2469  AddItem( Prompt, "prompt" );
2470  AddItem( "enum", "type" );
2471  AddItem( Default, "default" );
2472  StartField( "enum" );
2473  StartArray();
2474  for( size_t i=0;i<Choices.Count(); i++ )
2475  AddItem( InternalChoices[i] );
2476  EndArray();
2477  EndField();
2478  EndStruct();
2479  return ShuttleGui::TieChoice( Prompt, SettingName, Default, Choices, InternalChoices );
2480 }
2482  const wxString &Prompt,
2483  const wxString &SettingName,
2484  const int Default,
2485  const wxArrayString & Choices,
2486  const std::vector<int> & InternalChoices)
2487 {
2488  // Should no longer come here!
2489  // Choice controls in Preferences that really are exhaustive choices among
2490  // non-numerical options must now encode the internal choices as strings,
2491  // not numbers.
2492  wxASSERT(false);
2493 
2494  // But if we do get here anyway, proceed sub-optimally as before.
2495  StartStruct();
2496  AddItem( SettingName, "id" );
2497  AddItem( Prompt, "prompt" );
2498  AddItem( "enum", "type" );
2499  AddItem( Default, "default" );
2500  StartField( "enum" );
2501  StartArray();
2502  for( size_t i=0;i<Choices.Count(); i++ )
2503  AddItem( Choices[i] );
2504  EndArray();
2505  EndField();
2506  EndStruct();
2507  return ShuttleGui::TieChoice( Prompt, SettingName, Default, Choices, InternalChoices );
2508 }
2510  const wxString &Prompt,
2511  const wxString &SettingName,
2512  const int Default,
2513  const wxArrayString & Choices,
2514  const std::vector<int> & InternalChoices)
2515 {
2516  // Come here for controls that present non-exhaustive choices among some
2517  // numbers, with an associated control that allows arbitrary entry of an
2518  // "Other..."
2519  StartStruct();
2520  AddItem( SettingName, "id" );
2521  AddItem( Prompt, "prompt" );
2522  AddItem( "number", "type" ); // not "enum" !
2523  AddItem( Default, "default" );
2524  EndStruct();
2526  Prompt, SettingName, Default, Choices, InternalChoices );
2527 }
2529  const wxString &Prompt,
2530  const wxString &SettingName,
2531  const wxString &Default,
2532  const int nChars)
2533 {
2534  StartStruct();
2535  AddItem( SettingName, "id" );
2536  AddItem( Prompt, "prompt" );
2537  AddItem( "string", "type" );
2538  AddItem( Default, "default" );
2539  EndStruct();
2540  return ShuttleGui::TieTextBox( Prompt, SettingName, Default, nChars );
2541 }
2543  const wxString & Prompt,
2544  const wxString & SettingName,
2545  const double & Default,
2546  const int nChars)
2547 {
2548  StartStruct();
2549  AddItem( SettingName, "id" );
2550  AddItem( Prompt, "prompt" );
2551  AddItem( "string", "type" );
2552  AddItem( Default, "default" );
2553  EndStruct();
2554  return ShuttleGui::TieTextBox( Prompt, SettingName, Default, nChars );
2555 }
2557  const wxString &Prompt,
2558  const wxString &SettingName,
2559  const wxString &Default,
2560  const int nChars)
2561 {
2562  StartStruct();
2563  AddItem( SettingName, "id" );
2564  AddItem( Prompt, "prompt" );
2565  AddItem( "number", "type" );
2566  AddItem( Default, "default" );
2567  EndStruct();
2568  return ShuttleGui::TieNumericTextBox( Prompt, SettingName, Default, nChars );
2569 }
2571  const wxString & Prompt,
2572  const wxString & SettingName,
2573  const double & Default,
2574  const int nChars)
2575 {
2576  StartStruct();
2577  AddItem( SettingName, "id" );
2578  AddItem( Prompt, "prompt" );
2579  AddItem( "number", "type" );
2580  AddItem( Default, "default" );
2581  EndStruct();
2582  return ShuttleGui::TieNumericTextBox( Prompt, SettingName, Default, nChars );
2583 }
2585  const wxString & Prompt,
2586  const wxString & SettingName,
2587  const int iDefault,
2588  const int max,
2589  const int min)
2590 {
2591  StartStruct();
2592  AddItem( SettingName, "id" );
2593  AddItem( Prompt, "prompt" );
2594  AddItem( "number", "type" );
2595  AddItem( iDefault, "default" );
2596  EndStruct();
2597  return ShuttleGui::TieSlider( Prompt, SettingName, iDefault, max, min );
2598 }
2600  const wxString &Prompt,
2601  const wxString &SettingName,
2602  const int Value,
2603  const int max,
2604  const int min)
2605 {
2606  StartStruct();
2607  AddItem( SettingName, "id" );
2608  AddItem( Prompt, "prompt" );
2609  AddItem( "number", "type" );
2610  AddItem( Value, "default" );
2611  EndStruct();
2612  return ShuttleGui::TieSpinCtrl( Prompt, SettingName, Value, max, min );
2613 }
2614 
void HandleOptionality(const wxString &Prompt)
Definition: ShuttleGui.cpp:225
wxChoice * TieChoice(const wxString &Prompt, WrappedType &WrappedRef, const wxArrayString *pChoices)
ShuttleGuiGetDefinition(wxWindow *pParent, CommandMessageTarget &target)
std::unique_ptr< wxSizer > CreateStdButtonSizer(wxWindow *parent, long buttons, wxWindow *extra)
ShuttleGui & Optional(bool &bVar)
void SetSizeHints(int minX, int minY)
Used to modify an already placed Window.
Definition: ShuttleGui.cpp:194
void WriteToAsInt(const int InInt)
void SetTo(wxString &InStr)
Definition: WrappedType.h:41
AUDACITY_DLL_API Theme theTheme
Definition: Theme.cpp:209
WrappedType mRadioValue
The index of this radio item. -1 for none.
Definition: ShuttleGui.h:338
static CommandHandlerObject & ident(AudacityProject &project)
Definition: Menus.cpp:298
void OnErase(wxEraseEvent &)
Definition: ShuttleGui.cpp:980
An InvisiblePanel is a panel which does not repaint its own background.
Definition: ShuttleGui.cpp:966
wxCheckBox * TieCheckBoxOnRight(const wxString &Prompt, WrappedType &WrappedRef)
wxSpinCtrl * AddSpinCtrl(const wxString &Prompt, int Value, int Max, int Min)
Definition: ShuttleGui.cpp:528
wxCheckBox * AddCheckBoxOnRight(const wxString &Prompt, const wxString &Selected)
Definition: ShuttleGui.cpp:332
An AttachableScrollBar is a scroll bar that can be attached to multiple items and so control their sc...
virtual ~ShuttleGuiGetDefinition()
wxMenu * AddMenu(const wxString &Title)
Definition: ShuttleGui.cpp:758
Derived from ShuttleGuiBase, an Audacity specific class for shuttling data to and from GUI...
Definition: ShuttleGui.h:409
int TranslateToIndex(const wxString &Value, const wxArrayString &Choices)
String-to-Index.
void WriteToAsWrappedType(const WrappedType &W)
Definition: WrappedType.cpp:78
void EndRadioButtonGroup()
wxString TranslateFromIndex(const int nIn, const wxArrayString &Choices)
Index-to-String.
InvisiblePanel(wxWindow *parent, wxWindowID id=-1, const wxPoint &pos=wxDefaultPosition, const wxSize &size=wxDefaultSize, long style=wxTAB_TRAVERSAL)
Definition: ShuttleGui.cpp:969
wxSlider * TieSlider(const wxString &Prompt, WrappedType &WrappedRef, const int max, const int min=0)
wxCheckBox * TieCheckBoxOnRight(const wxString &Prompt, const wxString &SettingName, const bool bDefault) override
teWrappedType eWrappedType
Definition: WrappedType.h:64
wxWindow * AddWindow(wxWindow *pWindow, int Flags=wxALIGN_CENTRE|wxALL)
Definition: ShuttleGui.cpp:288
std::unique_ptr< Shuttle > mpShuttle
Definition: ShuttleGui.h:328
void EndNotebook()
Definition: ShuttleGui.cpp:905
wxString Read() const
Definition: Prefs.cpp:379
void UpdateSizersAtStart()
wxString mRadioValueString
The wrapped value associated with the active radio button.
Definition: ShuttleGui.h:339
void EndMultiColumn()
void AddBool(const bool value, const wxString &name="") override
CommandMessageTargetDecorator is a CommandOutputTarget that forwards its work on to another one...
void EndNotebookPage()
Definition: ShuttleGui.cpp:956
void EnableCtrl(bool bEnable)
Definition: ShuttleGui.cpp:186
wxPanel * StartPanel(int iStyle=0)
Definition: ShuttleGui.cpp:855
wxWindow * mpDlg
Definition: ShuttleGui.h:325
int miSizerProp
Unwrapped integer value.
Definition: ShuttleGui.h:342
wxPanel * StartInvisiblePanel()
Definition: ShuttleGui.cpp:997
void SetIfCreated(wxChoice *&Var, wxChoice *Val)
wxSizer * pSizerStack[nMaxNestedSizers]
Definition: ShuttleGui.h:326
int mRadioValueInt
Unwrapped string value.
Definition: ShuttleGui.h:340
void WriteToAsBool(const bool InBool)
~ShuttleGui(void)
wxTreeCtrl * AddTree()
Definition: ShuttleGui.cpp:712
wxTextCtrl * AddNumericTextBox(const wxString &Caption, const wxString &Value, const int nChars)
Definition: ShuttleGui.cpp:580
wxSpinCtrl * TieSpinCtrl(const wxString &Prompt, WrappedType &WrappedRef, const int max, const int min=0)
virtual ~ShuttleGuiBase()
Definition: ShuttleGui.cpp:130
void EndScroller()
Definition: ShuttleGui.cpp:836
void OnPaint(wxPaintEvent &event)
Definition: ShuttleGui.cpp:990
wxListCtrl * AddListControl()
Definition: ShuttleGui.cpp:669
wxChoice * TieNumberAsChoice(const wxString &Prompt, const wxString &SettingName, const int Default, const wxArrayString &Choices, const std::vector< int > &InternalChoices) override
GuiWaveTrack * AddGuiWaveTrack(const wxString &Name)
const int nMaxNestedSizers
Definition: ShuttleGui.h:33
#define safenew
Definition: Audacity.h:230
wxString ReadAsString()
ShuttleGui(wxWindow *pParent, teShuttleMode ShuttleMode)
wxMenu * mpMenu
Definition: ShuttleGui.h:362
void EndHorizontalLay()
bool DoStep(int iStep)
wxBitmap & Bitmap(int iIndex)
Definition: Theme.cpp:1244
void AddUnits(const wxString &Prompt)
Left aligned text string.
Definition: ShuttleGui.cpp:260
void AddPrompt(const wxString &Prompt)
Right aligned text string.
Definition: ShuttleGui.cpp:239
wxTextCtrl * TieTextBox(const wxString &Prompt, const wxString &SettingName, const wxString &Default, const int nChars) override
ShuttleGuiBase & Prop(int iProp)
Definition: ShuttleGui.cpp:739
An alternative to using wxWindowAccessible, which in wxWidgets 3.1.1 contained GetParent() which was ...
wxBitmapButton * AddBitmapButton(const wxBitmap &Bitmap, int PositionFlags=wxALIGN_CENTRE)
Definition: ShuttleGui.cpp:363
void EndVerticalLay()
wxTextCtrl * AddTextBox(const wxString &Caption, const wxString &Value, const int nChars)
Definition: ShuttleGui.cpp:548
wxCheckBox * AddCheckBox(const wxString &Prompt, const wxString &Selected)
Definition: ShuttleGui.cpp:298
void AddIcon(wxBitmap *pBmp)
Definition: ShuttleGui.cpp:726
wxSizer * mpSizer
Definition: ShuttleGui.h:358
wxScrolledWindow * StartScroller(int iStyle=0)
Definition: ShuttleGui.cpp:803
void WriteToAsString(const wxString &InStr)
wxWindow * GetParent()
Definition: ShuttleGui.h:294
bool * mpbOptionalFlag
Definition: ShuttleGui.h:355
void StartHorizontalLay(int PositionFlags=wxALIGN_CENTRE, int iProp=1)
wxGrid * AddGrid()
Definition: ShuttleGui.cpp:683
wxListCtrl * AddListControlReportMode()
Definition: ShuttleGui.cpp:697
void StartMultiColumn(int nCols, int PositionFlags=wxALIGN_LEFT)
wxChoice * AddChoice(const wxString &Prompt, const wxString &Selected, const wxArrayString *pChoices)
Definition: ShuttleGui.cpp:379
IteratorRange< Iterator > make_iterator_range(const Iterator &i1, const Iterator &i2)
Definition: MemoryX.h:596
ShuttleGui & Id(int id)
wxSlider * TieSlider(const wxString &Prompt, const wxString &SettingName, const int iDefault, const int max, const int min=0) override
bool ReadAsBool()
void UpdateSizersC()
wxWindow * mpParent
Definition: ShuttleGui.h:359
teShuttleMode
Definition: ShuttleGui.h:35
wxTextCtrl * TieNumericTextBox(const wxString &Prompt, WrappedType &WrappedRef, const int nChars)
void AddConstTextBox(const wxString &Caption, const wxString &Value)
Single line text box of fixed size.
Definition: ShuttleGui.cpp:637
void AddFixedText(const wxString &Str, bool bCenter=false)
Definition: ShuttleGui.cpp:405
int min(int a, int b)
Interface for objects that can receive (string) messages from a command.
void AddTitle(const wxString &Prompt)
Centred text string.
Definition: ShuttleGui.cpp:274
void StartField(const wxString &name="") override
ShuttleGuiBase(wxWindow *pParent, teShuttleMode ShuttleMode)
Definition: ShuttleGui.cpp:120
bool ValuesMatch(const WrappedType &W)
Definition: WrappedType.cpp:41
Base class for shuttling data to and from a GUI.
Definition: ShuttleGui.h:80
wxRadioButton * TieRadioButton(const wxString &Prompt, WrappedType &WrappedRef)
bool IsString()
Definition: WrappedType.cpp:34
void AddItem(const wxString &value, const wxString &name="") override
teShuttleMode mShuttleMode
Used in choices to determine which item to use on no match.
Definition: ShuttleGui.h:332
wxTextCtrl * TieNumericTextBox(const wxString &Prompt, const wxString &SettingName, const wxString &Default, const int nChars) override
wxWindow * mpWind
Definition: ShuttleGui.h:360
void UpdateSizersCore(bool bPrepend, int Flags)
_("Move Track &Down")+wxT("\t")+(GetActiveProject() -> GetCommandManager() ->GetKeyFromName(wxT("TrackMoveDown")).Raw()), OnMoveTrack) POPUP_MENU_ITEM(OnMoveTopID, _("Move Track to &Top")+wxT("\t")+(GetActiveProject() ->GetCommandManager() ->GetKeyFromName(wxT("TrackMoveTop")).Raw()), OnMoveTrack) POPUP_MENU_ITEM(OnMoveBottomID, _("Move Track to &Bottom")+wxT("\t")+(GetActiveProject() ->GetCommandManager() ->GetKeyFromName(wxT("TrackMoveBottom")).Raw()), OnMoveTrack)#define SET_TRACK_NAME_PLUGIN_SYMBOLclass SetTrackNameCommand:public AudacityCommand
wxComboBox * AddCombo(const wxString &Prompt, const wxString &Selected, const wxArrayString *pChoices, long style=0)
Definition: ShuttleGui.cpp:448
int mRadioCount
The setting controlled by a group.
Definition: ShuttleGui.h:336
wxChoice * TieChoice(const wxString &Prompt, const wxString &SettingName, const wxString &Default, const wxArrayString &Choices, const wxArrayString &InternalChoices) override
int miNoMatchSelector
Definition: ShuttleGui.h:330
virtual wxChoice * TieNumberAsChoice(const wxString &Prompt, const wxString &SettingName, const int Default, const wxArrayString &Choices, const std::vector< int > &InternalChoices)
void DoDataShuttle(const wxString &Name, WrappedType &WrappedRef)
wxCheckBox * TieCheckBox(const wxString &Prompt, WrappedType &WrappedRef)
void SetProportions(int Default)
wxTextCtrl * AddTextWindow(const wxString &Value)
Multiline text box that grows.
Definition: ShuttleGui.cpp:616
wxListBox * AddListBox(const wxArrayString *pChoices, long style=0)
Definition: ShuttleGui.cpp:654
AttachableScrollBar * AddAttachableScrollBar(long style=wxSB_HORIZONTAL)
wxMenuBar * mpMenuBar
Definition: ShuttleGui.h:361
wxWindow wxNotebookPage
Definition: ShuttleGui.h:62
wxSpinCtrl * TieSpinCtrl(const wxString &Prompt, const wxString &SettingName, const int Value, const int max, const int min) override
wxStaticText * AddVariableText(const wxString &Str, bool bCenter=false, int PositionFlags=0)
Definition: ShuttleGui.cpp:422
wxStaticBox * StartStatic(const wxString &Str, int iProp=0)
Definition: ShuttleGui.cpp:771
wxString mSettingName
Definition: ShuttleGui.h:335
wxWindow * mpLastWind
Definition: ShuttleGui.h:324
long Style(long Style)
wxRadioButton * AddRadioButtonToGroup(const wxString &Prompt)
Definition: ShuttleGui.cpp:492
wxNotebook * StartNotebook()
Definition: ShuttleGui.cpp:891
void AddStandardButtons(long buttons=eOkButton|eCancelButton, wxButton *extra=NULL)
END_EVENT_TABLE()
wxSizerItem * AddSpace(int width, int height)
void EndInvisiblePanel()
std::unique_ptr< wxSizer > mpSubSizer
Definition: ShuttleGui.h:357
wxNotebookPage * StartNotebookPage(const wxString &Name)
Definition: ShuttleGui.cpp:912
wxMenuBar * AddMenuBar()
Definition: ShuttleGui.cpp:745
wxSlider * TieVSlider(const wxString &Prompt, float &pos, const float fMin, const float fMax)
wxCheckBox * TieCheckBox(const wxString &Prompt, const wxString &SettingName, const bool bDefault) override
void StartRadioButtonGroup(const wxString &SettingName)
wxButton * AddButton(const wxString &Text, int PositionFlags=wxALIGN_CENTRE)
Definition: ShuttleGui.cpp:349
void SetStretchyCol(int i)
Used to modify an already placed FlexGridSizer to make a column stretchy.
Definition: ShuttleGui.cpp:203
wxRadioButton * AddRadioButton(const wxString &Prompt)
Definition: ShuttleGui.cpp:476
wxTextCtrl * TieTextBox(const wxString &Prompt, WrappedType &WrappedRef, const int nChars)
Used in type conversions, this wrapper for ints, strings, doubles and enums provides conversions betw...
Definition: WrappedType.h:31
void SetStretchyRow(int i)
Used to modify an already placed FlexGridSizer to make a row stretchy.
Definition: ShuttleGui.cpp:213
A Validator is an object which checks whether a wxVariant satisfies a certain criterion. This is a base validator which allows anything.
Definition: Validators.h:48
wxSlider * AddSlider(const wxString &Prompt, int pos, int Max, int Min=0)
Definition: ShuttleGui.cpp:505
void StartVerticalLay(int iProp=1)