Audacity  2.3.1
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:
wxDialogWrapper wxTabTraversalWrapper< wxDialog >

Public Member Functions

 AudacityCommandDialog (wxWindow *parent, const wxString &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 wxString &title, const wxPoint &pos=wxDefaultPosition, const wxSize &size=wxDefaultSize, long style=wxDEFAULT_DIALOG_STYLE, const wxString &name=_("Dialog"))
 
bool Create (wxWindow *parent, wxWindowID id, const wxString &title, const wxPoint &pos=wxDefaultPosition, const wxSize &size=wxDefaultSize, long style=wxDEFAULT_DIALOG_STYLE, const wxString &name=_("Dialog"))
 
- 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 153 of file AudacityCommand.h.

Constructor & Destructor Documentation

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

Definition at line 263 of file AudacityCommand.cpp.

References eCancelButton, and eHelpButton.

269 : wxDialogWrapper(parent, wxID_ANY, title, wxDefaultPosition, wxDefaultSize, flags)
270 {
271  mType = type;
272  wxASSERT( pCommand );
273  mpCommand = pCommand;
274  mAdditionalButtons = additionalButtons |eCancelButton;
275  if( !pCommand->ManualPage().IsEmpty() )
277 }
AudacityCommand * mpCommand
virtual wxString ManualPage()

Member Function Documentation

bool AudacityCommandDialog::Init ( )

Definition at line 279 of file AudacityCommand.cpp.

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

280 {
281  ShuttleGui S(this, eIsCreating);
282 
283  S.SetBorder(5);
284  S.StartVerticalLay(true);
285  {
287 
288  long buttons = eOkButton;
289  S.AddStandardButtons(buttons|mAdditionalButtons);
290  }
291  S.EndVerticalLay();
292 
293  Layout();
294  Fit();
295  SetMinSize(GetSize());
296  Center();
297  return true;
298 }
Derived from ShuttleGuiBase, an Audacity specific class for shuttling data to and from GUI...
Definition: ShuttleGui.h:409
virtual void PopulateOrExchange(ShuttleGui &S)
void AudacityCommandDialog::OnCancel ( wxCommandEvent &  evt)
virtual

Definition at line 342 of file AudacityCommand.cpp.

343 {
344  EndModal(false);
345 }
void AudacityCommandDialog::OnHelp ( wxCommandEvent &  evt)
virtual

Definition at line 347 of file AudacityCommand.cpp.

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

348 {
349  if( mpCommand )
350  {
351  // otherwise use ShowHelp
352  HelpSystem::ShowHelp(FindWindow(wxID_HELP), mpCommand->ManualPage(), true);
353  }
354 }
AudacityCommand * mpCommand
static void ShowHelp(wxWindow *parent, const wxString &localFileName, const wxString &remoteURL, bool bModal=false, bool alwaysDefaultBrowser=false)
Definition: HelpSystem.cpp:194
virtual wxString ManualPage()
void AudacityCommandDialog::OnOk ( wxCommandEvent &  evt)
virtual

Definition at line 328 of file AudacityCommand.cpp.

References TransferDataFromWindow(), and Validate().

329 {
330  // On wxGTK (wx2.8.12), the default action is still executed even if
331  // the button is disabled. This appears to affect all wxDialogs, not
332  // just our AudacityCommands dialogs. So, this is a only temporary workaround
333  // for legacy effects that disable the OK button. Hopefully this has
334  // been corrected in wx3.
335  if (FindWindow(wxID_OK)->IsEnabled() && Validate() && TransferDataFromWindow())
336  {
337  EndModal(true);
338  }
339 }
bool Validate() override
bool TransferDataFromWindow() override
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 303 of file AudacityCommand.cpp.

References mpCommand, and AudacityCommand::PopulateOrExchange().

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

304 {
305  wxASSERT( mpCommand );
307 }
virtual void PopulateOrExchange(ShuttleGui &WXUNUSED(S))
AudacityCommand * mpCommand
bool AudacityCommandDialog::TransferDataFromWindow ( )
override

Definition at line 316 of file AudacityCommand.cpp.

References eIsGettingFromDialog, and PopulateOrExchange().

Referenced by OnOk().

317 {
320  return true;
321 }
Derived from ShuttleGuiBase, an Audacity specific class for shuttling data to and from GUI...
Definition: ShuttleGui.h:409
virtual void PopulateOrExchange(ShuttleGui &S)
bool AudacityCommandDialog::TransferDataToWindow ( )
override

Definition at line 309 of file AudacityCommand.cpp.

References eIsSettingToDialog, and PopulateOrExchange().

310 {
313  return true;
314 }
Derived from ShuttleGuiBase, an Audacity specific class for shuttling data to and from GUI...
Definition: ShuttleGui.h:409
virtual void PopulateOrExchange(ShuttleGui &S)
bool AudacityCommandDialog::Validate ( )
override

Definition at line 323 of file AudacityCommand.cpp.

Referenced by OnOk().

324 {
325  return true;
326 }
AudacityCommandDialog::wxDECLARE_NO_COPY_CLASS ( AudacityCommandDialog  )
private

Member Data Documentation

int AudacityCommandDialog::mAdditionalButtons
private

Definition at line 177 of file AudacityCommand.h.

Referenced by Init().

AudacityCommand* AudacityCommandDialog::mpCommand
private

Definition at line 178 of file AudacityCommand.h.

Referenced by OnHelp(), and PopulateOrExchange().

int AudacityCommandDialog::mType
private

Definition at line 176 of file AudacityCommand.h.


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