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 239 of file AudacityCommand.cpp.

245: wxDialogWrapper(parent, wxID_ANY, title, wxDefaultPosition, wxDefaultSize, flags)
246{
247 mType = type;
248 wxASSERT( pCommand );
249 mpCommand = pCommand;
250 mAdditionalButtons = additionalButtons |eCancelButton;
251 if( !pCommand->ManualPage().empty() )
253}
static const auto title
@ eCancelButton
Definition: ShuttleGui.h:610
@ eHelpButton
Definition: ShuttleGui.h:613
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 255 of file AudacityCommand.cpp.

256{
257 ShuttleGui S(this, eIsCreating);
258
259 S.SetBorder(5);
260 S.StartVerticalLay(true);
261 {
263
264 long buttons = eOkButton;
265 S.AddStandardButtons(buttons|mAdditionalButtons);
266 }
267 S.EndVerticalLay();
268
269 Layout();
270 Fit();
271 SetMinSize(GetSize());
272 Center();
273 return true;
274}
@ eIsCreating
Definition: ShuttleGui.h:37
@ eOkButton
Definition: ShuttleGui.h:609
#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:640

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 318 of file AudacityCommand.cpp.

319{
320 EndModal(false);
321}

◆ OnHelp()

void AudacityCommandDialog::OnHelp ( wxCommandEvent &  evt)
virtual

Definition at line 323 of file AudacityCommand.cpp.

324{
325 if( mpCommand )
326 {
327 // otherwise use ShowHelp
328 HelpSystem::ShowHelp(FindWindow(wxID_HELP), mpCommand->ManualPage(), true);
329 }
330}
static void ShowHelp(wxWindow *parent, const FilePath &localFileName, const URLString &remoteURL, bool bModal=false, bool alwaysDefaultBrowser=false)
Definition: HelpSystem.cpp:231

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 304 of file AudacityCommand.cpp.

305{
306 // On wxGTK (wx2.8.12), the default action is still executed even if
307 // the button is disabled. This appears to affect all wxDialogs, not
308 // just our AudacityCommands dialogs. So, this is a only temporary workaround
309 // for legacy effects that disable the OK button. Hopefully this has
310 // been corrected in wx3.
311 if (FindWindow(wxID_OK)->IsEnabled() && Validate() && TransferDataFromWindow())
312 {
313 EndModal(true);
314 }
315}
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 279 of file AudacityCommand.cpp.

280{
281 wxASSERT( mpCommand );
283}
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 292 of file AudacityCommand.cpp.

293{
296 return true;
297}
@ eIsGettingFromDialog
Definition: ShuttleGui.h:38

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 285 of file AudacityCommand.cpp.

286{
289 return true;
290}
@ eIsSettingToDialog
Definition: ShuttleGui.h:39

References eIsSettingToDialog, PopulateOrExchange(), and S.

Here is the call graph for this function:

◆ Validate()

bool AudacityCommandDialog::Validate ( )
override

Definition at line 299 of file AudacityCommand.cpp.

300{
301 return true;
302}

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: