Audacity  2.3.1
Classes | Public Member Functions | Protected Member Functions | Protected Attributes | Private Member Functions | Static Private Member Functions | Private Attributes | List of all members
FileDialog Class Reference

Dialog used to present platform specific "Save As" dialog with custom controls. More...

#include <FileDialogPrivate.h>

Inheritance diagram for FileDialog:
FileDialogBase FileDialogBase FileDialogBase wxTabTraversalWrapper< FileDialog > FileDialogWrapper

Classes

class  Disabler
 

Public Member Functions

 FileDialog ()
 
 FileDialog (wxWindow *parent, const wxString &message=wxFileSelectorPromptStr, 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=wxFileDialogNameStr)
 
bool Create (wxWindow *parent, const wxString &message=wxFileSelectorPromptStr, 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=wxFileDialogNameStr)
 
virtual ~FileDialog ()
 
virtual wxString GetPath () const
 
virtual void GetPaths (wxArrayString &paths) const
 
virtual wxString GetFilename () const
 
virtual void GetFilenames (wxArrayString &files) const
 
virtual int GetFilterIndex () const
 
virtual void SetMessage (const wxString &message)
 
virtual void SetPath (const wxString &path)
 
virtual void SetDirectory (const wxString &dir)
 
virtual void SetFilename (const wxString &name)
 
virtual void SetWildcard (const wxString &wildCard)
 
virtual void SetFilterIndex (int filterIndex)
 
virtual int ShowModal ()
 
virtual bool SupportsExtraControl () const
 
void GTKSelectionChanged (const wxString &filename)
 
void GTKFolderChanged ()
 
void GTKFilterChanged ()
 
 FileDialog ()
 
 FileDialog (wxWindow *parent, const wxString &message=wxFileSelectorPromptStr, 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=wxFileDialogNameStr)
 
void Create (wxWindow *parent, const wxString &message=wxFileSelectorPromptStr, 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=wxFileDialogNameStr)
 
virtual void GetPaths (wxArrayString &paths) const
 
virtual void GetFilenames (wxArrayString &files) const
 
virtual int ShowModal ()
 
virtual bool SupportsExtraControl () const
 
 FileDialog ()
 
 FileDialog (wxWindow *parent, const wxString &message=wxFileSelectorPromptStr, 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=wxFileDialogNameStr)
 
virtual void GetPaths (wxArrayString &paths) const
 
virtual void GetFilenames (wxArrayString &files) const
 
virtual int ShowModal ()
 
- Public Member Functions inherited from FileDialogBase
 FileDialogBase ()
 
virtual ~FileDialogBase ()
 
virtual bool HasUserPaneCreator () const
 
virtual void SetUserPaneCreator (UserPaneCreatorFunction creator, wxUIntPtr userdata)
 

Protected Member Functions

virtual void DoSetSize (int x, int y, int width, int height, int sizeFlags=wxSIZE_AUTO)
 
virtual void DoSetSize (int WXUNUSED(x), int WXUNUSED(y), int WXUNUSED(width), int WXUNUSED(height), int WXUNUSED(sizeFlags)=wxSIZE_AUTO)
 
void SetupExtraControls (WXWindow nativeWindow)
 
virtual void DoMoveWindow (int x, int y, int width, int height)
 
virtual void DoCentre (int dir)
 
virtual void DoGetSize (int *width, int *height) const
 
virtual void DoGetPosition (int *x, int *y) const
 
- Protected Member Functions inherited from FileDialogBase
void CreateUserPane (wxWindow *parent)
 

Protected Attributes

wxArrayString m_fileNames
 
wxArrayString m_paths
 
- Protected Attributes inherited from FileDialogBase
UserPaneCreatorFunction m_creator
 
wxUIntPtr m_userdata
 

Private Member Functions

void OnFakeOk (wxCommandEvent &event)
 
void OnSize (wxSizeEvent &)
 
virtual void AddChildGTK (wxWindowGTK *child)
 
void Init ()
 
void Init ()
 
wxString GetFullPath (HWND hwnd, int itm)
 
void FilterFiles (HWND hwnd, bool refresh)
 
void ParseFilter (int index)
 
virtual UINT_PTR MSWParentHook (HWND hwnd, UINT iMsg, WPARAM wParam, LPARAM lParam, OPENFILENAME *pOfn)
 
virtual void MSWOnSize (HWND hwnd, LPOPENFILENAME pOfn)
 
virtual void MSWOnGetMinMaxInfo (HWND hwnd, LPOPENFILENAME pOfn, LPMINMAXINFO pMmi)
 
virtual UINT_PTR MSWDialogHook (HWND hwnd, UINT iMsg, WPARAM wParam, LPARAM lParam, OPENFILENAME *pOfn)
 
virtual void MSWOnInitDialog (HWND hwnd, LPOPENFILENAME pOfn)
 
virtual void MSWOnDestroy (HWND hwnd, LPOPENFILENAME pOfn)
 
virtual void MSWOnInitDone (HWND hwnd, LPOPENFILENAME pOfn)
 
virtual void MSWOnFolderChange (HWND hwnd, LPOPENFILENAME pOfn)
 
virtual void MSWOnSelChange (HWND hwnd, LPOPENFILENAME pOfn)
 
virtual void MSWOnTypeChange (HWND hwnd, LPOPENFILENAME pOfn)
 

Static Private Member Functions

static UINT_PTR APIENTRY ParentHook (HWND hDlg, UINT iMsg, WPARAM wParam, LPARAM lParam)
 
static UINT_PTR APIENTRY DialogHook (HWND hDlg, UINT iMsg, WPARAM wParam, LPARAM lParam)
 

Private Attributes

wxGtkFileChooser m_fc
 
bool m_bMovedWindow
 
int m_centreDir
 
wxArrayString m_FilterGroups
 
wxArrayString m_Filters
 
wxChar * m_NameBuf
 
int m_NameBufLen
 
HWND mParentDlg
 
HWND mChildDlg
 
WNDPROC mParentProc
 
POINT mMinSize
 
wxPanel * mRoot
 
FileDialog::Disabler mDisabler
 

Additional Inherited Members

- Public Types inherited from FileDialogBase
typedef void(* UserPaneCreatorFunction )(wxWindow *parent, wxUIntPtr userdata)
 

Detailed Description

Dialog used to present platform specific "Save As" dialog with custom controls.

Definition at line 22 of file gtk/FileDialogPrivate.h.

Constructor & Destructor Documentation

FileDialog::FileDialog ( )
inline

Definition at line 25 of file gtk/FileDialogPrivate.h.

25 { }
FileDialog::FileDialog ( wxWindow *  parent,
const wxString &  message = wxFileSelectorPromptStr,
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 = wxFileDialogNameStr 
)

Definition at line 253 of file gtk/FileDialogPrivate.cpp.

References name.

