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 41 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 71 of file MultiDialog.cpp.

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

50{};

Member Function Documentation

◆ OnHelp()

void MultiDialog::OnHelp ( wxCommandEvent &  event)
private

Definition at line 171 of file MultiDialog.cpp.

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

References mHelpPage, and HelpSystem::ShowHelp().

Here is the call graph for this function:

◆ OnOK()

void MultiDialog::OnOK ( wxCommandEvent &  event)
private

Definition at line 161 of file MultiDialog.cpp.

162{
163 EndModal(mRadioBox->GetSelection());
164}

References mRadioBox.

◆ OnShowLog()

void MultiDialog::OnShowLog ( wxCommandEvent &  event)
private

Definition at line 166 of file MultiDialog.cpp.

167{
169}
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 58 of file MultiDialog.cpp.

Referenced by OnHelp().

◆ mRadioBox

wxRadioBox* MultiDialog::mRadioBox
private

Definition at line 57 of file MultiDialog.cpp.

Referenced by OnOK().


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