Audacity  2.2.2
wxPanelWrapper.h
Go to the documentation of this file.
1 //
2 // wxPanelWrapper.h
3 // Audacity
4 //
5 // Created by Paul Licameli on 6/25/16.
6 //
7 //
8 
9 #ifndef __AUDACITY_WXPANEL_WRAPPER__
10 #define __AUDACITY_WXPANEL_WRAPPER__
11 
12 #include "../MemoryX.h"
13 #include <wx/panel.h>
14 #include <wx/dialog.h>
15 
16 #include "../Internat.h"
17 
18 void wxTabTraversalWrapperCharHook(wxKeyEvent &event);
19 
20 template <typename Base>
21 class AUDACITY_DLL_API wxTabTraversalWrapper : public Base
22 {
23 public:
24  template <typename... Args>
25  wxTabTraversalWrapper(Args&&... args)
26  : Base( std::forward<Args>(args)... )
27  {
28  this->Bind(wxEVT_CHAR_HOOK, wxTabTraversalWrapperCharHook);
29  }
30 
32  wxTabTraversalWrapper& operator=(const wxTabTraversalWrapper&) = delete;
34  wxTabTraversalWrapper& operator=(wxTabTraversalWrapper&&) = delete;
35 
36 };
37 
38 class AUDACITY_DLL_API wxPanelWrapper : public wxTabTraversalWrapper<wxPanel>
39 {
40 public:
41  // Constructors
43 
45  wxWindow *parent,
46  wxWindowID winid = wxID_ANY,
47  const wxPoint& pos = wxDefaultPosition,
48  const wxSize& size = wxDefaultSize,
49  long style = wxTAB_TRAVERSAL | wxNO_BORDER,
50  // Important: default window name localizes!
51  const wxString& name = _("Panel"))
52  : wxTabTraversalWrapper<wxPanel> ( parent, winid, pos, size, style, name )
53  {}
54 
55  // Pseudo ctor
56  bool Create(
57  wxWindow *parent,
58  wxWindowID winid = wxID_ANY,
59  const wxPoint& pos = wxDefaultPosition,
60  const wxSize& size = wxDefaultSize,
61  long style = wxTAB_TRAVERSAL | wxNO_BORDER,
62  // Important: default window name localizes!
63  const wxString& name = _("Panel"))
64  {
66  parent, winid, pos, size, style, name
67  );
68  }
69 };
70 
71 class AUDACITY_DLL_API wxDialogWrapper : public wxTabTraversalWrapper<wxDialog>
72 {
73 public:
74  // Constructors
76 
77  // Constructor with no modal flag - the new convention.
79  wxWindow *parent, wxWindowID id,
80  const wxString& title,
81  const wxPoint& pos = wxDefaultPosition,
82  const wxSize& size = wxDefaultSize,
83  long style = wxDEFAULT_DIALOG_STYLE,
84  // Important: default window name localizes!
85  const wxString& name = _("Dialog"))
86  : wxTabTraversalWrapper<wxDialog>
87  ( parent, id, title, pos, size, style, name )
88  {}
89 
90  // Pseudo ctor
91  bool Create(
92  wxWindow *parent, wxWindowID id,
93  const wxString& title,
94  const wxPoint& pos = wxDefaultPosition,
95  const wxSize& size = wxDefaultSize,
96  long style = wxDEFAULT_DIALOG_STYLE,
97  // Important: default window name localizes!
98  const wxString& name = _("Dialog"))
99  {
101  parent, id, title, pos, size, style, name
102  );
103  }
104 };
105 
106 #include <wx/dirdlg.h>
107 
108 class AUDACITY_DLL_API wxDirDialogWrapper : public wxTabTraversalWrapper<wxDirDialog>
109 {
110 public:
111  // Constructor with no modal flag - the new convention.
113  wxWindow *parent,
114  const wxString& message = _("Select a directory"),
115  const wxString& defaultPath = wxT(""),
116  long style = wxDD_DEFAULT_STYLE,
117  const wxPoint& pos = wxDefaultPosition,
118  const wxSize& size = wxDefaultSize,
119  // Important: default window name localizes!
120  const wxString& name = _("Directory Dialog"))
121  : wxTabTraversalWrapper<wxDirDialog>
122  ( parent, message, defaultPath, style, pos, size, name )
123  {}
124 
125  // Pseudo ctor
126  void Create(
127  wxWindow *parent,
128  const wxString& message = _("Select a directory"),
129  const wxString& defaultPath = wxT(""),
130  long style = wxDD_DEFAULT_STYLE,
131  const wxPoint& pos = wxDefaultPosition,
132  const wxSize& size = wxDefaultSize,
133  // Important: default window name localizes!
134  const wxString& name = _("Directory Dialog"))
135  {
137  parent, message, defaultPath, style, pos, size, name
138  );
139  }
140 };
141 
142 #include "../lib-src/FileDialog/FileDialog.h"
143 
144 class AUDACITY_DLL_API FileDialogWrapper : public wxTabTraversalWrapper<FileDialog>
145 {
146 public:
148 
149  // Constructor with no modal flag - the new convention.
151  wxWindow *parent,
152  const wxString& message = _("Select a file"),
153  const wxString& defaultDir = wxEmptyString,
154  const wxString& defaultFile = wxEmptyString,
155  const wxString& wildCard = wxFileSelectorDefaultWildcardStr,
156  long style = wxFD_DEFAULT_STYLE,
157  const wxPoint& pos = wxDefaultPosition,
158  const wxSize& sz = wxDefaultSize,
159  // Important: default window name localizes!
160  const wxString& name = _("File Dialog"))
162  ( parent, message, defaultDir, defaultFile, wildCard, style, pos, sz, name )
163  {}
164 
165  // Pseudo ctor
166  void Create(
167  wxWindow *parent,
168  const wxString& message = _("Select a file"),
169  const wxString& defaultDir = wxEmptyString,
170  const wxString& defaultFile = wxEmptyString,
171  const wxString& wildCard = wxFileSelectorDefaultWildcardStr,
172  long style = wxFD_DEFAULT_STYLE,
173  const wxPoint& pos = wxDefaultPosition,
174  const wxSize& sz = wxDefaultSize,
175  // Important: default window name localizes!
176  const wxString& name = _("File Dialog"))
177  {
179  parent, message, defaultDir, defaultFile, wildCard, style, pos, sz, name
180  );
181  }
182 };
183 
184 #endif
FileDialogWrapper(wxWindow *parent, const wxString &message=_("Select a file"), const wxString &defaultDir=wxEmptyString, const wxString &defaultFile=wxEmptyString, const wxString &wildCard=wxFileSelectorDefaultWildcardStr, long style=wxFD_DEFAULT_STYLE, const wxPoint &pos=wxDefaultPosition, const wxSize &sz=wxDefaultSize, const wxString &name=_("File Dialog"))
Dialog used to present platform specific "Save As" dialog with custom controls.
void Create(wxWindow *parent, const wxString &message=_("Select a directory"), const wxString &defaultPath=wxT(""), long style=wxDD_DEFAULT_STYLE, const wxPoint &pos=wxDefaultPosition, const wxSize &size=wxDefaultSize, const wxString &name=_("Directory Dialog"))
wxTabTraversalWrapper(Args &&...args)
wxPanelWrapper(wxWindow *parent, wxWindowID winid=wxID_ANY, const wxPoint &pos=wxDefaultPosition, const wxSize &size=wxDefaultSize, long style=wxTAB_TRAVERSAL|wxNO_BORDER, const wxString &name=_("Panel"))
void Create(wxWindow *parent, const wxString &message=_("Select a file"), const wxString &defaultDir=wxEmptyString, const wxString &defaultFile=wxEmptyString, const wxString &wildCard=wxFileSelectorDefaultWildcardStr, long style=wxFD_DEFAULT_STYLE, const wxPoint &pos=wxDefaultPosition, const wxSize &sz=wxDefaultSize, const wxString &name=_("File Dialog"))
wxDirDialogWrapper(wxWindow *parent, const wxString &message=_("Select a directory"), const wxString &defaultPath=wxT(""), long style=wxDD_DEFAULT_STYLE, const wxPoint &pos=wxDefaultPosition, const wxSize &size=wxDefaultSize, const wxString &name=_("Directory Dialog"))
void wxTabTraversalWrapperCharHook(wxKeyEvent &event)
_("Move Track &Down")+wxT("\t")+(GetActiveProject() -> GetCommandManager() ->GetKeyFromName(wxT("TrackMoveDown")).Raw()), OnMoveTrack) POPUP_MENU_ITEM(OnMoveTopID, _("Move Track to &Top")+wxT("\t")+(GetActiveProject() ->GetCommandManager() ->GetKeyFromName(wxT("TrackMoveTop")).Raw()), OnMoveTrack) POPUP_MENU_ITEM(OnMoveBottomID, _("Move Track to &Bottom")+wxT("\t")+(GetActiveProject() ->GetCommandManager() ->GetKeyFromName(wxT("TrackMoveBottom")).Raw()), OnMoveTrack)#define SET_TRACK_NAME_PLUGIN_SYMBOLclass SetTrackNameCommand:public AudacityCommand
const wxChar * name
Definition: Distortion.cpp:94
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"))
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 winid=wxID_ANY, const wxPoint &pos=wxDefaultPosition, const wxSize &size=wxDefaultSize, long style=wxTAB_TRAVERSAL|wxNO_BORDER, const wxString &name=_("Panel"))