Audacity  3.0.3
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 32 of file Warning.cpp.

Constructor & Destructor Documentation

◆ WarningDialog()

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

Definition at line 59 of file Warning.cpp.

62 : wxDialogWrapper(parent, wxID_ANY, XO("Warning"),
63  wxDefaultPosition, wxDefaultSize,
64  (showCancelButton ? wxDEFAULT_DIALOG_STYLE : wxCAPTION | wxSYSTEM_MENU)) // Unlike wxDEFAULT_DIALOG_STYLE, no wxCLOSE_BOX.
65 {
66  SetName();
67 
68  SetIcon(wxArtProvider::GetIcon(wxART_WARNING, wxART_MESSAGE_BOX));
69  ShuttleGui S(this, eIsCreating);
70 
71  S.SetBorder(10);
72  S.StartVerticalLay(false);
73  {
74  S.AddFixedText(message);
75  mCheckBox = S.AddCheckBox(footer, false);
76  }
77  S.EndVerticalLay();
78 
79  S.SetBorder(0);
80  S.AddStandardButtons(showCancelButton ? eOkButton | eCancelButton : eOkButton);
81 
82  Layout();
83  GetSizer()->Fit(this);
84  CentreOnParent();
85 }

References ShuttleGuiBase::AddCheckBox(), ShuttleGuiBase::AddFixedText(), ShuttleGui::AddStandardButtons(), eCancelButton, eIsCreating, ShuttleGuiBase::EndVerticalLay(), eOkButton, mCheckBox, ShuttleGuiBase::SetBorder(), wxDialogWrapper::SetName(), and ShuttleGuiBase::StartVerticalLay().

Here is the call graph for this function:

Member Function Documentation

◆ OnOK()

void WarningDialog::OnOK ( wxCommandEvent &  event)
private

Definition at line 87 of file Warning.cpp.

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

References mCheckBox.

Member Data Documentation

◆ mCheckBox

wxCheckBox* WarningDialog::mCheckBox
private

Definition at line 44 of file Warning.cpp.

Referenced by OnOK(), and WarningDialog().


The documentation for this class was generated from the following file:
eIsCreating
@ eIsCreating
Definition: ShuttleGui.h:38
XO
#define XO(s)
Definition: Internat.h:31
eCancelButton
@ eCancelButton
Definition: ShuttleGui.h:601
eOkButton
@ eOkButton
Definition: ShuttleGui.h:600
wxDialogWrapper::wxDialogWrapper
wxDialogWrapper()
Definition: wxPanelWrapper.h:84
WarningDialog::mCheckBox
wxCheckBox * mCheckBox
Definition: Warning.cpp:44
wxDialogWrapper::SetName
void SetName()
Definition: wxPanelWrapper.cpp:81
ShuttleGui
Derived from ShuttleGuiBase, an Audacity specific class for shuttling data to and from GUI.
Definition: ShuttleGui.h:631