260  : FileDialogBase()
261 {
262  Create(parent, message, defaultDir, defaultFileName, wildCard, style, pos, sz, name);
263 }
bool Create(wxWindow *parent, const wxString &message=wxFileSelectorPromptStr, 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=wxFileDialogNameStr)
const wxChar * name
Definition: Distortion.cpp:94
FileDialog::~FileDialog ( )
virtual

Definition at line 425 of file gtk/FileDialogPrivate.cpp.

426 {
427  if (m_extraControl)
428  {
429  // get chooser to drop its reference right now, allowing wxWindow dtor
430  // to verify that ref count drops to zero
431  gtk_file_chooser_set_extra_widget(
432  GTK_FILE_CHOOSER(m_widget), NULL);
433  }
434 }
FileDialog::FileDialog ( )
FileDialog::FileDialog ( wxWindow *  parent,
const wxString &  message = wxFileSelectorPromptStr,
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 = wxFileDialogNameStr 
)
FileDialog::FileDialog ( )
FileDialog::FileDialog ( wxWindow *  parent,
const wxString &  message = wxFileSelectorPromptStr,
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 = wxFileDialogNameStr 
)

Member Function Documentation

void FileDialog::AddChildGTK ( wxWindowGTK *  child)
privatevirtual

Definition at line 212 of file gtk/FileDialogPrivate.cpp.

References find_widget().

213 {
214  // allow dialog to be resized smaller horizontally
215  gtk_widget_set_size_request(
216  child->m_widget, child->GetMinWidth(), child->m_height);
217 
218 // In GTK 3+, adding our container as the extra widget can cause the
219 // the filter combo to grow to the same height as our container. This
220 // makes for a very odd looking filter combo. So, we manually add our
221 // container below the action bar.
222 #if GTK_CHECK_VERSION(3,0,0)
223  GtkWidget *actionbar = find_widget(m_widget, "GtkActionBar", 0);
224  if (actionbar)
225  {
226  GtkWidget *vbox = gtk_box_new(GTK_ORIENTATION_VERTICAL, 0);
227  gtk_container_add(GTK_CONTAINER(vbox), child->m_widget);
228  gtk_box_set_child_packing(GTK_BOX(vbox), child->m_widget, TRUE, TRUE, 0, GTK_PACK_START);
229  gtk_widget_show(vbox);
230 
231  GtkWidget *abparent = gtk_widget_get_parent(actionbar);
232  gtk_container_add(GTK_CONTAINER(abparent), vbox);
233  gtk_box_set_child_packing(GTK_BOX(abparent), vbox, FALSE, FALSE, 0, GTK_PACK_END);
234  gtk_box_reorder_child(GTK_BOX(abparent), actionbar, -2);
235  }
236 #else
237  gtk_file_chooser_set_extra_widget(
238  GTK_FILE_CHOOSER(m_widget), child->m_widget);
239 #endif
240 }
static GtkWidget * find_widget(GtkWidget *parent, const gchar *name, int depth)
bool FileDialog::Create ( wxWindow *  parent,
const wxString &  message = wxFileSelectorPromptStr,
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 = wxFileDialogNameStr 
)

Definition at line 265 of file gtk/FileDialogPrivate.cpp.

References gtk_filedialog_filterchanged_callback(), gtk_filedialog_folderchanged_callback(), gtk_filedialog_response_callback(), gtk_filedialog_selchanged_callback(), gtk_filedialog_update_preview_callback(), m_fc, SetWildcard(), wxGTK_CONV, and wxGTK_CONV_FN.

272 {
273  parent = GetParentForModalDialog(parent, style);
274 
275  if (!FileDialogBase::Create(parent, message, defaultDir, defaultFileName,
276  wildCard, style, pos, sz, name))
277  {
278  return false;
279  }
280 
281  if (!PreCreation(parent, pos, wxDefaultSize) ||
282  !CreateBase(parent, wxID_ANY, pos, wxDefaultSize, style,
283  wxDefaultValidator, wxT("filedialog")))
284  {
285  wxFAIL_MSG( wxT("FileDialog creation failed") );
286  return false;
287  }
288 
289  GtkFileChooserAction gtk_action;
290  GtkWindow* gtk_parent = NULL;
291  if (parent)
292  gtk_parent = GTK_WINDOW( gtk_widget_get_toplevel(parent->m_widget) );
293 
294  const gchar* ok_btn_stock;
295  if ( style & wxFD_SAVE )
296  {
297  gtk_action = GTK_FILE_CHOOSER_ACTION_SAVE;
298  ok_btn_stock = GTK_STOCK_SAVE;
299  }
300  else
301  {
302  gtk_action = GTK_FILE_CHOOSER_ACTION_OPEN;
303  ok_btn_stock = GTK_STOCK_OPEN;
304  }
305 
306  m_widget = gtk_file_chooser_dialog_new(
307  wxGTK_CONV(m_message),
308  gtk_parent,
309  gtk_action,
310  GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
311  ok_btn_stock, GTK_RESPONSE_ACCEPT,
312  NULL);
313  g_object_ref(m_widget);
314  GtkFileChooser* file_chooser = GTK_FILE_CHOOSER(m_widget);
315 
316  m_fc.SetWidget(file_chooser);
317 
318  gtk_dialog_set_default_response(GTK_DIALOG(m_widget), GTK_RESPONSE_ACCEPT);
319 
320  if ( style & wxFD_MULTIPLE )
321  gtk_file_chooser_set_select_multiple(file_chooser, true);
322 
323  // local-only property could be set to false to allow non-local files to be
324  // loaded. In that case get/set_uri(s) should be used instead of
325  // get/set_filename(s) everywhere and the GtkFileChooserDialog should
326  // probably also be created with a backend, e.g. "gnome-vfs", "default", ...
327  // (gtk_file_chooser_dialog_new_with_backend). Currently local-only is kept
328  // as the default - true:
329  // gtk_file_chooser_set_local_only(GTK_FILE_CHOOSER(m_widget), true);
330 
331  g_signal_connect (m_widget, "response",
332  G_CALLBACK (gtk_filedialog_response_callback), this);
333 
334  g_signal_connect (m_widget, "selection-changed",
335  G_CALLBACK (gtk_filedialog_selchanged_callback), this);
336 
337  g_signal_connect (m_widget, "current-folder-changed",
338  G_CALLBACK (gtk_filedialog_folderchanged_callback), this);
339 
340  g_signal_connect (m_widget, "notify::filter",
341  G_CALLBACK (gtk_filedialog_filterchanged_callback), this);
342 
343  // deal with extensions/filters
344  SetWildcard(wildCard);
345 
346  wxString defaultFileNameWithExt = defaultFileName;
347  if ( !wildCard.empty() && !defaultFileName.empty() &&
348  !wxFileName(defaultFileName).HasExt() )
349  {
350  // append the default extension, if any, to the initial file name: GTK
351  // won't do it for us by default (unlike e.g. MSW)
352  const wxFileName fnWC(m_fc.GetCurrentWildCard());
353  if ( fnWC.HasExt() )
354  {
355  // Notice that we shouldn't append the extension if it's a wildcard
356  // because this is not useful: the user would need to change it to use
357  // some fixed extension anyhow.
358  const wxString& ext = fnWC.GetExt();
359  if ( ext.find_first_of("?*") == wxString::npos )
360  defaultFileNameWithExt << "." << ext;
361  }
362  }
363 
364 
365  // if defaultDir is specified it should contain the directory and
366  // defaultFileName should contain the default name of the file, however if
367  // directory is not given, defaultFileName contains both
368  wxFileName fn;
369  if ( defaultDir.empty() )
370  fn.Assign(defaultFileNameWithExt);
371  else if ( !defaultFileNameWithExt.empty() )
372  fn.Assign(defaultDir, defaultFileNameWithExt);
373  else
374  fn.AssignDir(defaultDir);
375 
376  // set the initial file name and/or directory
377  fn.MakeAbsolute(); // GTK+ needs absolute path
378  const wxString dir = fn.GetPath();
379  if ( !dir.empty() )
380  {
381  gtk_file_chooser_set_current_folder(file_chooser, wxGTK_CONV_FN(dir));
382  }
383 
384  const wxString fname = fn.GetFullName();
385  if ( style & wxFD_SAVE )
386  {
387  if ( !fname.empty() )
388  {
389  gtk_file_chooser_set_current_name(file_chooser, wxGTK_CONV_FN(fname));
390  }
391 
392 #if GTK_CHECK_VERSION(2,7,3)
393  if ((style & wxFD_OVERWRITE_PROMPT)
394 #ifndef __WXGTK3__
395  && gtk_check_version(2,7,3) == NULL
396 #endif
397  )
398  {
399  gtk_file_chooser_set_do_overwrite_confirmation(file_chooser, true);
400  }
401 #endif
402  }
403  else // wxFD_OPEN
404  {
405  if ( !fname.empty() )
406  {
407  gtk_file_chooser_set_filename(file_chooser,
408  wxGTK_CONV_FN(fn.GetFullPath()));
409  }
410  }
411 
412  if ( style & wxFD_PREVIEW )
413  {
414  GtkWidget *previewImage = gtk_image_new();
415 
416  gtk_file_chooser_set_preview_widget(file_chooser, previewImage);
417  g_signal_connect(m_widget, "update-preview",
419  previewImage);
420  }
421 
422  return true;
423 }
virtual void SetWildcard(const wxString &wildCard)
static void gtk_filedialog_filterchanged_callback(GtkFileChooser *chooser, GParamSpec *pspec, FileDialog *dialog)
static void gtk_filedialog_update_preview_callback(GtkFileChooser *chooser, gpointer user_data)
static void gtk_filedialog_folderchanged_callback(GtkFileChooser *chooser, FileDialog *dialog)
wxGtkFileChooser m_fc
#define wxGTK_CONV(s)
#define wxGTK_CONV_FN(s)
static void gtk_filedialog_response_callback(GtkWidget *w, gint response, FileDialog *dialog)
const wxChar * name
Definition: Distortion.cpp:94
static void gtk_filedialog_selchanged_callback(GtkFileChooser *chooser, FileDialog *dialog)
void FileDialog::Create ( wxWindow *  parent,
const wxString &  message = wxFileSelectorPromptStr,
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 = wxFileDialogNameStr 
)
UINT_PTR APIENTRY FileDialog::DialogHook ( HWND  hDlg,
UINT  iMsg,
WPARAM  wParam,
LPARAM  lParam 
)
staticprivate

Definition at line 224 of file win/FileDialogPrivate.cpp.

References MSWDialogHook().

225 {
226  OPENFILENAME *pOfn;
227 
228  if (iMsg == WM_INITDIALOG)
229  {
230  pOfn = reinterpret_cast<OPENFILENAME *>(lParam);
231  }
232  else
233  {
234  pOfn = reinterpret_cast<OPENFILENAME *>(GetWindowLongPtr(hDlg, GWLP_USERDATA));
235  }
236 
237  return reinterpret_cast<FileDialog *>(pOfn->lCustData)->MSWDialogHook(hDlg, iMsg, wParam, lParam, pOfn);
238 }
Dialog used to present platform specific "Save As" dialog with custom controls.
virtual UINT_PTR MSWDialogHook(HWND hwnd, UINT iMsg, WPARAM wParam, LPARAM lParam, OPENFILENAME *pOfn)
void FileDialog::DoCentre ( int  dir)
protectedvirtual

Definition at line 765 of file win/FileDialogPrivate.cpp.

References m_bMovedWindow, and m_centreDir.

766 {
767  m_centreDir = dir;
768  m_bMovedWindow = true;
769 
770  // it's unnecessary to do anything else at this stage as we'll redo it in
771  // MSWOnInitDone() anyhow
772 }
void FileDialog::DoGetPosition ( int *  x,
int *  y 
) const
protectedvirtual

Definition at line 723 of file win/FileDialogPrivate.cpp.

References gs_rectDialog().

724 {
725  if (x)
726  *x = gs_rectDialog.x;
727  if (y)
728  *y = gs_rectDialog.y;
729 }
static wxRect gs_rectDialog(0, 0, 428, 266)
void FileDialog::DoGetSize ( int *  width,
int *  height 
) const
protectedvirtual

Definition at line 731 of file win/FileDialogPrivate.cpp.

References gs_rectDialog().

732 {
733  if (width)
734  *width = gs_rectDialog.width;
735  if (height)
736  *height = gs_rectDialog.height;
737 }
static wxRect gs_rectDialog(0, 0, 428, 266)
void FileDialog::DoMoveWindow ( int  x,
int  y,
int  width,
int  height 
)
protectedvirtual

Definition at line 739 of file win/FileDialogPrivate.cpp.

References gs_rectDialog(), m_bMovedWindow, and m_centreDir.

740 {
741  m_bMovedWindow = true;
742 
743  gs_rectDialog.x = x;
744  gs_rectDialog.y = y;
745 
746  // our HWND is only set when we're called from MSWOnInitDone(), test if
747  // this is the case
748  HWND hwnd = GetHwnd();
749  if (hwnd)
750  {
751  // size of the dialog can't be changed because the controls are not
752  // laid out correctly then
753  ::SetWindowPos(hwnd, HWND_TOP, x, y, 0, 0, SWP_NOZORDER | SWP_NOSIZE);
754  }
755  else // just remember that we were requested to move the window
756  {
757  m_bMovedWindow = true;
758 
759  // if Centre() had been called before, it shouldn't be taken into
760  // account now
761  m_centreDir = 0;
762  }
763 }
static wxRect gs_rectDialog(0, 0, 428, 266)
virtual void FileDialog::DoSetSize ( int  x,
int  y,
int  width,
int  height,
int  sizeFlags = wxSIZE_AUTO 
)
protectedvirtual
void FileDialog::DoSetSize ( int   WXUNUSEDx,
int   WXUNUSEDy,
int   WXUNUSEDwidth,
int   WXUNUSEDheight,
int   WXUNUSEDsizeFlags = wxSIZE_AUTO 
)
inlineprotectedvirtual

