Audacity 3.2.0
Public Member Functions | Private Member Functions | Private Attributes | List of all members
AudacityCommandDialog Class Reference

Default dialog used for commands. Is populated using ShuttleGui. More...

#include <AudacityCommand.h>

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

Public Member Functions

 AudacityCommandDialog (wxWindow *parent, const TranslatableString &title, AudacityCommand *pCommand, int type=0, int flags=wxDEFAULT_DIALOG_STYLE, int additionalButtons=0)
 
bool Init ()
 
bool TransferDataToWindow () override
 
bool TransferDataFromWindow () override
 
bool Validate () override
 
virtual void PopulateOrExchange (ShuttleGui &S)
 
virtual void OnOk (wxCommandEvent &evt)
 
virtual void OnCancel (wxCommandEvent &evt)
 
virtual void OnHelp (wxCommandEvent &evt)
 
- 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

 wxDECLARE_NO_COPY_CLASS (AudacityCommandDialog)
 

Private Attributes

int mType
 
int mAdditionalButtons
 
AudacityCommandmpCommand
 

Detailed Description

Default dialog used for commands. Is populated using ShuttleGui.

Definition at line 140 of file AudacityCommand.h.

Constructor & Destructor Documentation

◆ AudacityCommandDialog()

AudacityCommandDialog::AudacityCommandDialog ( wxWindow *  parent,
const TranslatableString title,
AudacityCommand pCommand,
int  type = 0,
int  flags = wxDEFAULT_DIALOG_STYLE,
int  additionalButtons = 0 
)

Definition at line 244 of file AudacityCommand.cpp.

250: wxDialogWrapper(parent, wxID_ANY, title, wxDefaultPosition, wxDefaultSize, flags)
251{
252 mType = type;
253 wxASSERT( pCommand );
254 mpCommand = pCommand;
255 mAdditionalButtons = additionalButtons |eCancelButton;
256 if( !pCommand->ManualPage().empty() )
258}
static const auto title
@ eCancelButton
Definition: ShuttleGui.h:598
@ eHelpButton
Definition: ShuttleGui.h:601
AudacityCommand * mpCommand
virtual ManualPageID ManualPage()
bool empty() const
Definition: Identifier.h:61

References eCancelButton, and eHelpButton.

Member Function Documentation

◆ Init()

bool AudacityCommandDialog::Init ( )

Definition at line 260 of file AudacityCommand.cpp.

261{
262 ShuttleGui S(this, eIsCreating);
263
264 S.SetBorder(5);
265 S.StartVerticalLay(true);
266 {
268
269 long buttons = eOkButton;
270 S.AddStandardButtons(buttons|mAdditionalButtons);
271 }
272 S.EndVerticalLay();
273
274 Layout();
275 Fit();
276 SetMinSize(GetSize());
277 Center();
278 return true;
279}
@ eIsCreating
Definition: ShuttleGui.h:39
@ eOkButton
Definition: ShuttleGui.h:597
#define S(N)
Definition: ToChars.cpp:64
virtual void PopulateOrExchange(ShuttleGui &S)
Derived from ShuttleGuiBase, an Audacity specific class for shuttling data to and from GUI.
Definition: ShuttleGui.h:628

References eIsCreating, eOkButton, mAdditionalButtons, PopulateOrExchange(), and S.

Here is the call graph for this function:

◆ OnCancel()

void AudacityCommandDialog::OnCancel ( wxCommandEvent &  evt)
virtual

Definition at line 323 of file AudacityCommand.cpp.

324{
325 EndModal(false);
326}

◆ OnHelp()

void AudacityCommandDialog::OnHelp ( wxCommandEvent &  evt)
virtual

Definition at line 328 of file AudacityCommand.cpp.

329{
330 if( mpCommand )
331 {
332 // otherwise use ShowHelp
333 HelpSystem::ShowHelp(FindWindow(wxID_HELP), mpCommand->ManualPage(), true);
334 }
335}
static void ShowHelp(wxWindow *parent, const FilePath &localFileName, const URLString &remoteURL, bool bModal=false, bool alwaysDefaultBrowser=false)
Definition: HelpSystem.cpp:234

References AudacityCommand::ManualPage(), mpCommand, and HelpSystem::ShowHelp().

Here is the call graph for this function:

◆ OnOk()

void AudacityCommandDialog::OnOk ( wxCommandEvent &  evt)
virtual

Definition at line 309 of file AudacityCommand.cpp.

310{
311 // On wxGTK (wx2.8.12), the default action is still executed even if
312 // the button is disabled. This appears to affect all wxDialogs, not
313 // just our AudacityCommands dialogs. So, this is a only temporary workaround
314 // for legacy effects that disable the OK button. Hopefully this has
315 // been corrected in wx3.
316 if (FindWindow(wxID_OK)->IsEnabled() && Validate() && TransferDataFromWindow())
317 {
318 EndModal(true);
319 }
320}
bool Validate() override
bool TransferDataFromWindow() override

References TransferDataFromWindow(), and Validate().

Here is the call graph for this function:

◆ PopulateOrExchange()

void AudacityCommandDialog::PopulateOrExchange ( ShuttleGui S)
virtual

This is a virtual function which will be overridden to provide the actual parameters that we want for each kind of dialog.

Definition at line 284 of file AudacityCommand.cpp.

285{
286 wxASSERT( mpCommand );
288}
virtual void PopulateOrExchange(ShuttleGui &WXUNUSED(S))

References mpCommand, AudacityCommand::PopulateOrExchange(), and S.

Referenced by Init(), TransferDataFromWindow(), and TransferDataToWindow().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ TransferDataFromWindow()

bool AudacityCommandDialog::TransferDataFromWindow ( )
override

Definition at line 297 of file AudacityCommand.cpp.

298{
301 return true;
302}
@ eIsGettingFromDialog
Definition: ShuttleGui.h:40

References eIsGettingFromDialog, PopulateOrExchange(), and S.

Referenced by OnOk().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ TransferDataToWindow()

bool AudacityCommandDialog::TransferDataToWindow ( )
override

Definition at line 290 of file AudacityCommand.cpp.

291{
294 return true;
295}
@ eIsSettingToDialog
Definition: ShuttleGui.h:41

References eIsSettingToDialog, PopulateOrExchange(), and S.

Here is the call graph for this function:

◆ Validate()

bool AudacityCommandDialog::Validate ( )
override

Definition at line 304 of file AudacityCommand.cpp.

305{
306 return true;
307}

Referenced by OnOk().

Here is the caller graph for this function:

◆ wxDECLARE_NO_COPY_CLASS()

AudacityCommandDialog::wxDECLARE_NO_COPY_CLASS ( AudacityCommandDialog  )
private

Member Data Documentation

◆ mAdditionalButtons

int AudacityCommandDialog::mAdditionalButtons
private

Definition at line 164 of file AudacityCommand.h.

Referenced by Init().

◆ mpCommand

AudacityCommand* AudacityCommandDialog::mpCommand
private

Definition at line 165 of file AudacityCommand.h.

Referenced by OnHelp(), and PopulateOrExchange().

◆ mType

int AudacityCommandDialog::mType
private

Definition at line 163 of file AudacityCommand.h.


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