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

Gives a warning message, that can be dismissed, with crucially the ability to not see similar warnings again for this session. More...

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

Public Member Functions

 WarningDialog (wxWindow *parent, const TranslatableString &message, const TranslatableString &footer, bool showCancelButton)
 
- 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)
 

Private Attributes

wxCheckBox * mCheckBox
 

Detailed Description

Gives a warning message, that can be dismissed, with crucially the ability to not see similar warnings again for this session.

Definition at line 30 of file Warning.cpp.

Constructor & Destructor Documentation

◆ WarningDialog()

WarningDialog::WarningDialog ( wxWindow *  parent,
const TranslatableString message,
const TranslatableString footer,
bool  showCancelButton 
)

Definition at line 57 of file Warning.cpp.

60: wxDialogWrapper(parent, wxID_ANY, XO("Warning"),
61 wxDefaultPosition, wxDefaultSize,
62 (showCancelButton ? wxDEFAULT_DIALOG_STYLE : wxCAPTION | wxSYSTEM_MENU)) // Unlike wxDEFAULT_DIALOG_STYLE, no wxCLOSE_BOX.
63{
64 SetName();
65
66 SetIcon(wxArtProvider::GetIcon(wxART_WARNING, wxART_MESSAGE_BOX));
68
69 S.SetBorder(10);
70 S.StartVerticalLay(false);
71 {
72 S.AddFixedText(message);
73 mCheckBox = S.AddCheckBox(footer, false);
74 }
75 S.EndVerticalLay();
76
77 S.SetBorder(0);
78 S.AddStandardButtons(showCancelButton ? eOkButton | eCancelButton : eOkButton);
79
80 Layout();
81 GetSizer()->Fit(this);
82 CentreOnParent();
83}
XO("Cut/Copy/Paste")
@ eIsCreating
Definition: ShuttleGui.h:37
@ eOkButton
Definition: ShuttleGui.h:609
@ eCancelButton
Definition: ShuttleGui.h:610
#define S(N)
Definition: ToChars.cpp:64
Derived from ShuttleGuiBase, an Audacity specific class for shuttling data to and from GUI.
Definition: ShuttleGui.h:640
wxCheckBox * mCheckBox
Definition: Warning.cpp:42

References eCancelButton, eIsCreating, eOkButton, mCheckBox, S, and wxDialogWrapper::SetName().

Here is the call graph for this function:

Member Function Documentation

◆ OnOK()

void WarningDialog::OnOK ( wxCommandEvent &  event)
private

Definition at line 85 of file Warning.cpp.

86{
87 EndModal(mCheckBox->GetValue() ? wxID_NO : wxID_YES); // return YES, if message should be shown again
88}

References mCheckBox.

Member Data Documentation

◆ mCheckBox

wxCheckBox* WarningDialog::mCheckBox
private

Definition at line 42 of file Warning.cpp.

Referenced by OnOK(), and WarningDialog().


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