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

254: wxDialogWrapper(parent, wxID_ANY, title, wxDefaultPosition, wxDefaultSize, flags)
255{
256 mType = type;
257 wxASSERT( pCommand );
258 mpCommand = pCommand;
259 mAdditionalButtons = additionalButtons |eCancelButton;
260 if( !pCommand->ManualPage().empty() )
262}
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 264 of file AudacityCommand.cpp.

265{
266 ShuttleGui S(this, eIsCreating);
267
268 S.SetBorder(5);
269 S.StartVerticalLay(true);
270 {
272
273 long buttons = eOkButton;
274 S.AddStandardButtons(buttons|mAdditionalButtons);
275 }
276 S.EndVerticalLay();
277
278 Layout();
279 Fit();
280 SetMinSize(GetSize());
281 Center();
282 return true;
283}
@ 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 327 of file AudacityCommand.cpp.

328{
329 EndModal(false);
330}

◆ OnHelp()

void AudacityCommandDialog::OnHelp ( wxCommandEvent &  evt)
virtual

Definition at line 332 of file AudacityCommand.cpp.

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

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

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

289{
290 wxASSERT( mpCommand );
292}
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 301 of file AudacityCommand.cpp.

302{
305 return true;
306}
@ 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 294 of file AudacityCommand.cpp.

295{
298 return true;
299}
@ 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 308 of file AudacityCommand.cpp.

309{
310 return true;
311}

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: