Audacity  3.0.3
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:
Collaboration diagram for AudacityCommandDialog:

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

Detailed Description

Default dialog used for commands. Is populated using ShuttleGui.

Definition at line 142 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 257 of file AudacityCommand.cpp.

263 : wxDialogWrapper(parent, wxID_ANY, title, wxDefaultPosition, wxDefaultSize, flags)
264 {
265  mType = type;
266  wxASSERT( pCommand );
267  mpCommand = pCommand;
268  mAdditionalButtons = additionalButtons |eCancelButton;
269  if( !pCommand->ManualPage().empty() )
271 }

References eCancelButton, and eHelpButton.

Member Function Documentation

◆ Init()

bool AudacityCommandDialog::Init ( )

Definition at line 273 of file AudacityCommand.cpp.

274 {
275  ShuttleGui S(this, eIsCreating);
277  S.SetBorder(5);
278  S.StartVerticalLay(true);
279  {
282  long buttons = eOkButton;
283  S.AddStandardButtons(buttons|mAdditionalButtons);
284  }
285  S.EndVerticalLay();
287  Layout();
288  Fit();
289  SetMinSize(GetSize());
290  Center();
291  return true;
292 }

References ShuttleGui::AddStandardButtons(), eIsCreating, ShuttleGuiBase::EndVerticalLay(), eOkButton, mAdditionalButtons, PopulateOrExchange(), ShuttleGuiBase::SetBorder(), and ShuttleGuiBase::StartVerticalLay().

Here is the call graph for this function:

◆ OnCancel()

void AudacityCommandDialog::OnCancel ( wxCommandEvent &  evt)

Definition at line 336 of file AudacityCommand.cpp.

337 {
338  EndModal(false);
339 }

◆ OnHelp()

void AudacityCommandDialog::OnHelp ( wxCommandEvent &  evt)

Definition at line 341 of file AudacityCommand.cpp.

342 {
343  if( mpCommand )
344  {
345  // otherwise use ShowHelp
346  HelpSystem::ShowHelp(FindWindow(wxID_HELP), mpCommand->ManualPage(), true);
347  }
348 }

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

Here is the call graph for this function:

◆ OnOk()

void AudacityCommandDialog::OnOk ( wxCommandEvent &  evt)

Definition at line 322 of file AudacityCommand.cpp.

323 {
324  // On wxGTK (wx2.8.12), the default action is still executed even if
325  // the button is disabled. This appears to affect all wxDialogs, not
326  // just our AudacityCommands dialogs. So, this is a only temporary workaround
327  // for legacy effects that disable the OK button. Hopefully this has
328  // been corrected in wx3.
329  if (FindWindow(wxID_OK)->IsEnabled() && Validate() && TransferDataFromWindow())
330  {
331  EndModal(true);
332  }
333 }

References TransferDataFromWindow(), and Validate().

Here is the call graph for this function:

◆ PopulateOrExchange()

void AudacityCommandDialog::PopulateOrExchange ( ShuttleGui S)

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

298 {
299  wxASSERT( mpCommand );
301 }

References mpCommand, and AudacityCommand::PopulateOrExchange().

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 ( )

Definition at line 310 of file AudacityCommand.cpp.

311 {
314  return true;
315 }

References eIsGettingFromDialog, and PopulateOrExchange().

Referenced by OnOk().

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

◆ TransferDataToWindow()

bool AudacityCommandDialog::TransferDataToWindow ( )

Definition at line 303 of file AudacityCommand.cpp.

304 {
307  return true;
308 }

References eIsSettingToDialog, and PopulateOrExchange().

Here is the call graph for this function:

◆ Validate()

bool AudacityCommandDialog::Validate ( )

Definition at line 317 of file AudacityCommand.cpp.

318 {
319  return true;
320 }

Referenced by OnOk().

Here is the caller graph for this function:


AudacityCommandDialog::wxDECLARE_NO_COPY_CLASS ( AudacityCommandDialog  )

Member Data Documentation

◆ mAdditionalButtons

int AudacityCommandDialog::mAdditionalButtons

Definition at line 166 of file AudacityCommand.h.

Referenced by Init().

◆ mpCommand

AudacityCommand* AudacityCommandDialog::mpCommand

Definition at line 167 of file AudacityCommand.h.

Referenced by OnHelp(), and PopulateOrExchange().

◆ mType

int AudacityCommandDialog::mType

Definition at line 165 of file AudacityCommand.h.

The documentation for this class was generated from the following files:
@ eIsCreating
Definition: ShuttleGui.h:38
virtual void PopulateOrExchange(ShuttleGui &WXUNUSED(S))
Definition: AudacityCommand.h:122
@ eIsGettingFromDialog
Definition: ShuttleGui.h:39
@ eHelpButton
Definition: ShuttleGui.h:604
virtual ManualPageID ManualPage()
Definition: AudacityCommand.h:68
bool TransferDataFromWindow() override
Definition: AudacityCommand.cpp:310
static void ShowHelp(wxWindow *parent, const FilePath &localFileName, const URLString &remoteURL, bool bModal=false, bool alwaysDefaultBrowser=false)
Definition: HelpSystem.cpp:237
@ eIsSettingToDialog
Definition: ShuttleGui.h:40
virtual void PopulateOrExchange(ShuttleGui &S)
Definition: AudacityCommand.cpp:297
@ eCancelButton
Definition: ShuttleGui.h:601
AudacityCommand * mpCommand
Definition: AudacityCommand.h:167
static const auto title
Definition: NoUpdatesAvailableDialog.cpp:22
@ eOkButton
Definition: ShuttleGui.h:600
int mAdditionalButtons
Definition: AudacityCommand.h:166
Definition: wxPanelWrapper.h:84
int mType
Definition: AudacityCommand.h:165
bool empty() const
Definition: Identifier.h:61
bool Validate() override
Definition: AudacityCommand.cpp:317
Derived from ShuttleGuiBase, an Audacity specific class for shuttling data to and from GUI.
Definition: ShuttleGui.h:631