Audacity  2.3.1
Public Member Functions | Private Member Functions | Private Attributes | List of all members
EffectDialog Class Reference

New (Jun-2006) base class for effects dialogs. Likely to get greater use in future. More...

#include <Effect.h>

Inheritance diagram for EffectDialog:
wxDialogWrapper wxTabTraversalWrapper< wxDialog > EffectNoiseReduction::Dialog

Public Member Functions

 EffectDialog (wxWindow *parent, const wxString &title, int type=0, int flags=wxDEFAULT_DIALOG_STYLE, int additionalButtons=0)
 
void Init ()
 
bool TransferDataToWindow () override
 
bool TransferDataFromWindow () override
 
bool Validate () override
 
virtual void PopulateOrExchange (ShuttleGui &S)
 
virtual void OnPreview (wxCommandEvent &evt)
 
virtual void OnOk (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 (EffectDialog)
 

Private Attributes

int mType
 
int mAdditionalButtons
 

Detailed Description

New (Jun-2006) base class for effects dialogs. Likely to get greater use in future.

Definition at line 561 of file Effect.h.

Constructor & Destructor Documentation

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

Definition at line 2645 of file Effect.cpp.

2650 : wxDialogWrapper(parent, wxID_ANY, title, wxDefaultPosition, wxDefaultSize, flags)
2651 {
2652  mType = type;
2653  mAdditionalButtons = additionalButtons;
2654 }
int mAdditionalButtons
Definition: Effect.h:584
int mType
Definition: Effect.h:583

Member Function Documentation

void EffectDialog::Init ( )

Definition at line 2656 of file Effect.cpp.

References ShuttleGui::AddStandardButtons(), eCancelButton, EffectTypeAnalyze, EffectTypeProcess, EffectTypeTool, eIsCreating, ShuttleGuiBase::EndVerticalLay(), eOkButton, ePreviewButton, Effect::PopulateOrExchange(), ShuttleGuiBase::SetBorder(), and ShuttleGuiBase::StartVerticalLay().

Referenced by EffectNoiseReduction::Dialog::Dialog().

2657 {
2658  ShuttleGui S(this, eIsCreating);
2659 
2660  S.SetBorder(5);
2661  S.StartVerticalLay(true);
2662  {
2663  PopulateOrExchange(S);
2664 
2665  long buttons = eOkButton;
2666  if ((mType != EffectTypeAnalyze) && (mType != EffectTypeTool))
2667  {
2668  buttons |= eCancelButton;
2669  if (mType == EffectTypeProcess)
2670  {
2671  buttons |= ePreviewButton;
2672  }
2673  }
2674  S.AddStandardButtons(buttons|mAdditionalButtons);
2675  }
2676  S.EndVerticalLay();
2677 
2678  Layout();
2679  Fit();
2680  SetMinSize(GetSize());
2681  Center();
2682 }
int mAdditionalButtons
Definition: Effect.h:584
Derived from ShuttleGuiBase, an Audacity specific class for shuttling data to and from GUI...
Definition: ShuttleGui.h:409
int mType
Definition: Effect.h:583
virtual void PopulateOrExchange(ShuttleGui &S)
Definition: Effect.cpp:2687
void EffectDialog::OnOk ( wxCommandEvent &  evt)
virtual

Definition at line 2718 of file Effect.cpp.

References Effect::TransferDataFromWindow().

2719 {
2720  // On wxGTK (wx2.8.12), the default action is still executed even if
2721  // the button is disabled. This appears to affect all wxDialogs, not
2722  // just our Effects dialogs. So, this is a only temporary workaround
2723  // for legacy effects that disable the OK button. Hopefully this has
2724  // been corrected in wx3.
2725  if (FindWindow(wxID_OK)->IsEnabled() && Validate() && TransferDataFromWindow())
2726  {
2727  EndModal(true);
2728  }
2729 
2730  return;
2731 }
bool TransferDataFromWindow() override
Definition: Effect.cpp:2700
bool Validate() override
Definition: Effect.cpp:2708
void EffectDialog::OnPreview ( wxCommandEvent &  evt)
virtual

Reimplemented in EffectNoiseReduction::Dialog.

Definition at line 2713 of file Effect.cpp.

2714 {
2715  return;
2716 }
void EffectDialog::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.

Reimplemented in EffectNoiseReduction::Dialog.

Definition at line 2687 of file Effect.cpp.

2688 {
2689  return;
2690 }
bool EffectDialog::TransferDataFromWindow ( )
override

Definition at line 2700 of file Effect.cpp.

References eIsGettingFromDialog, and Effect::PopulateOrExchange().

Referenced by EffectNoiseReduction::Dialog::TransferDataFromWindow().

2701 {
2703  PopulateOrExchange(S);
2704 
2705  return true;
2706 }
Derived from ShuttleGuiBase, an Audacity specific class for shuttling data to and from GUI...
Definition: ShuttleGui.h:409
virtual void PopulateOrExchange(ShuttleGui &S)
Definition: Effect.cpp:2687
bool EffectDialog::TransferDataToWindow ( )
override

Definition at line 2692 of file Effect.cpp.

References eIsSettingToDialog, and Effect::PopulateOrExchange().

Referenced by EffectNoiseReduction::Dialog::TransferDataToWindow().

2693 {
2694  ShuttleGui S(this, eIsSettingToDialog);
2695  PopulateOrExchange(S);
2696 
2697  return true;
2698 }
Derived from ShuttleGuiBase, an Audacity specific class for shuttling data to and from GUI...
Definition: ShuttleGui.h:409
virtual void PopulateOrExchange(ShuttleGui &S)
Definition: Effect.cpp:2687
bool EffectDialog::Validate ( )
override

Definition at line 2708 of file Effect.cpp.

2709 {
2710  return true;
2711 }
EffectDialog::wxDECLARE_NO_COPY_CLASS ( EffectDialog  )
private

Member Data Documentation

int EffectDialog::mAdditionalButtons
private

Definition at line 584 of file Effect.h.

int EffectDialog::mType
private

Definition at line 583 of file Effect.h.


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