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

A multi purpose dialog, mainly used to show lists of orphaned or damaged block files. It is a good alternative to having a dialog pop up for each problem encountered, since there can be many orphans. 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 wxString &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 multi purpose dialog, mainly used to show lists of orphaned or damaged block files. It is a good alternative to having a dialog pop up for each problem encountered, since there can be many orphans.

Definition at line 45 of file MultiDialog.cpp.

Constructor & Destructor Documentation

◆ MultiDialog()

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

Definition at line 75 of file MultiDialog.cpp.

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

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

Here is the call graph for this function:

◆ ~MultiDialog()

MultiDialog::~MultiDialog ( )
inline

Definition at line 54 of file MultiDialog.cpp.

54 {};

Member Function Documentation

◆ OnHelp()

void MultiDialog::OnHelp ( wxCommandEvent &  event)
private

Definition at line 175 of file MultiDialog.cpp.

176 {
177  HelpSystem::ShowHelp(FindWindow(wxID_HELP), mHelpPage, true);
178 }

References mHelpPage, and HelpSystem::ShowHelp().

Here is the call graph for this function:

◆ OnOK()

void MultiDialog::OnOK ( wxCommandEvent &  event)
private

Definition at line 165 of file MultiDialog.cpp.

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

References mRadioBox.

◆ OnShowLog()

void MultiDialog::OnShowLog ( wxCommandEvent &  event)
private

Definition at line 170 of file MultiDialog.cpp.

171 {
172  LogWindow::Show();
173 }

References LogWindow::Show().

Here is the call graph for this function:

Member Data Documentation

◆ mHelpPage

ManualPageID MultiDialog::mHelpPage
private

Definition at line 62 of file MultiDialog.cpp.

Referenced by OnHelp().

◆ mRadioBox

wxRadioBox* MultiDialog::mRadioBox
private

Definition at line 61 of file MultiDialog.cpp.

Referenced by OnOK().


The documentation for this class was generated from the following file:
eIsCreating
@ eIsCreating
Definition: ShuttleGui.h:38
LogWindow::Show
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
XO
#define XO(s)
Definition: Internat.h:31
ID_SHOW_LOG_BUTTON
#define ID_SHOW_LOG_BUTTON
Definition: MultiDialog.cpp:67
HelpSystem::ShowHelp
static void ShowHelp(wxWindow *parent, const FilePath &localFileName, const URLString &remoteURL, bool bModal=false, bool alwaysDefaultBrowser=false)
Definition: HelpSystem.cpp:237
MultiDialog::mRadioBox
wxRadioBox * mRadioBox
Definition: MultiDialog.cpp:61
ThemeBase::Bitmap
wxBitmap & Bitmap(int iIndex)
Definition: Theme.cpp:1209
MultiDialog::mHelpPage
ManualPageID mHelpPage
Definition: MultiDialog.cpp:62
XXO
#define XXO(s)
Definition: Internat.h:44
theTheme
THEME_API Theme theTheme
Definition: Theme.cpp:79
title
static const auto title
Definition: NoUpdatesAvailableDialog.cpp:22
wxDialogWrapper::wxDialogWrapper
wxDialogWrapper()
Definition: wxPanelWrapper.h:84
TranslatableString::Translation
wxString Translation() const
Definition: TranslatableString.h:79
wxDialogWrapper::SetName
void SetName()
Definition: wxPanelWrapper.cpp:81
safenew
#define safenew
Definition: MemoryX.h:10
Identifier::empty
bool empty() const
Definition: Identifier.h:61
ShuttleGui
Derived from ShuttleGuiBase, an Audacity specific class for shuttling data to and from GUI.
Definition: ShuttleGui.h:631