Definition at line 81 of file mac/FileDialogPrivate.h.

83  {}
void FileDialog::FilterFiles ( HWND  hwnd,
bool  refresh 
)
private

Definition at line 456 of file win/FileDialogPrivate.cpp.

References if(), m_Filters, and WM_GETISHELLBROWSER.

Referenced by MSWOnFolderChange(), and MSWOnTypeChange().

457 {
458  IShellFolder *ishell = NULL;
459  IShellBrowser *ishellbrowser = NULL; // Does not have to be released
460  IShellView *ishellview = NULL;
461  IFolderView *ifolderview = NULL;
462  LPMALLOC imalloc = NULL;
463  HRESULT hr;
464 
465  // Get pointer to the ListView control
466  HWND lv = ::GetDlgItem(::GetDlgItem(hwnd, lst2), 1);
467  if (lv == NULL)
468  {
469  return;
470  }
471 
472  // Get shell's memory allocation interface (must be Release()'d)
473  hr = SHGetMalloc(&imalloc);
474  if ((hr != NOERROR) || (imalloc == NULL))
475  {
476  wxASSERT((hr == NOERROR) && (imalloc != NULL));
477  return;
478  }
479 
480  // Get IShellBrowser interface for current dialog
481  ishellbrowser = (IShellBrowser*)::SendMessage(hwnd, WM_GETISHELLBROWSER, 0, 0);
482  if (ishellbrowser)
483  {
484  // Get IShellBrowser interface for returned browser
485  if (ishellbrowser->QueryActiveShellView(&ishellview) == S_OK)
486  {
487  // Get the IFolderView interface...available on XP or greater
488  ishellview->QueryInterface(IID_IFolderView, (void **)&ifolderview);
489  }
490  }
491 
492  // Init
493  LVITEM lvi;
494  wxZeroMemory(lvi);
495 
496  // Process all items
497  int fltcnt = (int) m_Filters.GetCount();
498  int itmcnt = ListView_GetItemCount(lv);
499  for (int itm = 0; itm < itmcnt; itm++)
500  {
501  // Retrieve the file IDL
502  lvi.iItem = itm;
503  lvi.mask = LVIF_PARAM;
504  if (ListView_GetItem(lv, &lvi) != TRUE)
505  {
506  wxASSERT(FALSE);
507  break;
508  }
509 
510  LPCITEMIDLIST fidl = (LPCITEMIDLIST) lvi.lParam;
511 
512  // On Vista, lParam no longer contains the pidl so retrieve it via the
513  // IFolderView interface. This interface is only available on XP or higher
514  // so if that limitation isn't workable, use IShellView::GetItemObject() to
515  // retrieve items.
516  if (fidl == NULL && ifolderview != NULL)
517  {
518  ifolderview->Item(itm, (LPITEMIDLIST *) &fidl);
519  }
520 
521  if (fidl == NULL)
522  {
523  wxASSERT(fidl != NULL);
524  break;
525  }
526 
527  // Retrieve the IShellFolder interface of the parent (must be Release()'d)
528  if (ishell == NULL)
529  {
530  hr = SHBindToParent(fidl, IID_IShellFolder, (void **)&ishell, NULL);
531  if (!SUCCEEDED(hr))
532  {
533  wxASSERT(SUCCEEDED(hr));
534  break;
535  }
536  }
537 
538  // Get the attributes of the object
539  DWORD attr = SFGAO_FOLDER | SFGAO_BROWSABLE;
540  hr = ishell->GetAttributesOf(1, &fidl, &attr);
541  if (!SUCCEEDED(hr))
542  {
543  wxASSERT(SUCCEEDED(hr));
544  break;
545  }
546 
547  // Allow all folders (things like zip files get filtered below)
548  if ((attr & (SFGAO_FOLDER)) && !(attr & SFGAO_BROWSABLE))
549  {
550  continue;
551  }
552 
553  // Retrieve the parsable name of the object (includes extension)
554  STRRET str;
555  hr = ishell->GetDisplayNameOf(fidl, SHGDN_INFOLDER | SHGDN_FORPARSING, &str);
556  if (hr != NOERROR)
557  {
558  // For some objects, we get back an error of 80070057. I'm assuming this
559  // means there is no way to represent the name (like some sort of virtual name)
560  // or I've not used the correct PIDL. But, in either case, it "probably"
561  // represents some sort of folder (at least in all cases I've seen), so we
562  // simply allow it to display.
563  continue;
564  }
565 
566  // Convert result to wxString
567  wxString filename;
568  switch (str.uType)
569  {
570  case STRRET_WSTR:
571  filename = str.pOleStr;
572  imalloc->Free(str.pOleStr);
573  break;
574 
575  case STRRET_OFFSET:
576  filename = wxString(((char *)fidl) + str.uOffset, wxConvISO8859_1);
577  break;
578 
579  case STRRET_CSTR:
580  filename = wxString(str.cStr, wxConvISO8859_1);
581  break;
582  }
583 
584  // Convert the filename to lowercase (and remember to write filters in lowercase!)
585  filename = filename.Lower();
586 
587  // Attempt to match it to all of our filters
588  bool match = false;
589  for (int flt = 0; flt < fltcnt; flt++)
590  {
591  if (wxMatchWild(m_Filters[flt], filename, false))
592  {
593  match = true;
594  break;
595  }
596  }
597 
598  // Remove it from the display if it didn't match any of the filters.
599  if (!match)
600  {
601  ListView_DeleteItem(lv, itm);
602  itm--;
603  itmcnt--;
604  }
605  }
606 
607  // On Vista and maybe XP, we seem to need to refresh the view after
608  // changing the filters. But, only refresh for type changes and not
609  // selection changes since it causes additional selection change
610  // events to occur.
611  if (ishellview && refresh)
612  {
613  ishellview->Refresh();
614  }
615 
616  // Release the interface
617  if (ifolderview)
618  {
619  ifolderview->Release();
620  }
621 
622  // Release the interface
623  if (ishellview)
624  {
625  ishellview->Release();
626  }
627 
628  // Release the interface
629  if (ishell)
630  {
631  ishell->Release();
632  }
633 
634  // Release the interface
635  if (imalloc)
636  {
637  imalloc->Release();
638  }
639 }
if(pTrack &&pTrack->GetDisplay()!=WaveTrack::Spectrum)
wxArrayString m_Filters
#define WM_GETISHELLBROWSER
wxString FileDialog::GetFilename ( ) const
virtual

Definition at line 554 of file gtk/FileDialogPrivate.cpp.

References m_fc.

