Audacity 3.2.0
ShuttleGui.h
Go to the documentation of this file.
1/**********************************************************************
2
3 Audacity: A Digital Audio Editor
4
5 ShuttleGui.h
6
7 James Crook
8
9 Audacity is free software.
10 This file is licensed under the wxWidgets license, see License.txt
11
12**********************************************************************/
13
14#ifndef SHUTTLE_GUI
15#define SHUTTLE_GUI
16
17
18#include "Identifier.h"
19
20#include <vector>
21#include <wx/slider.h> // to inherit
22#include <wx/listbase.h> // for wxLIST_FORMAT_LEFT
23
24#include "Prefs.h"
25#include "WrappedType.h"
27
28#include <optional>
29
30class ChoiceSetting;
31
32class wxArrayStringEx;
33
34
35const int nMaxNestedSizers = 20;
36
38{
43
44 // Next two are only ever seen in constructor.
45 // After that they revert to one of the modes above.
46 // They are used to achieve 'two step' operation,
47 // where we transfer between two shuttles in one go.
50};
51
52class wxListCtrl;
53class wxCheckBox;
54class wxChoice;
55class wxComboBox;
56class wxScrolledWindow;
57class wxStaticText;
58class wxTreeCtrl;
59class wxTextCtrl;
60class wxSlider;
61class wxNotebook;
62class wxSimplebook;
63typedef wxWindow wxNotebookPage; // so far, any window can be a page
64class wxButton;
65class wxBitmapButton;
66class wxRadioButton;
67class wxBitmap;
68class wxPanel;
69class wxSizer;
70class wxSizerItem;
71class wxStaticBox;
72class wxSpinCtrl;
73class wxListBox;
74class wxGrid;
75class Shuttle;
76class ReadOnlyText;
77
78class WrappedType;
79
80#ifdef __WXMAC__
81
82#include <wx/statbox.h> // to inherit
83
85 : public wxStaticBox // inherit to get access to m_container
86{
87public:
88 template< typename... Args >
89 wxStaticBoxWrapper( Args &&...args )
90 : wxStaticBox( std::forward<Args>(args)... )
91 {
92 m_container.EnableSelfFocus();
93 }
94};
95
98class wxSliderWrapper : public wxSlider
99{
100public:
101 using wxSlider::wxSlider;
102 void SetFocus() override;
103};
104#else
105using wxStaticBoxWrapper = wxStaticBox;
106using wxSliderWrapper = wxSlider;
107#endif
108
110
111struct Item {
112 Item() = default;
113
114 // Factory is a class that returns a value of some subclass of wxValidator
115 // We must wrap it in another lambda to allow the return type of f to
116 // vary, and avoid the "slicing" problem.
117 // (That is, std::function<wxValidator()> would not work.)
118 template<typename Factory>
119 Item&& Validator( const Factory &f ) &&
120 {
121 mValidatorSetter = [f](wxWindow *p){ p->SetValidator(f()); };
122 return std::move(*this);
123 }
124
125 // This allows further abbreviation of the previous:
126 template<typename V, typename... Args>
127 Item&& Validator( Args&&... args ) &&
128 { return std::move(*this).Validator( [args...]{ return V( args... ); } ); }
129
130 Item&& ToolTip( const TranslatableString &tip ) &&
131 {
132 mToolTip = tip;
133 return std::move( *this );
134 }
135
136 // Menu codes in the translation will be stripped
138 {
139 mName = name;
140 return std::move( *this );
141 }
142
143 // Append a space, then the translation of the given string, to control name
144 // (not the title or label: this affects the screen reader behavior)
145 Item&& NameSuffix( const TranslatableString &suffix ) &&
146 {
147 mNameSuffix = suffix;
148 return std::move( *this );
149 }
150
151 Item&& Style( long style ) &&
152 {
153 miStyle = style;
154 return std::move( *this );
155 }
156
157 // Only the last item specified as focused (if more than one) will be
158 Item&& Focus( bool focused = true ) &&
159 {
160 mFocused = focused;
161 return std::move( *this );
162 }
163
164 Item&& Disable( bool disabled = true ) &&
165 {
166 mDisabled = disabled;
167 return std::move( *this );
168 }
169
170 // Dispatch events from the control to the dialog
171 // The template type deduction ensures consistency between the argument type
172 // and the event type. It does not (yet) ensure correctness of the type of
173 // the handler object.
174 template< typename Tag, typename Argument, typename Handler >
176 wxEventTypeTag<Tag> eventType,
177 void (Handler::*func)(Argument&)
178 ) &&
179 -> std::enable_if_t<
180 std::is_base_of_v<Argument, Tag>,
181 Item&& >
182 {
183 mRootConnections.push_back({
184 eventType,
185 (void(wxEvtHandler::*)(wxEvent&)) (
186 static_cast<void(wxEvtHandler::*)(Argument&)>( func )
187 )
188 });
189 return std::move( *this );
190 }
191
192 Item&& MinSize() && // set best size as min size
193 {
194 mUseBestSize = true;
195 return std::move ( *this );
196 }
197
198 Item&& MinSize( wxSize sz ) &&
199 {
200 mMinSize = sz; mHasMinSize = true;
201 return std::move ( *this );
202 }
203
204 Item&& Position( int flags ) &&
205 {
206 mWindowPositionFlags = flags;
207 return std::move( *this );
208 }
209
210 Item&& Size( wxSize size ) &&
211 {
213 return std::move( *this );
214 }
215
216 std::function< void(wxWindow*) > mValidatorSetter;
220
221 std::vector<std::pair<wxEventType, wxObjectEventFunction>> mRootConnections;
222
223 long miStyle{};
224
225 // Applies to windows, not to subsizers
227
228 wxSize mWindowSize{};
229
230 wxSize mMinSize{ -1, -1 };
231 bool mHasMinSize{ false };
232 bool mUseBestSize{ false };
233
234 bool mFocused { false };
235 bool mDisabled { false };
236
237};
238
239}
240
241class AUDACITY_DLL_API ShuttleGuiBase /* not final */
242{
243public:
245 wxWindow * pParent,
246 teShuttleMode ShuttleMode,
247 bool vertical, // Choose layout direction of topmost level sizer
248 wxSize minSize
249 );
250 virtual ~ShuttleGuiBase();
251 void Init( bool vertical, wxSize minSize );
252 void ResetId();
253
254//-- Add functions. These only add a widget or 2.
255 void HandleOptionality(const TranslatableString &Prompt);
256 void AddPrompt(const TranslatableString &Prompt, int wrapWidth = 0);
257 void AddUnits(const TranslatableString &Prompt, int wrapWidth = 0);
258 void AddTitle(const TranslatableString &Prompt, int wrapWidth = 0);
259 wxWindow * AddWindow(wxWindow* pWindow, int PositionFlags = wxALIGN_CENTRE);
260 wxSlider * AddSlider(
261 const TranslatableString &Prompt, int pos, int Max, int Min = 0);
262 wxSlider * AddVSlider(const TranslatableString &Prompt, int pos, int Max);
263 wxSpinCtrl * AddSpinCtrl(const TranslatableString &Prompt,
264 int Value, int Max, int Min);
265 wxTreeCtrl * AddTree();
266
267 // Pass the same initValue to the sequence of calls to AddRadioButton and
268 // AddRadioButtonToGroup.
269 // The radio button is filled if selector == initValue
270 // Spoken name of the button defaults to the same as the prompt
271 // (after stripping menu codes):
272 wxRadioButton * AddRadioButton(
273 const TranslatableString & Prompt, int selector = 0, int initValue = 0 );
274 wxRadioButton * AddRadioButtonToGroup(
275 const TranslatableString & Prompt, int selector = 1, int initValue = 0 );
276
277 // Only the last button specified as default (if more than one) will be
278 // Always ORs the flags with wxALL (which affects borders):
279 wxButton * AddButton(
280 const TranslatableString & Text, int PositionFlags = wxALIGN_CENTRE,
281 bool setDefault = false );
282 // Only the last button specified as default (if more than one) will be
283 // Always ORs the flags with wxALL (which affects borders):
284 wxBitmapButton * AddBitmapButton(
285 const wxBitmap &Bitmap, int PositionFlags = wxALIGN_CENTRE,
286 bool setDefault = false );
287 // When PositionFlags is 0, applies wxALL (which affects borders),
288 // and either wxALIGN_CENTER (if bCenter) or else wxEXPAND
289 wxStaticText * AddVariableText(
290 const TranslatableString &Str, bool bCenter = false,
291 int PositionFlags = 0, int wrapWidth = 0);
292 ReadOnlyText * AddReadOnlyText(
293 const TranslatableString &Caption,
294 const wxString &Value);
295 wxTextCtrl * AddTextBox(
296 const TranslatableString &Caption,
297 const wxString &Value, const int nChars);
298 wxTextCtrl * AddNumericTextBox(
299 const TranslatableString &Caption,
300 const wxString &Value, const int nChars);
301 wxTextCtrl * AddTextWindow(const wxString &Value);
302 wxListBox * AddListBox(const wxArrayStringEx &choices);
303
306 const TranslatableString &h,
307 int f = wxLIST_FORMAT_LEFT, int w = wxLIST_AUTOSIZE)
308 : heading(h), format(f), width(w)
309 {}
310
313 int width;
314 };
315 wxListCtrl * AddListControl(
316 std::initializer_list<const ListControlColumn> columns = {},
317 long listControlStyles = 0
318 );
319 wxListCtrl * AddListControlReportMode(
320 std::initializer_list<const ListControlColumn> columns = {},
321 long listControlStyles = 0
322 );
323
324 wxGrid * AddGrid();
325 wxCheckBox * AddCheckBox( const TranslatableString &Prompt, bool Selected);
326 wxCheckBox * AddCheckBoxOnRight( const TranslatableString &Prompt, bool Selected);
327
328 // These deleted overloads are meant to break compilation of old calls that
329 // passed literal "true" and "false" strings
330 wxCheckBox * AddCheckBox( const TranslatableString &Prompt, const wxChar *) = delete;
331 wxCheckBox * AddCheckBox( const TranslatableString &Prompt, const char *) = delete;
332 wxCheckBox * AddCheckBoxOnRight( const TranslatableString &Prompt, const wxChar *) = delete;
333 wxCheckBox * AddCheckBoxOnRight( const TranslatableString &Prompt, const char *) = delete;
334
335 wxComboBox * AddCombo( const TranslatableString &Prompt,
336 const wxString &Selected, const wxArrayStringEx & choices );
337 wxChoice * AddChoice( const TranslatableString &Prompt,
338 const TranslatableStrings &choices, int Selected = -1 );
339 wxChoice * AddChoice( const TranslatableString &Prompt,
340 const TranslatableStrings &choices, const TranslatableString &selected );
341 void AddIcon( wxBitmap * pBmp);
342 void AddFixedText(
343 const TranslatableString & Str, bool bCenter = false, int wrapWidth = 0 );
344 void AddConstTextBox(
345 const TranslatableString &Caption, const TranslatableString & Value );
346
347//-- Start and end functions. These are used for sizer, or other window containers
348// and create the appropriate widget.
349 void StartHorizontalLay(int PositionFlags=wxALIGN_CENTRE, int iProp=1);
350 void EndHorizontalLay();
351
352 void StartVerticalLay(int iProp=1);
353 void StartVerticalLay(int PositionFlags, int iProp);
354 void EndVerticalLay();
355
356 void StartWrapLay(int PositionFlags=wxEXPAND, int iProp = 0);
357 void EndWrapLay();
358
359 wxScrolledWindow * StartScroller(int iStyle=0);
360 void EndScroller();
361 wxPanel * StartPanel(int iStyle=0);
362 void EndPanel();
363 void StartMultiColumn(int nCols, int PositionFlags=wxALIGN_LEFT);
364 void EndMultiColumn();
365
366 void StartTwoColumn() {StartMultiColumn(2);};
367 void EndTwoColumn() {EndMultiColumn();};
368 void StartThreeColumn(){StartMultiColumn(3);};
369 void EndThreeColumn(){EndMultiColumn();};
370
371 wxStaticBox * StartStatic( const TranslatableString & Str, int iProp=0 );
372 void EndStatic();
373
374 wxNotebook * StartNotebook();
375 void EndNotebook();
376
377 wxSimplebook * StartSimplebook();
378 void EndSimplebook();
379
380 // Use within any kind of book control:
381 // IDs of notebook pages cannot be chosen by the caller
382 wxNotebookPage * StartNotebookPage( const TranslatableString & Name );
383
384 void EndNotebookPage();
385
386 wxPanel * StartInvisiblePanel(int border = 0);
387 void EndInvisiblePanel();
388
389 void StartRadioButtonGroup(ChoiceSetting &Setting);
390 void EndRadioButtonGroup();
391
392 bool DoStep( int iStep );
393 int TranslateToIndex( const wxString &Value, const wxArrayStringEx &Choices );
394 wxString TranslateFromIndex( const int nIn, const wxArrayStringEx &Choices );
395
396//-- Tie functions both add controls and also read/write to them.
397
398 wxTextCtrl * TieTextBox(
399 const TranslatableString &Caption, wxString & Value, const int nChars=0);
400 wxTextCtrl * TieTextBox(
401 const TranslatableString &Prompt, int &Selected, const int nChars=0);
402 wxTextCtrl * TieTextBox(
403 const TranslatableString &Prompt, double &Value, const int nChars=0);
404
405 wxTextCtrl * TieNumericTextBox( const TranslatableString &Prompt, int &Value, const int nChars=0);
406 wxTextCtrl * TieNumericTextBox( const TranslatableString &Prompt, double &Value, const int nChars=0);
407
408 wxCheckBox * TieCheckBox( const TranslatableString &Prompt, bool & Var );
409 wxCheckBox * TieCheckBoxOnRight( const TranslatableString & Prompt, bool & Var );
410
411 wxChoice * TieChoice(
412 const TranslatableString &Prompt,
413 TranslatableString &Selected, const TranslatableStrings &choices );
414 wxChoice * TieChoice(
415 const TranslatableString &Prompt, int &Selected, const TranslatableStrings &choices );
416
417 wxSlider * TieSlider(
418 const TranslatableString &Prompt,
419 int &pos, const int max, const int min = 0);
420 wxSlider * TieSlider(
421 const TranslatableString &Prompt,
422 double &pos, const double max, const double min = 0.0);
423 wxSlider * TieSlider(
424 const TranslatableString &Prompt,
425 float &pos, const float fMin, const float fMax);
426 wxSlider * TieVSlider(
427 const TranslatableString &Prompt,
428 float &pos, const float fMin, const float fMax);
429
430 // Must be called between a StartRadioButtonGroup / EndRadioButtonGroup pair,
431 // and as many times as there are values in the enumeration.
432 wxRadioButton * TieRadioButton();
433
434 wxSpinCtrl * TieSpinCtrl( const TranslatableString &Prompt,
435 int &Value, const int max, const int min = 0 );
436
437
438//-- Variants of the standard Tie functions which do two step exchange in one go
439// Note that unlike the other Tie functions, ALL the arguments are const.
440// That's because the data is being exchanged between the dialog and mpShuttle
441// so it doesn't need an argument that is writeable.
442 virtual wxCheckBox * TieCheckBox(
443 const TranslatableString &Prompt,
444 const BoolSetting &Setting);
445 virtual wxCheckBox * TieCheckBoxOnRight(
446 const TranslatableString &Prompt,
447 const BoolSetting &Setting);
448
449 virtual wxChoice *TieChoice(const TranslatableString &Prompt,
450 ChoiceSetting &choiceSetting);
451
452 // This overload presents what is really a numerical setting as a choice among
453 // commonly used values, but the choice is not necessarily exhaustive.
454 // This behaves just like the previous for building dialogs, but the
455 // behavior is different when the call is intercepted for purposes of
456 // emitting scripting information about Preferences.
457 virtual wxChoice * TieNumberAsChoice(const TranslatableString &Prompt,
459 const TranslatableStrings & Choices,
460 const std::vector<int> * pInternalChoices = nullptr,
461 int iNoMatchSelector = 0);
462
463 virtual wxTextCtrl * TieTextBox(
464 const TranslatableString &Prompt,
465 const StringSetting &Setting,
466 const int nChars);
467 virtual wxTextCtrl * TieIntegerTextBox(
468 const TranslatableString & Prompt,
469 const IntSetting &Setting,
470 const int nChars);
471 virtual wxTextCtrl * TieNumericTextBox(
472 const TranslatableString & Prompt,
473 const DoubleSetting &Setting,
474 const int nChars);
475 virtual wxSlider * TieSlider(
476 const TranslatableString & Prompt,
477 const IntSetting &Setting,
478 const int max,
479 const int min = 0);
480 virtual wxSpinCtrl * TieSpinCtrl(
481 const TranslatableString &Prompt,
482 const IntSetting &Setting,
483 const int max,
484 const int min);
485//-- End of variants.
486 void SetBorder( int Border ) {miBorder = Border;};
487 int GetBorder() const noexcept;
488 void SetSizerProportion( int iProp ) {miSizerProp = iProp;};
489 void SetStretchyCol( int i );
490 void SetStretchyRow( int i );
491
492//--Some Additions since June 2007 that don't fit in elsewhere...
493 wxWindow * GetParent()
494 {
495 // This assertion justifies the use of safenew in many places where GetParent()
496 // is used to construct a window
497 wxASSERT(mpParent != NULL);
498 return mpParent;
499 }
500 ShuttleGuiBase & Prop( int iProp );
501 void UseUpId();
502
503 wxSizer * GetSizer() {return mpSizer;}
504
505 static void ApplyItem( int step, const DialogDefinition::Item &item,
506 wxWindow *pWind, wxWindow *pDlg );
507
508protected:
509 void SetProportions( int Default );
510 void PushSizer();
511 void PopSizer();
512
513 void UpdateSizersCore( bool bPrepend, int Flags, bool prompt = false );
514 void UpdateSizers();
515 void UpdateSizersC();
516 void UpdateSizersAtStart();
517
518 long GetStyle( long Style );
519
520private:
521 void DoInsertListColumns(
522 wxListCtrl *pListCtrl,
523 long listControlStyles,
524 std::initializer_list<const ListControlColumn> columns );
525
526protected:
527 wxWindow *const mpDlg;
528 wxSizer * pSizerStack[ nMaxNestedSizers ];
529
530 std::unique_ptr<Shuttle> mpShuttle;
533
535
540
541 // See UseUpId() for explanation of these three.
542 int miId;
545 // Proportion set by user rather than default.
547
549
550 std::unique_ptr<wxSizer> mpSubSizer;
551 wxSizer * mpSizer;
552 wxWindow * mpParent;
553 wxWindow * mpWind;
554
555private:
556 void DoDataShuttle( const wxString &Name, WrappedType & WrappedRef );
557 wxCheckBox * DoTieCheckBoxOnRight( const TranslatableString & Prompt, WrappedType & WrappedRef );
558 wxTextCtrl * DoTieTextBox(
559 const TranslatableString &Prompt,
560 WrappedType & WrappedRef, const int nChars);
561 wxTextCtrl * DoTieNumericTextBox(
562 const TranslatableString &Prompt, WrappedType & WrappedRef, const int nChars);
563 wxCheckBox * DoTieCheckBox( const TranslatableString &Prompt, WrappedType & WrappedRef );
564 wxSlider * DoTieSlider(
565 const TranslatableString &Prompt,
566 WrappedType & WrappedRef, const int max, const int min = 0 );
567 wxSpinCtrl * DoTieSpinCtrl( const TranslatableString &Prompt,
568 WrappedType & WrappedRef, const int max, const int min = 0 );
569
570 std::vector<EnumValueSymbol> mRadioSymbols;
572 std::optional<WrappedType> mRadioValue;
575 wxRadioButton * DoAddRadioButton(
576 const TranslatableString &Prompt, int style, int selector, int initValue);
577
578protected:
580};
581
582// A rarely used helper function that sets a pointer
583// ONLY if the value it is to be set to is non NULL.
584extern void SetIfCreated( wxChoice *&Var, wxChoice * Val );
585extern void SetIfCreated( wxTextCtrl *&Var, wxTextCtrl * Val );
586extern void SetIfCreated( wxStaticText *&Var, wxStaticText * Val );
587
588class GuiWaveTrack;
590class ViewInfo;
591
592#include <wx/defs.h> // to get wxSB_HORIZONTAL
593
594// CreateStdButtonSizer defs...should probably move to widgets subdir
595enum
596{
597 eOkButton = 0x0001,
599 eYesButton = 0x0004,
600 eNoButton = 0x0008,
601 eHelpButton = 0x0010,
603 eDebugButton = 0x0040,
606 eApplyButton = 0x0200,
607 eCloseButton = 0x0400,
608};
609
610enum
611{
612 // ePreviewID = wxID_LOWEST - 1,
613 // But there is a wxID_PREVIEW
614 ePreviewID = wxID_PREVIEW,
615
616 eDebugID = wxID_LOWEST - 2,
617 eSettingsID = wxID_LOWEST - 3,
618 ePreviewDryID = wxID_LOWEST - 4,
619 eCloseID = wxID_CANCEL
621
622AUDACITY_DLL_API std::unique_ptr<wxSizer> CreateStdButtonSizer( wxWindow *parent,
623 long buttons = eOkButton | eCancelButton,
624 wxWindow *extra = NULL );
625
626// ShuttleGui extends ShuttleGuiBase with Audacity specific extensions.
627class AUDACITY_DLL_API ShuttleGui /* not final */ : public ShuttleGuiBase
628{
629public:
631 wxWindow * pParent, teShuttleMode ShuttleMode,
632 bool vertical = true, // Choose layout direction of topmost level sizer
633 wxSize minSize = { 250, 100 }
634 );
635 ~ShuttleGui(void);
636public:
637 ShuttleGui & Optional( bool & bVar );
638 ShuttleGui & Id(int id );
639
640 // Only the last item specified as focused (if more than one) will be
641 ShuttleGui & Focus( bool focused = true )
642 {
643 std::move( mItem ).Focus( focused );
644 return *this;
645 }
646
647 ShuttleGui &Disable( bool disabled = true )
648 {
649 std::move( mItem ).Disable( disabled );
650 return *this;
651 }
652
654 {
655 std::move( mItem ).ToolTip( tip );
656 return *this;
657 }
658
659 // Menu codes in the translation will be stripped
661 {
662 std::move( mItem ).Name( name );
663 return *this;
664 }
665
666 // Append a space, then the translation of the given string, to control name
667 // (not the title or label: this affects the screen reader behavior)
669 {
670 std::move( mItem ).NameSuffix( suffix );
671 return *this;
672 }
673
674 template<typename Factory>
675 ShuttleGui& Validator( const Factory &f )
676 {
677 if ( GetMode() == eIsCreating )
678 std::move( mItem ).Validator( f );
679 return *this;
680 }
681
682 // This allows further abbreviation of the previous:
683 template<typename V, typename...Args>
684 ShuttleGui& Validator( Args&& ...args )
685 {
686 if ( GetMode() == eIsCreating )
687 std::move( mItem ).Validator<V>( std::forward<Args>(args)... );
688 return *this;
689 }
690
691 // Dispatch events from the control to the dialog
692 // The template type deduction ensures consistency between the argument type
693 // and the event type. It does not (yet) ensure correctness of the type of
694 // the handler object.
695 template< typename Tag, typename Argument, typename Handler >
697 wxEventTypeTag<Tag> eventType,
698 void (Handler::*func)(Argument&)
699 )
700 -> std::enable_if_t<
701 std::is_base_of_v<Argument, Tag>,
702 ShuttleGui& >
703 {
704 std::move( mItem ).ConnectRoot( eventType, func );
705 return *this;
706 }
707
708 ShuttleGui & Position( int flags )
709 {
710 std::move( mItem ).Position( flags );
711 return *this;
712 }
713
714 ShuttleGui & Size( wxSize size )
715 {
716 std::move( mItem ).Size( size );
717 return *this;
718 }
719
720 // Prop() sets the proportion value, defined as in wxSizer::Add().
721 ShuttleGui & Prop( int iProp ){ ShuttleGuiBase::Prop(iProp); return *this;}; // Has to be here too, to return a ShuttleGui and not a ShuttleGuiBase.
722
723 ShuttleGui & Style( long iStyle )
724 {
725 std::move( mItem ).Style( iStyle );
726 return *this;
727 }
728
729 ShuttleGui &MinSize() // set best size as min size
730 { std::move( mItem ).MinSize(); return *this; }
731 ShuttleGui &MinSize( wxSize sz )
732 { std::move( mItem ).MinSize( sz ); return *this; }
733
734 // The first of these buttons, if any, that is included will be default:
735 // Apply, Yes, OK
736 void AddStandardButtons(
737 long buttons = eOkButton | eCancelButton, wxWindow *extra = NULL );
738
739 wxSizerItem * AddSpace( int width, int height, int prop = 0 );
740 wxSizerItem * AddSpace( int size ) { return AddSpace( size, size ); };
741
742 // Calculate width of a choice control adequate for the items, maybe after
743 // the dialog is created but the items change.
744 static void SetMinSize( wxWindow *window, const TranslatableStrings & items );
745 static void SetMinSize( wxWindow *window, const wxArrayStringEx & items );
746 // static void SetMinSize( wxWindow *window, const std::vector<int> & items );
747
748 teShuttleMode GetMode() { return mShuttleMode; };
749};
750
752AUDACITY_DLL_API TranslatableStrings Msgids(
753 const EnumValueSymbol strings[], size_t nStrings);
754
756AUDACITY_DLL_API TranslatableStrings Msgids( const std::vector<EnumValueSymbol> &strings );
757
758#endif
int min(int a, int b)
const TranslatableString name
Definition: Distortion.cpp:82
int format
Definition: ExportPCM.cpp:56
teShuttleMode
Definition: ShuttleGui.h:38
@ eIsSettingToDialog
Definition: ShuttleGui.h:41
@ eIsCreating
Definition: ShuttleGui.h:39
@ eIsCreatingFromPrefs
Definition: ShuttleGui.h:48
@ eIsSavingToPrefs
Definition: ShuttleGui.h:49
@ eIsGettingFromDialog
Definition: ShuttleGui.h:40
@ eIsGettingMetadata
Definition: ShuttleGui.h:42
AUDACITY_DLL_API std::unique_ptr< wxSizer > CreateStdButtonSizer(wxWindow *parent, long buttons=eOkButton|eCancelButton, wxWindow *extra=NULL)
AUDACITY_DLL_API TranslatableStrings Msgids(const EnumValueSymbol strings[], size_t nStrings)
Convenience function often useful when adding choice controls.
@ eCloseID
Definition: ShuttleGui.h:619
@ ePreviewID
Definition: ShuttleGui.h:614
@ eDebugID
Definition: ShuttleGui.h:616
@ eSettingsID
Definition: ShuttleGui.h:617
@ ePreviewDryID
Definition: ShuttleGui.h:618
const int nMaxNestedSizers
Definition: ShuttleGui.h:35
@ eOkButton
Definition: ShuttleGui.h:597
@ eApplyButton
Definition: ShuttleGui.h:606
@ eYesButton
Definition: ShuttleGui.h:599
@ eCancelButton
Definition: ShuttleGui.h:598
@ ePreviewDryButton
Definition: ShuttleGui.h:605
@ eCloseButton
Definition: ShuttleGui.h:607
@ eHelpButton
Definition: ShuttleGui.h:601
@ eNoButton
Definition: ShuttleGui.h:600
@ ePreviewButton
Definition: ShuttleGui.h:602
@ eDebugButton
Definition: ShuttleGui.h:603
@ eSettingsButton
Definition: ShuttleGui.h:604
wxWindow wxNotebookPage
Definition: ShuttleGui.h:62
void SetIfCreated(wxChoice *&Var, wxChoice *Val)
std::vector< TranslatableString > TranslatableStrings
An AttachableScrollBar is a scroll bar that can be attached to multiple items and so control their sc...
This specialization of Setting for bool adds a Toggle method to negate the saved value.
Definition: Prefs.h:339
ComponentInterfaceSymbol pairs a persistent string identifier used internally with an optional,...
Specialization of Setting for double.
Definition: Prefs.h:356
Specialization of Setting for int.
Definition: Prefs.h:349
Definition: Prefs.h:173
Base class for shuttling data to and from a GUI.
Definition: ShuttleGui.h:242
void SetBorder(int Border)
Definition: ShuttleGui.h:486
wxWindow *const mpDlg
Definition: ShuttleGui.h:527
void StartTwoColumn()
Definition: ShuttleGui.h:366
wxString mRadioValueString
The index of this radio item. -1 for none.
Definition: ShuttleGui.h:574
wxWindow * GetParent()
Definition: ShuttleGui.h:493
DialogDefinition::Item mItem
Definition: ShuttleGui.h:579
wxCheckBox * AddCheckBoxOnRight(const TranslatableString &Prompt, const wxChar *)=delete
wxSizer * GetSizer()
Definition: ShuttleGui.h:503
void StartThreeColumn()
Definition: ShuttleGui.h:368
void EndTwoColumn()
Definition: ShuttleGui.h:367
wxCheckBox * AddCheckBox(const TranslatableString &Prompt, const wxChar *)=delete
std::vector< EnumValueSymbol > mRadioSymbols
Definition: ShuttleGui.h:570
wxSlider * AddVSlider(const TranslatableString &Prompt, int pos, int Max)
wxCheckBox * AddCheckBoxOnRight(const TranslatableString &Prompt, const char *)=delete
wxSizer * mpSizer
Definition: ShuttleGui.h:551
void EndThreeColumn()
Definition: ShuttleGui.h:369
std::optional< WrappedType > mRadioValue
The setting controlled by a group.
Definition: ShuttleGui.h:572
wxString mRadioSettingName
Definition: ShuttleGui.h:571
ShuttleGuiBase & Prop(int iProp)
Definition: ShuttleGui.cpp:883
wxCheckBox * AddCheckBox(const TranslatableString &Prompt, const char *)=delete
bool * mpbOptionalFlag
Definition: ShuttleGui.h:548
wxWindow * mpParent
Definition: ShuttleGui.h:552
std::unique_ptr< Shuttle > mpShuttle
Definition: ShuttleGui.h:530
int mRadioCount
The wrapped value associated with the active radio button.
Definition: ShuttleGui.h:573
teShuttleMode mShuttleMode
Used in choices to determine which item to use on no match.
Definition: ShuttleGui.h:534
wxWindow * mpWind
Definition: ShuttleGui.h:553
int miNoMatchSelector
Definition: ShuttleGui.h:532
std::unique_ptr< wxSizer > mpSubSizer
Definition: ShuttleGui.h:550
Derived from ShuttleGuiBase, an Audacity specific class for shuttling data to and from GUI.
Definition: ShuttleGui.h:628
ShuttleGui & NameSuffix(const TranslatableString &suffix)
Definition: ShuttleGui.h:668
ShuttleGui & Validator(const Factory &f)
Definition: ShuttleGui.h:675
teShuttleMode GetMode()
Definition: ShuttleGui.h:748
ShuttleGui & ToolTip(const TranslatableString &tip)
Definition: ShuttleGui.h:653
ShuttleGui & Prop(int iProp)
Definition: ShuttleGui.h:721
ShuttleGui & Focus(bool focused=true)
Definition: ShuttleGui.h:641
ShuttleGui & MinSize()
Definition: ShuttleGui.h:729
ShuttleGui & Name(const TranslatableString &name)
Definition: ShuttleGui.h:660
ShuttleGui & Style(long iStyle)
Definition: ShuttleGui.h:723
ShuttleGui & MinSize(wxSize sz)
Definition: ShuttleGui.h:731
ShuttleGui & Position(int flags)
Definition: ShuttleGui.h:708
auto ConnectRoot(wxEventTypeTag< Tag > eventType, void(Handler::*func)(Argument &)) -> std::enable_if_t< std::is_base_of_v< Argument, Tag >, ShuttleGui & >
Definition: ShuttleGui.h:696
ShuttleGui & Disable(bool disabled=true)
Definition: ShuttleGui.h:647
ShuttleGui & Size(wxSize size)
Definition: ShuttleGui.h:714
wxSizerItem * AddSpace(int size)
Definition: ShuttleGui.h:740
ShuttleGui & Validator(Args &&...args)
Definition: ShuttleGui.h:684
Moves data from one place to another, converting it as required.
Definition: Shuttle.h:70
Specialization of Setting for strings.
Definition: Prefs.h:363
Holds a msgid for the translation catalog; may also bind format arguments.
Used in type conversions, this wrapper for ints, strings, doubles and enums provides conversions betw...
Definition: WrappedType.h:31
Extend wxArrayString with move operations and construction and insertion fromstd::initializer_list.
void SetFocus() override
Definition: ShuttleGui.cpp:582
wxStaticBoxWrapper(Args &&...args)
Definition: ShuttleGui.h:89
STL namespace.
Item && Focus(bool focused=true) &&
Definition: ShuttleGui.h:158
Item && Disable(bool disabled=true) &&
Definition: ShuttleGui.h:164
Item && Style(long style) &&
Definition: ShuttleGui.h:151
std::function< void(wxWindow *) > mValidatorSetter
Definition: ShuttleGui.h:216
Item && Name(const TranslatableString &name) &&
Definition: ShuttleGui.h:137
Item && Position(int flags) &&
Definition: ShuttleGui.h:204
std::vector< std::pair< wxEventType, wxObjectEventFunction > > mRootConnections
Definition: ShuttleGui.h:221
Item && MinSize() &&
Definition: ShuttleGui.h:192
Item && NameSuffix(const TranslatableString &suffix) &&
Definition: ShuttleGui.h:145
Item && ToolTip(const TranslatableString &tip) &&
Definition: ShuttleGui.h:130
TranslatableString mToolTip
Definition: ShuttleGui.h:217
Item && MinSize(wxSize sz) &&
Definition: ShuttleGui.h:198
Item && Validator(Args &&... args) &&
Definition: ShuttleGui.h:127
TranslatableString mName
Definition: ShuttleGui.h:218
auto ConnectRoot(wxEventTypeTag< Tag > eventType, void(Handler::*func)(Argument &)) &&-> std::enable_if_t< std::is_base_of_v< Argument, Tag >, Item && >
Definition: ShuttleGui.h:175
Item && Validator(const Factory &f) &&
Definition: ShuttleGui.h:119
TranslatableString mNameSuffix
Definition: ShuttleGui.h:219
Item && Size(wxSize size) &&
Definition: ShuttleGui.h:210
ListControlColumn(const TranslatableString &h, int f=wxLIST_FORMAT_LEFT, int w=wxLIST_AUTOSIZE)
Definition: ShuttleGui.h:305