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

246: wxDialogWrapper(parent, wxID_ANY, title, wxDefaultPosition, wxDefaultSize, flags)
247{
248 mType = type;
249 wxASSERT( pCommand );
250 mpCommand = pCommand;
251 mAdditionalButtons = additionalButtons |eCancelButton;
252 if( !pCommand->ManualPage().empty() )
254}
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 256 of file AudacityCommand.cpp.

257{
258 ShuttleGui S(this, eIsCreating);
259
260 S.SetBorder(5);
261 S.StartVerticalLay(true);
262 {
264
265 long buttons = eOkButton;
266 S.AddStandardButtons(buttons|mAdditionalButtons);
267 }
268 S.EndVerticalLay();
269
270 Layout();
271 Fit();
272 SetMinSize(GetSize());
273 Center();
274 return true;
275}
@ 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 319 of file AudacityCommand.cpp.

320{
321 EndModal(false);
322}

◆ OnHelp()

void AudacityCommandDialog::OnHelp ( wxCommandEvent &  evt)
virtual

Definition at line 324 of file AudacityCommand.cpp.

325{
326 if( mpCommand )
327 {
328 // otherwise use ShowHelp
329 HelpSystem::ShowHelp(FindWindow(wxID_HELP), mpCommand->ManualPage(), true);
330 }
331}
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 305 of file AudacityCommand.cpp.

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

281{
282 wxASSERT( mpCommand );
284}
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 293 of file AudacityCommand.cpp.

294{
297 return true;
298}
@ 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 286 of file AudacityCommand.cpp.

287{
290 return true;
291}
@ 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 300 of file AudacityCommand.cpp.

301{
302 return true;
303}

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 165 of file AudacityCommand.h.

Referenced by Init().

◆ mpCommand

AudacityCommand* AudacityCommandDialog::mpCommand
private

Definition at line 166 of file AudacityCommand.h.

Referenced by OnHelp(), and PopulateOrExchange().

◆ mType

int AudacityCommandDialog::mType
private

Definition at line 164 of file AudacityCommand.h.


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