555 {
556  wxString currentFilename( m_fc.GetFilename() );
557  if (currentFilename.empty())
558  {
559  // m_fc.GetFilename() will return empty until the dialog has been shown
560  // in which case use any previously provided value
561  currentFilename = m_fileName;
562  }
563  return currentFilename;
564 }
wxGtkFileChooser m_fc
virtual void FileDialog::GetFilenames ( wxArrayString &  files) const
virtual
void FileDialog::GetFilenames ( wxArrayString &  files) const
virtual

Definition at line 492 of file gtk/FileDialogPrivate.cpp.

References m_fc.

Referenced by GTKSelectionChanged().

493 {
494  m_fc.GetFilenames( files );
495 }
wxGtkFileChooser m_fc
virtual void FileDialog::GetFilenames ( wxArrayString &  files) const
inlinevirtual

Definition at line 59 of file mac/FileDialogPrivate.h.

59 { files = m_fileNames ; }
wxArrayString m_fileNames
int FileDialog::GetFilterIndex ( ) const
virtual

Definition at line 577 of file gtk/FileDialogPrivate.cpp.

References m_fc.

Referenced by FileSelectorEx(), GTKFilterChanged(), and AudacityProject::ShowOpenDialog().

578 {
579  return m_fc.GetFilterIndex();
580 }
wxGtkFileChooser m_fc
wxString FileDialog::GetFullPath ( HWND  hwnd,
int  itm 
)
private

Referenced by SetFilename().

wxString FileDialog::GetPath ( ) const
virtual
virtual void FileDialog::GetPaths ( wxArrayString &  paths) const
virtual
void FileDialog::GetPaths ( wxArrayString &  paths) const
virtual

Definition at line 497 of file gtk/FileDialogPrivate.cpp.

References m_fc.

Referenced by ApplyMacroDialog::OnApplyToFiles(), and AudacityProject::ShowOpenDialog().

498 {
499  m_fc.GetPaths( paths );
500 }
wxGtkFileChooser m_fc
virtual void FileDialog::GetPaths ( wxArrayString &  paths) const
inlinevirtual

Definition at line 58 of file mac/FileDialogPrivate.h.

58 { paths = m_paths; }
wxArrayString m_paths
void FileDialog::GTKFilterChanged ( )

Definition at line 606 of file gtk/FileDialogPrivate.cpp.

References GetFilterIndex().

Referenced by gtk_filedialog_filterchanged_callback(), and ShowModal().

607 {
608  wxFileCtrlEvent event(wxEVT_FILECTRL_FILTERCHANGED, this, GetId());
609 
610  event.SetFilterIndex(GetFilterIndex());
611 
612  GetEventHandler()->ProcessEvent(event);
613 }
virtual int GetFilterIndex() const
void FileDialog::GTKFolderChanged ( )

Definition at line 597 of file gtk/FileDialogPrivate.cpp.

Referenced by gtk_filedialog_folderchanged_callback().

598 {
599  wxFileCtrlEvent event(wxEVT_FILECTRL_FOLDERCHANGED, this, GetId());
600 
601  event.SetDirectory(GetDirectory());
602 
603  GetEventHandler()->ProcessEvent(event);
604 }
void FileDialog::GTKSelectionChanged ( const wxString &  filename)

Definition at line 582 of file gtk/FileDialogPrivate.cpp.

References GetFilenames().

Referenced by gtk_filedialog_selchanged_callback().

583 {
584  m_currentlySelectedFilename = filename;
585 
586  wxFileCtrlEvent event(wxEVT_FILECTRL_SELECTIONCHANGED, this, GetId());
587 
588  wxArrayString filenames;
589  GetFilenames(filenames);
590 
591  event.SetDirectory(GetDirectory());
592  event.SetFiles(filenames);
593 
594  GetEventHandler()->ProcessEvent(event);
595 }
virtual void GetFilenames(wxArrayString &files) const
void FileDialog::Init ( )
private
void FileDialog::Init ( )
private

Definition at line 683 of file win/FileDialogPrivate.cpp.

References gs_rectDialog(), m_bMovedWindow, m_centreDir, mMinSize, and mRoot.

684 {
685  mRoot = NULL;
686  mMinSize = {0, 0};
687 
688  // NB: all style checks are done by wxFileDialogBase::Create
689 
690  m_bMovedWindow = false;
691  m_centreDir = 0;
692 
693  // Must set to zero, otherwise the wx routines won't size the window
694  // the second time you call the file dialog, because it thinks it is
695  // already at the requested size.. (when centering)
696  gs_rectDialog.x =
697  gs_rectDialog.y = 0;
698 }
static wxRect gs_rectDialog(0, 0, 428, 266)
UINT_PTR FileDialog::MSWDialogHook ( HWND  hwnd,
UINT  iMsg,
WPARAM  wParam,
LPARAM  lParam,
OPENFILENAME *  pOfn 
)
privatevirtual

Definition at line 240 of file win/FileDialogPrivate.cpp.

References MSWOnDestroy(), MSWOnFolderChange(), MSWOnInitDialog(), MSWOnInitDone(), MSWOnSelChange(), and MSWOnTypeChange().

Referenced by DialogHook().

241 {
242  switch (iMsg)
243  {
244  case WM_INITDIALOG:
245  MSWOnInitDialog(hDlg, pOfn);
246  break;
247 
248  case WM_DESTROY:
249  MSWOnDestroy(hDlg, pOfn);
250  break;
251 
252  case WM_NOTIFY:
253  {
254  NMHDR * const pNM = reinterpret_cast<NMHDR *>(lParam);
255  if (pNM->code > CDN_LAST && pNM->code <= CDN_FIRST)
256  {
257  OFNOTIFY * const pNotifyCode = reinterpret_cast<OFNOTIFY *>(lParam);
258  switch (pNotifyCode->hdr.code)
259  {
260  case CDN_INITDONE:
261  MSWOnInitDone(hDlg, pOfn);
262  break;
263 
264  case CDN_FOLDERCHANGE:
265  MSWOnFolderChange(hDlg, pOfn);
266  break;
267 
268  case CDN_SELCHANGE:
269  MSWOnSelChange(hDlg, pOfn);
270  break;
271 
272  case CDN_TYPECHANGE:
273  MSWOnTypeChange(hDlg, pOfn);
274  break;
275  }
276  }
277  }
278  break;
279  }
280 
281  // do the default processing
282  return 0;
283 }
virtual void MSWOnDestroy(HWND hwnd, LPOPENFILENAME pOfn)
virtual void MSWOnTypeChange(HWND hwnd, LPOPENFILENAME pOfn)
virtual void MSWOnSelChange(HWND hwnd, LPOPENFILENAME pOfn)
virtual void MSWOnFolderChange(HWND hwnd, LPOPENFILENAME pOfn)
virtual void MSWOnInitDone(HWND hwnd, LPOPENFILENAME pOfn)
virtual void MSWOnInitDialog(HWND hwnd, LPOPENFILENAME pOfn)
void FileDialog::MSWOnDestroy ( HWND  hwnd,
LPOPENFILENAME  pOfn 
)
privatevirtual

