Audacity 3.2.0
Public Member Functions | Private Member Functions | Private Attributes | List of all members
MultiDialog Class Referencefinal

A dialog presenting an exclusive, multiple choice, help button, and log info. More...

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

Public Member Functions

 MultiDialog (wxWindow *pParent, const TranslatableString &message, const TranslatableString &title, const TranslatableStrings &buttons, const ManualPageID &helpPage, const TranslatableString &boxMsg, bool log)
 
 ~MultiDialog ()
 
- Public Member Functions inherited from wxDialogWrapper
 wxDialogWrapper ()
 
 wxDialogWrapper (wxWindow *parent, wxWindowID id, const TranslatableString &title, const wxPoint &pos=wxDefaultPosition, const wxSize &size=wxDefaultSize, long style=wxDEFAULT_DIALOG_STYLE, const TranslatableString &name=XO("Dialog"))
 
bool Create (wxWindow *parent, wxWindowID id, const TranslatableString &title, const wxPoint &pos=wxDefaultPosition, const wxSize &size=wxDefaultSize, long style=wxDEFAULT_DIALOG_STYLE, const TranslatableString &name=XO("Dialog"))
 
void SetTitle (const TranslatableString &title)
 
void SetLabel (const TranslatableString &title)
 
void SetName (const TranslatableString &title)
 
void SetName ()
 
- Public Member Functions inherited from wxTabTraversalWrapper< wxDialog >
 wxTabTraversalWrapper (Args &&... args)
 
 wxTabTraversalWrapper (const wxTabTraversalWrapper &)=delete
 
 wxTabTraversalWrapper (wxTabTraversalWrapper &&)=delete
 
wxTabTraversalWrapperoperator= (const wxTabTraversalWrapper &)=delete
 
wxTabTraversalWrapperoperator= (wxTabTraversalWrapper &&)=delete
 

Private Member Functions

void OnOK (wxCommandEvent &event)
 
void OnShowLog (wxCommandEvent &event)
 
void OnHelp (wxCommandEvent &event)
 

Private Attributes

wxRadioBox * mRadioBox
 
ManualPageID mHelpPage
 

Detailed Description

A dialog presenting an exclusive, multiple choice, help button, and log info.

Definition at line 39 of file MultiDialog.cpp.

Constructor & Destructor Documentation

◆ MultiDialog()

MultiDialog::MultiDialog ( wxWindow *  pParent,
const TranslatableString message,
const TranslatableString title,
const TranslatableStrings buttons,
const ManualPageID helpPage,
const TranslatableString boxMsg,
bool  log 
)

Definition at line 69 of file MultiDialog.cpp.

77 : wxDialogWrapper(pParent, wxID_ANY, title,
78 wxDefaultPosition, wxDefaultSize,
79 wxCAPTION), // not wxDEFAULT_DIALOG_STYLE because we don't want wxCLOSE_BOX and wxSYSTEM_MENU
80 mHelpPage( helpPage)
81{
82 SetName();
83
84 ShuttleGui S{ this, eIsCreating };
85 {
86 S.SetBorder( 5 );
87 S.StartVerticalLay( 0 );
88 {
89 S.StartHorizontalLay(wxALIGN_LEFT | wxALL, 0);
90 {
91 S.SetBorder( 0 );
92 wxBitmap bitmap = wxArtProvider::GetIcon(wxART_WARNING,
93 wxART_MESSAGE_BOX);
94 auto icon = safenew wxStaticBitmap(S.GetParent(), -1, bitmap);
95 S
96 .Position( wxCENTER )
97 .AddWindow( icon );
98
99 S.SetBorder( 15 );
100 S.Prop(1).AddVariableText( message, false, wxCENTER | wxLEFT );
101 }
102 S.EndHorizontalLay();
103
104 const auto buttonLabels = transform_container<wxArrayStringEx>(
105 buttons, std::mem_fn( &TranslatableString::Translation ) );
106
107 const auto count = buttons.size();
108
109 const auto boxStr = boxMsg.Translation();
110
111 S.SetBorder( 5 );
112
113 mRadioBox = safenew wxRadioBox(S.GetParent(), -1,
114 boxStr,
115 wxDefaultPosition, wxDefaultSize,
116 count, count ? &buttonLabels[0] : nullptr,
117 1, wxRA_SPECIFY_COLS);
118 mRadioBox->SetSelection(0);
119 S.Prop( 1 )
120 .Name( boxMsg )
121 .Position(wxEXPAND | wxALL)
122 .AddWindow( mRadioBox );
123
124
125 S.StartHorizontalLay(wxALIGN_CENTER | wxALL, 0);
126 {
127 if (log)
128 {
129 S
131 .AddButton(
132 XXO("Show Log for Details"), wxALIGN_LEFT | wxALL,
133 // set default to encourage user to look at files.
134 true);
135
136 S.AddSpace(40, 0);
137 }
138
139 auto pButton = S.Id(wxID_OK)
140 .AddButton(XXO("OK"), wxALIGN_CENTER, !log);
141
142 if (!mHelpPage.empty()) {
143 auto pHelpBtn = S.Id(wxID_HELP)
144 .AddBitmapButton(theTheme.Bitmap(bmpHelpIcon), wxALIGN_CENTER, false);
145 pHelpBtn->SetToolTip(XO("Help").Translation());
146 pHelpBtn->SetLabel(XO("Help").Translation()); // for screen readers
147 }
148 }
149 S.EndHorizontalLay();
150 }
151 S.EndVerticalLay();
152 }
153
154 SetAutoLayout(true);
155 GetSizer()->Fit(this);
156 GetSizer()->SetSizeHints(this);
157}
XO("Cut/Copy/Paste")
XXO("&Cut/Copy/Paste Toolbar")
#define safenew
Definition: MemoryX.h:10
#define ID_SHOW_LOG_BUTTON
Definition: MultiDialog.cpp:61
static const auto title
@ eIsCreating
Definition: ShuttleGui.h:37
THEME_API Theme theTheme
Definition: Theme.cpp:82
#define S(N)
Definition: ToChars.cpp:64
bool empty() const
Definition: Identifier.h:61
ManualPageID mHelpPage
Definition: MultiDialog.cpp:56
wxRadioBox * mRadioBox
Definition: MultiDialog.cpp:55
Derived from ShuttleGuiBase, an Audacity specific class for shuttling data to and from GUI.
Definition: ShuttleGui.h:640
wxBitmap & Bitmap(int iIndex)
wxString Translation() const

References ThemeBase::Bitmap(), eIsCreating, ID_SHOW_LOG_BUTTON, S, safenew, theTheme, TranslatableString::Translation(), XO(), and XXO().

Here is the call graph for this function:

◆ ~MultiDialog()

MultiDialog::~MultiDialog ( )
inline

Definition at line 48 of file MultiDialog.cpp.

48{};

Member Function Documentation

◆ OnHelp()

void MultiDialog::OnHelp ( wxCommandEvent &  event)
private

Definition at line 169 of file MultiDialog.cpp.

170{
171 HelpSystem::ShowHelp(FindWindow(wxID_HELP), mHelpPage, true);
172}
static void ShowHelp(wxWindow *parent, const FilePath &localFileName, const URLString &remoteURL, bool bModal=false, bool alwaysDefaultBrowser=false)
Definition: HelpSystem.cpp:231

References mHelpPage, and HelpSystem::ShowHelp().

Here is the call graph for this function:

◆ OnOK()

void MultiDialog::OnOK ( wxCommandEvent &  event)
private

Definition at line 159 of file MultiDialog.cpp.

160{
161 EndModal(mRadioBox->GetSelection());
162}

References mRadioBox.

◆ OnShowLog()

void MultiDialog::OnShowLog ( wxCommandEvent &  event)
private

Definition at line 164 of file MultiDialog.cpp.

165{
167}
static void Show(bool show=true)
Show or hide the unique logging window; create it on demand the first time it is shown.
Definition: LogWindow.cpp:61

References LogWindow::Show().

Here is the call graph for this function:

Member Data Documentation

◆ mHelpPage

ManualPageID MultiDialog::mHelpPage
private

Definition at line 56 of file MultiDialog.cpp.

Referenced by OnHelp().

◆ mRadioBox

wxRadioBox* MultiDialog::mRadioBox
private

Definition at line 55 of file MultiDialog.cpp.

Referenced by OnOK().


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