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 44 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 74 of file MultiDialog.cpp.

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

53{};

Member Function Documentation

◆ OnHelp()

void MultiDialog::OnHelp ( wxCommandEvent &  event)
private

Definition at line 174 of file MultiDialog.cpp.

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

References mHelpPage, and HelpSystem::ShowHelp().

Here is the call graph for this function:

◆ OnOK()

void MultiDialog::OnOK ( wxCommandEvent &  event)
private

Definition at line 164 of file MultiDialog.cpp.

165{
166 EndModal(mRadioBox->GetSelection());
167}

References mRadioBox.

◆ OnShowLog()

void MultiDialog::OnShowLog ( wxCommandEvent &  event)
private

Definition at line 169 of file MultiDialog.cpp.

170{
172}
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 61 of file MultiDialog.cpp.

Referenced by OnHelp().

◆ mRadioBox

wxRadioBox* MultiDialog::mRadioBox
private

Definition at line 60 of file MultiDialog.cpp.

Referenced by OnOK().


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