Definition at line 338 of file win/FileDialogPrivate.cpp.

References gs_rectDialog(), mParentDlg, and mRoot.

Referenced by MSWDialogHook().

339 {
340  // Save final dialog position for next time
341  wxCopyRECTToRect(wxGetWindowRect(mParentDlg), gs_rectDialog);
342 
343  // Must explicitly delete the root window. Otherwise, wx will try to
344  // destroy it when the FileDialog is deleted. But, the windows will
345  // have already been deleted as a result of the OpenFile dialog being
346  // destroyed.
347  delete mRoot;
348 }
static wxRect gs_rectDialog(0, 0, 428, 266)
void FileDialog::MSWOnFolderChange ( HWND  hwnd,
LPOPENFILENAME  pOfn 
)
privatevirtual

Definition at line 383 of file win/FileDialogPrivate.cpp.

References FilterFiles(), mParentDlg, and wxMAXPATH.

Referenced by MSWDialogHook().

384 {
385  FilterFiles(mParentDlg, true);
386 
387  wxChar path[wxMAXPATH];
388  int result = CommDlg_OpenSave_GetFolderPath(::GetParent(hDlg), path, WXSIZEOF(path));
389  if (result < 0 || result > WXSIZEOF(path))
390  {
391  return;
392  }
393 
394  m_dir = path;
395 
396  wxFileCtrlEvent event(wxEVT_FILECTRL_FOLDERCHANGED, this, GetId());
397  event.SetDirectory(m_dir);
398  GetEventHandler()->ProcessEvent(event);
399 }
#define wxMAXPATH
void FilterFiles(HWND hwnd, bool refresh)
void FileDialog::MSWOnGetMinMaxInfo ( HWND  hwnd,
LPOPENFILENAME  pOfn,
LPMINMAXINFO  pMmi 
)
privatevirtual

Definition at line 216 of file win/FileDialogPrivate.cpp.

References mMinSize.

Referenced by MSWParentHook().

217 {
218  if (mMinSize.x > 0 && mMinSize.y > 0)
219  {
220  pMmi->ptMinTrackSize = mMinSize;
221  }
222 }
void FileDialog::MSWOnInitDialog ( HWND  hwnd,
LPOPENFILENAME  pOfn 
)
privatevirtual

Definition at line 285 of file win/FileDialogPrivate.cpp.

References FileDialogBase::CreateUserPane(), FileDialogBase::HasUserPaneCreator(), FileDialog::Disabler::Init(), mChildDlg, mDisabler, mParentDlg, mParentProc, mRoot, and ParentHook().

Referenced by MSWDialogHook().

286 {
287  // Since we've specified the OFN_EXPLORER flag, the "real" dialog is the parent of this one
288  mParentDlg = ::GetParent(hDlg);
289 
290  // Now we can initialize the disabler
291  mDisabler.Init(this, mParentDlg);
292 
293  // This is the dialog were our controls will go
294  mChildDlg = hDlg;
295 
296  // Store the OPENFILENAME pointer in each window
297  SetWindowLongPtr(mParentDlg, GWLP_USERDATA, reinterpret_cast<LPARAM>(pOfn));
298  SetWindowLongPtr(mChildDlg, GWLP_USERDATA, reinterpret_cast<LPARAM>(pOfn));
299 
300  // Subclass the parent dialog so we can receive WM_SIZE messages
301  mParentProc = reinterpret_cast<WNDPROC>(SetWindowLongPtr(mParentDlg, GWLP_WNDPROC, reinterpret_cast<LPARAM>(&ParentHook)));
302 
303  // set HWND for wx
304  SetHWND(mChildDlg);
305 
306  if (HasUserPaneCreator())
307  {
308  // Create the root window
309  wxBoxSizer *verticalSizer = new wxBoxSizer(wxVERTICAL);
310  mRoot = new wxPanel(this, wxID_ANY);
311 
312  wxPanel *userpane = new wxPanel(mRoot, wxID_ANY);
313  CreateUserPane(userpane);
314 
315  wxBoxSizer *horizontalSizer = new wxBoxSizer(wxHORIZONTAL);
316  horizontalSizer->Add(userpane, 1, wxEXPAND);
317  verticalSizer->Add(horizontalSizer, 1, wxEXPAND);
318 
319  mRoot->SetSizer(verticalSizer);
320  mRoot->Layout();
321  mRoot->Fit();
322 
323  // This reserves space for the additional panel
324  wxSize sz = mRoot->GetBestSize();
325  SetWindowPos(mChildDlg,
326  HWND_TOP,
327  0,
328  0,
329  sz.GetWidth(),
330  sz.GetHeight(),
331  SWP_NOZORDER | SWP_NOMOVE);
332 
333  }
334 
335  SetHWND(NULL);
336 }
void Init(wxWindow *root, HWND hwnd)
virtual bool HasUserPaneCreator() const
Definition: FileDialog.cpp:25
void CreateUserPane(wxWindow *parent)
Definition: FileDialog.cpp:36
FileDialog::Disabler mDisabler
static UINT_PTR APIENTRY ParentHook(HWND hDlg, UINT iMsg, WPARAM wParam, LPARAM lParam)
void FileDialog::MSWOnInitDone ( HWND  hwnd,
LPOPENFILENAME  pOfn 
)
privatevirtual

Definition at line 350 of file win/FileDialogPrivate.cpp.

References gs_rectDialog(), m_centreDir, mChildDlg, mMinSize, mParentDlg, and MSWOnTypeChange().

Referenced by MSWDialogHook().

351 {
352  // set HWND so that our DoMoveWindow() works correctly
353  SetHWND(mChildDlg);
354 
355  // capture the full initial size of the dialog to use as the minimum size
356  RECT r;
357  GetWindowRect(mParentDlg, &r);
358  mMinSize = {r.right - r.left, r.bottom - r.top};
359 
360  if (m_centreDir)
361  {
362  // now we have the real dialog size, remember it
363  RECT rect;
364  GetWindowRect(mParentDlg, &rect);
365  gs_rectDialog = wxRectFromRECT(rect);
366 
367  // and position the window correctly: notice that we must use the base
368  // class version as our own doesn't do anything except setting flags
369  wxFileDialogBase::DoCentre(m_centreDir);
370  }
371  else // need to just move it to the correct place
372  {
373  SetPosition(gs_rectDialog.GetPosition());
374  }
375 
376  // Filter change event must be sent once initialized
377  MSWOnTypeChange(hDlg, pOfn);
378 
379  // we shouldn't destroy this HWND
380  SetHWND(NULL);
381 }
static wxRect gs_rectDialog(0, 0, 428, 266)
virtual void MSWOnTypeChange(HWND hwnd, LPOPENFILENAME pOfn)
void FileDialog::MSWOnSelChange ( HWND  hwnd,
LPOPENFILENAME  pOfn 
)
privatevirtual

Definition at line 401 of file win/FileDialogPrivate.cpp.

References m_fileNames, mChildDlg, mParentDlg, and wxMAXPATH.

Referenced by MSWDialogHook().

402 {
403  // set HWND for wx
404  SetHWND(mChildDlg);
405 
406  // Get pointer to the ListView control
407  HWND lv = ::GetDlgItem(::GetDlgItem(mParentDlg, lst2), 1);
408  if (lv == NULL)
409  {
410  return;
411  }
412 
413  wxChar path[wxMAXPATH];
414  int result = CommDlg_OpenSave_GetFilePath(::GetParent(hDlg), path, WXSIZEOF(path));
415  if (result < 0 || result > WXSIZEOF(path))
416  {
417  return;
418  }
419 
420  m_path = path;
421  m_fileName = wxFileNameFromPath(m_path);
422  m_dir = wxPathOnly(m_path);
423 
424  m_fileNames.Clear();
425  m_fileNames.Add(m_fileName);
426 
427  wxFileCtrlEvent event(wxEVT_FILECTRL_SELECTIONCHANGED, this, GetId());
428  event.SetDirectory(m_dir);
429  event.SetFiles(m_fileNames);
430  GetEventHandler()->ProcessEvent(event);
431 
432  // we shouldn't destroy this HWND
433  SetHWND(NULL);
434 }
wxArrayString m_fileNames
#define wxMAXPATH
void FileDialog::MSWOnSize ( HWND  hwnd,
LPOPENFILENAME  pOfn 
)
privatevirtual

Definition at line 182 of file win/FileDialogPrivate.cpp.

References mChildDlg, and mRoot.

Referenced by MSWParentHook().

183 {
184  wxRect r;
185  wxCopyRECTToRect(wxGetClientRect(hDlg), r);
186 
187  SetHWND(mChildDlg);
188 
189  SetWindowPos(mChildDlg,
190  HWND_TOP,
191  0,
192  0,
193  r.GetWidth(),
194  r.GetHeight(),
195  SWP_NOZORDER | SWP_NOMOVE);
196 
197  SetSize(r);
198 
199  if (mRoot)
200  {
201  mRoot->SetSize(r.GetWidth(), mRoot->GetSize().GetHeight());
202  }
203 
204  SetHWND(NULL);
205 }
void FileDialog::MSWOnTypeChange ( HWND  hwnd,
LPOPENFILENAME  pOfn 
)
privatevirtual

Definition at line 436 of file win/FileDialogPrivate.cpp.

References FilterFiles(), mChildDlg, mParentDlg, and ParseFilter().

Referenced by MSWDialogHook(), and MSWOnInitDone().

437 {
438  // set HWND for wx
439  SetHWND(mChildDlg);
440 
441  ParseFilter(pOfn->nFilterIndex);
442  FilterFiles(mParentDlg, true);
443 
444  m_filterIndex = pOfn->nFilterIndex - 1;
445 
446  wxFileCtrlEvent event(wxEVT_FILECTRL_FILTERCHANGED, this, GetId());
447  event.SetFilterIndex(m_filterIndex);
448  GetEventHandler()->ProcessEvent(event);
449 
450  // we shouldn't destroy this HWND
451  SetHWND(NULL);
452 }
void FilterFiles(HWND hwnd, bool refresh)
void ParseFilter(int index)
UINT_PTR FileDialog::MSWParentHook ( HWND  hwnd,
UINT  iMsg,
WPARAM  wParam,
LPARAM  lParam,
OPENFILENAME *  pOfn 
)
privatevirtual

Definition at line 164 of file win/FileDialogPrivate.cpp.

References mParentDlg, mParentProc, MSWOnGetMinMaxInfo(), and MSWOnSize().

Referenced by ParentHook().

165 {
166  // Allow default handling to process first
167  UINT_PTR ret = CallWindowProc(mParentProc, hDlg, iMsg, wParam, lParam);
168 
169  if (iMsg == WM_SIZE)
170  {
171  MSWOnSize(mParentDlg, pOfn);
172  }
173 
174  if (iMsg == WM_GETMINMAXINFO)
175  {
176  MSWOnGetMinMaxInfo(mParentDlg, pOfn, reinterpret_cast<LPMINMAXINFO>(lParam));
177  }
178 
179  return ret;
180 }
virtual void MSWOnSize(HWND hwnd, LPOPENFILENAME pOfn)
virtual void MSWOnGetMinMaxInfo(HWND hwnd, LPOPENFILENAME pOfn, LPMINMAXINFO pMmi)
void FileDialog::OnFakeOk ( wxCommandEvent &  event)
private

Definition at line 436 of file gtk/FileDialogPrivate.cpp.

437 {
438  // Update the current directory from here, accessing it later may not work
439  // due to the strange way GtkFileChooser works.
441  str(gtk_file_chooser_get_current_folder(GTK_FILE_CHOOSER(m_widget)));
442  m_dir = wxString::FromUTF8(str);
443 
444  EndDialog(wxID_OK);
445 }
void FileDialog::OnSize ( wxSizeEvent &  )
private

Definition at line 481 of file gtk/FileDialogPrivate.cpp.

482 {
483  // avoid calling DoLayout(), which will set the (wrong) size of
484  // m_extraControl, its size is managed by GtkFileChooser
485 }
UINT_PTR APIENTRY FileDialog::ParentHook ( HWND  hDlg,
UINT  iMsg,
WPARAM  wParam,
LPARAM  lParam 
)
staticprivate

Definition at line 158 of file win/FileDialogPrivate.cpp.

References MSWParentHook().

Referenced by MSWOnInitDialog().

159 {
160  OPENFILENAME *pOfn = reinterpret_cast<OPENFILENAME *>(GetWindowLongPtr(hDlg, GWLP_USERDATA));
161  return reinterpret_cast<FileDialog *>(pOfn->lCustData)->MSWParentHook(hDlg, iMsg, wParam, lParam, pOfn);
162 }
Dialog used to present platform specific "Save As" dialog with custom controls.
virtual UINT_PTR MSWParentHook(HWND hwnd, UINT iMsg, WPARAM wParam, LPARAM lParam, OPENFILENAME *pOfn)
void FileDialog::ParseFilter ( int  index)
private

Definition at line 641 of file win/FileDialogPrivate.cpp.

References m_FilterGroups, and m_Filters.

Referenced by MSWOnTypeChange().

642 {
643  m_Filters.Empty();
644 
645  wxStringTokenizer tokenWild(m_FilterGroups[index - 1], wxT(";"));
646 
647  while (tokenWild.HasMoreTokens())
648  {
649  wxString token = tokenWild.GetNextToken();
650  if (m_Filters.Index(token, false) == wxNOT_FOUND)
651  {
652  m_Filters.Add(token);
653  }
654  }
655 }
wxArrayString m_Filters
wxArrayString m_FilterGroups
void FileDialog::SetDirectory ( const wxString &  dir)
virtual

Definition at line 526 of file gtk/FileDialogPrivate.cpp.

References m_fc.

527 {
528  FileDialogBase::SetDirectory(dir);
529 
530  m_fc.SetDirectory(dir);
531 }
wxGtkFileChooser m_fc
void FileDialog::SetFilename ( const wxString &  name)
virtual

Definition at line 533 of file gtk/FileDialogPrivate.cpp.

References GetFullPath(), SetPath(), and wxGTK_CONV.

534 {
535  FileDialogBase::SetFilename(name);
536 
537  if (HasFdFlag(wxFD_SAVE))
538  {
539  gtk_file_chooser_set_current_name(GTK_FILE_CHOOSER(m_widget), wxGTK_CONV(name));
540  }
541 
542  else
543  {
544  wxString path( GetDirectory() );
545  if (path.empty())
546  {
547  // SetPath() fires an assert if fed other than filepaths
548  return;
549  }
550  SetPath(wxFileName(path, name).GetFullPath());
551  }
552 }
#define wxGTK_CONV(s)
const wxChar * name
Definition: Distortion.cpp:94
virtual void SetPath(const wxString &path)
wxString GetFullPath(HWND hwnd, int itm)
void FileDialog::SetFilterIndex ( int  filterIndex)
virtual

Definition at line 572 of file gtk/FileDialogPrivate.cpp.

References m_fc.

Referenced by FileSelector(), ApplyMacroDialog::OnApplyToFiles(), and AudacityProject::ShowOpenDialog().

573 {
574  m_fc.SetFilterIndex( filterIndex);
575 }
wxGtkFileChooser m_fc
void FileDialog::SetMessage ( const wxString &  message)
virtual

Definition at line 502 of file gtk/FileDialogPrivate.cpp.

503 {
504  m_message = message;
505  SetTitle(message);
506 }
void FileDialog::SetPath ( const wxString &  path)
virtual

Definition at line 508 of file gtk/FileDialogPrivate.cpp.

References m_fc.

Referenced by SetFilename().

509 {
510  FileDialogBase::SetPath(path);
511 
512  // Don't do anything if no path is specified, in particular don't set the
513  // path to m_dir below as this would result in opening the dialog in the
514  // parent directory of this one instead of m_dir itself.
515  if ( path.empty() )
516  return;
517 
518  // we need an absolute path for GTK native chooser so ensure that we have
519  // it: use the initial directory if it was set or just CWD otherwise (this
520  // is the default behaviour if m_dir is empty)
521  wxFileName fn(path);
522  fn.MakeAbsolute(m_dir);
523  m_fc.SetPath(fn.GetFullPath());
524 }
wxGtkFileChooser m_fc
void FileDialog::SetupExtraControls ( WXWindow  nativeWindow)
protected
void FileDialog::SetWildcard ( const wxString &  wildCard)
virtual

Definition at line 566 of file gtk/FileDialogPrivate.cpp.

References m_fc.

Referenced by Create().

567 {
568  FileDialogBase::SetWildcard(wildCard);
569  m_fc.SetWildcard( GetWildcard() );
570 }
wxGtkFileChooser m_fc
virtual int FileDialog::ShowModal ( )
virtual
int FileDialog::ShowModal ( )
virtual

Definition at line 447 of file gtk/FileDialogPrivate.cpp.

References FileDialogBase::CreateUserPane(), GTKFilterChanged(), and FileDialogBase::HasUserPaneCreator().

Referenced by FileSelector(), FileSelectorEx(), ApplyMacroDialog::OnApplyToFiles(), EditCurvesDialog::OnExport(), EditCurvesDialog::OnImport(), and AudacityProject::ShowOpenDialog().

448 {
449  WX_HOOK_MODAL_DIALOG();
450 
451  // Create the root window
452  wxBoxSizer *verticalSizer = new wxBoxSizer(wxVERTICAL);
453  wxPanel *root = new wxPanel(this, wxID_ANY);
454 
455  if (HasUserPaneCreator())
456  {
457  wxPanel *userpane = new wxPanel(root, wxID_ANY);
458  CreateUserPane(userpane);
459 
460  wxBoxSizer *horizontalSizer = new wxBoxSizer(wxHORIZONTAL);
461  horizontalSizer->Add(userpane, 1, wxEXPAND, 0);
462  verticalSizer->Add(horizontalSizer, 1, wxEXPAND|wxALL, 0);
463  }
464 
465  root->SetSizer(verticalSizer);
466  root->Layout();
467  verticalSizer->SetSizeHints(root);
468 
469  // Send an initial filter changed event
471 
472  return wxDialog::ShowModal();
473 }
virtual bool HasUserPaneCreator() const
Definition: FileDialog.cpp:25
void CreateUserPane(wxWindow *parent)
Definition: FileDialog.cpp:36
virtual int FileDialog::ShowModal ( )
virtual
virtual bool FileDialog::SupportsExtraControl ( ) const
inlinevirtual

Definition at line 62 of file gtk/FileDialogPrivate.h.

62 { return true; }
virtual bool FileDialog::SupportsExtraControl ( ) const
virtual

Member Data Documentation

bool FileDialog::m_bMovedWindow
private

Definition at line 87 of file win/FileDialogPrivate.h.

Referenced by DoCentre(), DoMoveWindow(), and Init().

int FileDialog::m_centreDir
private

Definition at line 88 of file win/FileDialogPrivate.h.

Referenced by DoCentre(), DoMoveWindow(), Init(), and MSWOnInitDone().

wxGtkFileChooser FileDialog::m_fc
private
wxArrayString FileDialog::m_fileNames
protected

Definition at line 29 of file mac/FileDialogPrivate.h.

Referenced by MSWOnSelChange().

wxArrayString FileDialog::m_FilterGroups
private

Definition at line 90 of file win/FileDialogPrivate.h.

Referenced by ParseFilter().

wxArrayString FileDialog::m_Filters
private

Definition at line 91 of file win/FileDialogPrivate.h.

Referenced by FilterFiles(), and ParseFilter().

wxChar* FileDialog::m_NameBuf
private

Definition at line 92 of file win/FileDialogPrivate.h.

int FileDialog::m_NameBufLen
private

Definition at line 93 of file win/FileDialogPrivate.h.

wxArrayString FileDialog::m_paths
protected

Definition at line 30 of file mac/FileDialogPrivate.h.

HWND FileDialog::mChildDlg
private
FileDialog::Disabler FileDialog::mDisabler
private

Referenced by MSWOnInitDialog().

POINT FileDialog::mMinSize
private

Definition at line 98 of file win/FileDialogPrivate.h.

Referenced by Init(), MSWOnGetMinMaxInfo(), and MSWOnInitDone().

HWND FileDialog::mParentDlg
private
WNDPROC FileDialog::mParentProc
private

Definition at line 97 of file win/FileDialogPrivate.h.

Referenced by MSWOnInitDialog(), and MSWParentHook().

wxPanel* FileDialog::mRoot
private

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