Audacity  3.0.3
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:
[legend]
Collaboration diagram for FileDialog:
[legend]

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
 
virtual void SetFileExtension (const wxString &extension)
 
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
 
virtual void SetFileExtension (const wxString &extension)
 
 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 ()
 
virtual void SetFileExtension (const wxString &extension)
 
- 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
 
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() [1/6]

FileDialog::FileDialog ( )
inline

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

25 { }

◆ FileDialog() [2/6]

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 251 of file gtk/FileDialogPrivate.cpp.

258  : FileDialogBase()
259 {
260  Create(parent, message, defaultDir, defaultFileName, wildCard, style, pos, sz, name);
261 }

References name.

◆ ~FileDialog()

FileDialog::~FileDialog ( )
virtual

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

424 {
425  if (m_extraControl)
426  {
427  // get chooser to drop its reference right now, allowing wxWindow dtor
428  // to verify that ref count drops to zero
429  gtk_file_chooser_set_extra_widget(
430  GTK_FILE_CHOOSER(m_widget), NULL);
431  }
432 }

◆ FileDialog() [3/6]

FileDialog::FileDialog ( )

◆ FileDialog() [4/6]

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() [5/6]

FileDialog::FileDialog ( )

◆ FileDialog() [6/6]

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

◆ AddChildGTK()

void FileDialog::AddChildGTK ( wxWindowGTK *  child)
privatevirtual

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

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

References find_widget().

Here is the call graph for this function:

◆ Create() [1/2]

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 263 of file gtk/FileDialogPrivate.cpp.

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

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

Here is the call graph for this function:

◆ Create() [2/2]

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 
)

◆ DialogHook()

UINT_PTR APIENTRY FileDialog::DialogHook ( HWND  hDlg,
UINT  iMsg,
WPARAM  wParam,
LPARAM  lParam 
)
staticprivate

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

226 {
227  OPENFILENAME *pOfn;
228 
229  if (iMsg == WM_INITDIALOG)
230  {
231  pOfn = reinterpret_cast<OPENFILENAME *>(lParam);
232  }
233  else
234  {
235  pOfn = reinterpret_cast<OPENFILENAME *>(GetWindowLongPtr(hDlg, GWLP_USERDATA));
236  }
237 
238  return reinterpret_cast<FileDialog *>(pOfn->lCustData)->MSWDialogHook(hDlg, iMsg, wParam, lParam, pOfn);
239 }

References MSWDialogHook().

Here is the call graph for this function:

◆ DoCentre()

void FileDialog::DoCentre ( int  dir)
protectedvirtual

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

789 {
790  m_centreDir = dir;
791  m_bMovedWindow = true;
792 
793  // it's unnecessary to do anything else at this stage as we'll redo it in
794  // MSWOnInitDone() anyhow
795 }

References m_bMovedWindow, and m_centreDir.

◆ DoGetPosition()

void FileDialog::DoGetPosition ( int *  x,
int *  y 
) const
protectedvirtual

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

747 {
748  if (x)
749  *x = gs_rectDialog.x;
750  if (y)
751  *y = gs_rectDialog.y;
752 }

References gs_rectDialog().

Here is the call graph for this function:

◆ DoGetSize()

void FileDialog::DoGetSize ( int *  width,
int *  height 
) const
protectedvirtual

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

755 {
756  if (width)
757  *width = gs_rectDialog.width;
758  if (height)
759  *height = gs_rectDialog.height;
760 }

References gs_rectDialog().

Here is the call graph for this function:

◆ DoMoveWindow()

void FileDialog::DoMoveWindow ( int  x,
int  y,
int  width,
int  height 
)
protectedvirtual

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

763 {
764  m_bMovedWindow = true;
765 
766  gs_rectDialog.x = x;
767  gs_rectDialog.y = y;
768 
769  // our HWND is only set when we're called from MSWOnInitDone(), test if
770  // this is the case
771  HWND hwnd = GetHwnd();
772  if (hwnd)
773  {
774  // size of the dialog can't be changed because the controls are not
775  // laid out correctly then
776  ::SetWindowPos(hwnd, HWND_TOP, x, y, 0, 0, SWP_NOZORDER | SWP_NOSIZE);
777  }
778  else // just remember that we were requested to move the window
779  {
780  m_bMovedWindow = true;
781 
782  // if Centre() had been called before, it shouldn't be taken into
783  // account now
784  m_centreDir = 0;
785  }
786 }

References gs_rectDialog(), m_bMovedWindow, and m_centreDir.

Here is the call graph for this function:

◆ DoSetSize() [1/2]

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  {}

◆ DoSetSize() [2/2]

virtual void FileDialog::DoSetSize ( int  x,
int  y,
int  width,
int  height,
int  sizeFlags = wxSIZE_AUTO 
)
protectedvirtual

◆ FilterFiles()

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

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

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

References m_Filters, and WM_GETISHELLBROWSER.

Referenced by MSWOnFolderChange(), and MSWOnTypeChange().

Here is the caller graph for this function:

◆ GetFilename()

wxString FileDialog::GetFilename ( ) const
virtual

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

582 {
583  wxString currentFilename( m_fc.GetFilename() );
584  if (currentFilename.empty())
585  {
586  // m_fc.GetFilename() will return empty until the dialog has been shown
587  // in which case use any previously provided value
588  currentFilename = m_fileName;
589  }
590  return currentFilename;
591 }

References m_fc.

◆ GetFilenames() [1/3]

void FileDialog::GetFilenames ( wxArrayString &  files) const
virtual

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

520 {
521  m_fc.GetFilenames( files );
522 }

References m_fc.

Referenced by GTKSelectionChanged().

Here is the caller graph for this function:

◆ GetFilenames() [2/3]

virtual void FileDialog::GetFilenames ( wxArrayString &  files) const
inlinevirtual

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

59 { files = m_fileNames ; }

◆ GetFilenames() [3/3]

virtual void FileDialog::GetFilenames ( wxArrayString &  files) const
virtual

◆ GetFilterIndex()

int FileDialog::GetFilterIndex ( ) const
virtual

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

605 {
606  return m_fc.GetFilterIndex();
607 }

References m_fc.

Referenced by FileSelectorEx(), Exporter::GetFilename(), GTKFilterChanged(), and ProjectFileManager::ShowOpenDialog().

Here is the caller graph for this function:

◆ GetFullPath()

wxString FileDialog::GetFullPath ( HWND  hwnd,
int  itm 
)
private

Referenced by SetFilename().

Here is the caller graph for this function:

◆ GetPath()

wxString FileDialog::GetPath ( ) const
virtual

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

515 {
516  return m_fc.GetPath();
517 }

References m_fc.

Referenced by FileSelector(), FileSelectorEx(), Exporter::GetFilename(), EditCurvesDialog::OnExport(), ExportFFmpegOptions::OnExportPresets(), NyquistEffect::OnFileButton(), EditCurvesDialog::OnImport(), ExportFFmpegOptions::OnImportPresets(), NyquistEffect::OnLoad(), NyquistEffect::OnSave(), and ProjectFileManager::ShowOpenDialog().

Here is the caller graph for this function:

◆ GetPaths() [1/3]

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

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

525 {
526  m_fc.GetPaths( paths );
527 }

References m_fc.

Referenced by ApplyMacroDialog::OnApplyToFiles(), NyquistEffect::OnFileButton(), and ProjectFileManager::ShowOpenDialog().

Here is the caller graph for this function:

◆ GetPaths() [2/3]

virtual void FileDialog::GetPaths ( wxArrayString &  paths) const
inlinevirtual

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

58 { paths = m_paths; }

◆ GetPaths() [3/3]

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

◆ GTKFilterChanged()

void FileDialog::GTKFilterChanged ( )

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

634 {
635  wxFileName filename;
636 
637 #if defined(__WXGTK3__)
638  filename.SetFullName(wxString::FromUTF8(gtk_file_chooser_get_current_name(GTK_FILE_CHOOSER(m_widget))));
639 #else
640  GtkWidget *entry = find_widget(m_widget, "GtkFileChooserEntry", 0);
641  if (entry)
642  {
643  filename.SetFullName(wxString::FromUTF8(gtk_entry_get_text(GTK_ENTRY(entry))));
644  }
645 #endif
646 
647  if (filename.HasName())
648  {
649  wxString ext = m_fc.GetCurrentWildCard().AfterLast(wxT('.')).Lower();
650  if (!ext.empty() && ext != wxT("*") && ext != filename.GetExt())
651  {
652  SetFileExtension(ext);
653  }
654  }
655 
656  wxFileCtrlEvent event(wxEVT_FILECTRL_FILTERCHANGED, this, GetId());
657 
658  event.SetFilterIndex(GetFilterIndex());
659 
660  GetEventHandler()->ProcessEvent(event);
661 }

References entry, find_widget(), GetFilterIndex(), m_fc, and SetFileExtension().

Referenced by gtk_filedialog_filterchanged_callback(), and ShowModal().

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

◆ GTKFolderChanged()

void FileDialog::GTKFolderChanged ( )

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

625 {
626  wxFileCtrlEvent event(wxEVT_FILECTRL_FOLDERCHANGED, this, GetId());
627 
628  event.SetDirectory(GetDirectory());
629 
630  GetEventHandler()->ProcessEvent(event);
631 }

Referenced by gtk_filedialog_folderchanged_callback().

Here is the caller graph for this function:

◆ GTKSelectionChanged()

void FileDialog::GTKSelectionChanged ( const wxString &  filename)

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

610 {
611  m_currentlySelectedFilename = filename;
612 
613  wxFileCtrlEvent event(wxEVT_FILECTRL_SELECTIONCHANGED, this, GetId());
614 
615  wxArrayString filenames;
616  GetFilenames(filenames);
617 
618  event.SetDirectory(GetDirectory());
619  event.SetFiles(filenames);
620 
621  GetEventHandler()->ProcessEvent(event);
622 }

References GetFilenames().

Referenced by gtk_filedialog_selchanged_callback().

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

◆ Init() [1/2]

void FileDialog::Init ( )
private

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

685 {
686  mRoot = NULL;
687  mMinSize = {0, 0};
688 
689  // NB: all style checks are done by wxFileDialogBase::Create
690 
691  m_bMovedWindow = false;
692  m_centreDir = 0;
693 
694  // Must set to zero, otherwise the wx routines won't size the window
695  // the second time you call the file dialog, because it thinks it is
696  // already at the requested size.. (when centering)
697  gs_rectDialog.x =
698  gs_rectDialog.y = 0;
699 }

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

Here is the call graph for this function:

◆ Init() [2/2]

void FileDialog::Init ( )
private

◆ MSWDialogHook()

UINT_PTR FileDialog::MSWDialogHook ( HWND  hwnd,
UINT  iMsg,
WPARAM  wParam,
LPARAM  lParam,
OPENFILENAME *  pOfn 
)
privatevirtual

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

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

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

Referenced by DialogHook().

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

◆ MSWOnDestroy()

void FileDialog::MSWOnDestroy ( HWND  hwnd,
LPOPENFILENAME  pOfn 
)
privatevirtual

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

340 {
341  // Save final dialog position for next time
342  wxCopyRECTToRect(wxGetWindowRect(mParentDlg), gs_rectDialog);
343 
344  // Must explicitly delete the root window. Otherwise, wx will try to
345  // destroy it when the FileDialog is deleted. But, the windows will
346  // have already been deleted as a result of the OpenFile dialog being
347  // destroyed.
348  delete mRoot;
349 }

References gs_rectDialog(), mParentDlg, and mRoot.

Referenced by MSWDialogHook().

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

◆ MSWOnFolderChange()

void FileDialog::MSWOnFolderChange ( HWND  hwnd,
LPOPENFILENAME  pOfn 
)
privatevirtual

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

385 {
386  FilterFiles(mParentDlg, true);
387 
388  wxChar path[wxMAXPATH];
389  int result = CommDlg_OpenSave_GetFolderPath(::GetParent(hDlg), path, WXSIZEOF(path));
390  if (result < 0 || result > WXSIZEOF(path))
391  {
392  return;
393  }
394 
395  m_dir = path;
396 
397  wxFileCtrlEvent event(wxEVT_FILECTRL_FOLDERCHANGED, this, GetId());
398  event.SetDirectory(m_dir);
399  GetEventHandler()->ProcessEvent(event);
400 }

References FilterFiles(), anonymous_namespace{wxWidgetsBasicUI.cpp}::GetParent(), mParentDlg, and wxMAXPATH.

Referenced by MSWDialogHook().

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

◆ MSWOnGetMinMaxInfo()

void FileDialog::MSWOnGetMinMaxInfo ( HWND  hwnd,
LPOPENFILENAME  pOfn,
LPMINMAXINFO  pMmi 
)
privatevirtual

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

218 {
219  if (mMinSize.x > 0 && mMinSize.y > 0)
220  {
221  pMmi->ptMinTrackSize = mMinSize;
222  }
223 }

References mMinSize.

Referenced by MSWParentHook().

Here is the caller graph for this function:

◆ MSWOnInitDialog()

void FileDialog::MSWOnInitDialog ( HWND  hwnd,
LPOPENFILENAME  pOfn 
)
privatevirtual

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

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

References FileDialogBase::CreateUserPane(), anonymous_namespace{wxWidgetsBasicUI.cpp}::GetParent(), FileDialogBase::HasUserPaneCreator(), FileDialog::Disabler::Init(), mChildDlg, mDisabler, mParentDlg, mParentProc, mRoot, and ParentHook().

Referenced by MSWDialogHook().

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

◆ MSWOnInitDone()

void FileDialog::MSWOnInitDone ( HWND  hwnd,
LPOPENFILENAME  pOfn 
)
privatevirtual

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

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

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

Referenced by MSWDialogHook().

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

◆ MSWOnSelChange()

void FileDialog::MSWOnSelChange ( HWND  hwnd,
LPOPENFILENAME  pOfn 
)
privatevirtual

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

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

References anonymous_namespace{wxWidgetsBasicUI.cpp}::GetParent(), m_fileNames, mChildDlg, mParentDlg, and wxMAXPATH.

Referenced by MSWDialogHook().

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

◆ MSWOnSize()

void FileDialog::MSWOnSize ( HWND  hwnd,
LPOPENFILENAME  pOfn 
)
privatevirtual

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

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

References mChildDlg, and mRoot.

Referenced by MSWParentHook().

Here is the caller graph for this function:

◆ MSWOnTypeChange()

void FileDialog::MSWOnTypeChange ( HWND  hwnd,
LPOPENFILENAME  pOfn 
)
privatevirtual

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

438 {
439  // set HWND for wx
440  SetHWND(mChildDlg);
441 
442  ParseFilter(pOfn->nFilterIndex);
443  FilterFiles(mParentDlg, true);
444 
445  m_filterIndex = pOfn->nFilterIndex - 1;
446 
447  wxFileCtrlEvent event(wxEVT_FILECTRL_FILTERCHANGED, this, GetId());
448  event.SetFilterIndex(m_filterIndex);
449  GetEventHandler()->ProcessEvent(event);
450 
451  // we shouldn't destroy this HWND
452  SetHWND(NULL);
453 }

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

Referenced by MSWDialogHook(), and MSWOnInitDone().

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

◆ MSWParentHook()

UINT_PTR FileDialog::MSWParentHook ( HWND  hwnd,
UINT  iMsg,
WPARAM  wParam,
LPARAM  lParam,
OPENFILENAME *  pOfn 
)
privatevirtual

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

166 {
167  // Allow default handling to process first
168  UINT_PTR ret = CallWindowProc(mParentProc, hDlg, iMsg, wParam, lParam);
169 
170  if (iMsg == WM_SIZE)
171  {
172  MSWOnSize(mParentDlg, pOfn);
173  }
174 
175  if (iMsg == WM_GETMINMAXINFO)
176  {
177  MSWOnGetMinMaxInfo(mParentDlg, pOfn, reinterpret_cast<LPMINMAXINFO>(lParam));
178  }
179 
180  return ret;
181 }

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

Referenced by ParentHook().

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

◆ OnFakeOk()

void FileDialog::OnFakeOk ( wxCommandEvent &  event)
private

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

435 {
436  // Update the current directory from here, accessing it later may not work
437  // due to the strange way GtkFileChooser works.
439  str(gtk_file_chooser_get_current_folder(GTK_FILE_CHOOSER(m_widget)));
440  m_dir = wxString::FromUTF8(str);
441 
442  EndDialog(wxID_OK);
443 }

◆ OnSize()

void FileDialog::OnSize ( wxSizeEvent &  )
private

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

509 {
510  // avoid calling DoLayout(), which will set the (wrong) size of
511  // m_extraControl, its size is managed by GtkFileChooser
512 }

◆ ParentHook()

UINT_PTR APIENTRY FileDialog::ParentHook ( HWND  hDlg,
UINT  iMsg,
WPARAM  wParam,
LPARAM  lParam 
)
staticprivate

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

160 {
161  OPENFILENAME *pOfn = reinterpret_cast<OPENFILENAME *>(GetWindowLongPtr(hDlg, GWLP_USERDATA));
162  return reinterpret_cast<FileDialog *>(pOfn->lCustData)->MSWParentHook(hDlg, iMsg, wParam, lParam, pOfn);
163 }

References MSWParentHook().

Referenced by MSWOnInitDialog().

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

◆ ParseFilter()

void FileDialog::ParseFilter ( int  index)
private

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

643 {
644  m_Filters.Empty();
645 
646  wxStringTokenizer tokenWild(m_FilterGroups[index - 1], wxT(";"));
647 
648  while (tokenWild.HasMoreTokens())
649  {
650  wxString token = tokenWild.GetNextToken();
651  if (m_Filters.Index(token, false) == wxNOT_FOUND)
652  {
653  m_Filters.Add(token);
654  }
655  }
656 }

References m_FilterGroups, and m_Filters.

Referenced by MSWOnTypeChange().

Here is the caller graph for this function:

◆ SetDirectory()

void FileDialog::SetDirectory ( const wxString &  dir)
virtual

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

554 {
555  FileDialogBase::SetDirectory(dir);
556 
557  m_fc.SetDirectory(dir);
558 }

References m_fc.

◆ SetFileExtension() [1/3]

void FileDialog::SetFileExtension ( const wxString &  extension)
virtual

Reimplemented from FileDialogBase.

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

475 {
476  wxString filename;
477 
478 #if defined(__WXGTK3__)
479  filename = wxString::FromUTF8(gtk_file_chooser_get_current_name(GTK_FILE_CHOOSER(m_widget)));
480 #else
481  GtkWidget *entry = find_widget(m_widget, "GtkFileChooserEntry", 0);
482  if (entry)
483  {
484  filename = wxString::FromUTF8(gtk_entry_get_text(GTK_ENTRY(entry)));
485  }
486 #endif
487 
488  if (filename == wxEmptyString)
489  {
490  filename = m_fc.GetFilename();
491  }
492 
493  if (filename != wxEmptyString)
494  {
495  wxFileName fn(filename);
496  fn.SetExt(extension);
497 
498  gtk_file_chooser_set_current_name(GTK_FILE_CHOOSER(m_widget), fn.GetFullName().utf8_str());
499  }
500 }

References entry, find_widget(), fn, and m_fc.

Referenced by GTKFilterChanged(), Exporter::OnExtensionChanged(), and Exporter::OnFilterChanged().

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

◆ SetFileExtension() [2/3]

virtual void FileDialog::SetFileExtension ( const wxString &  extension)
virtual

Reimplemented from FileDialogBase.

◆ SetFileExtension() [3/3]

virtual void FileDialog::SetFileExtension ( const wxString &  extension)
virtual

Reimplemented from FileDialogBase.

◆ SetFilename()

void FileDialog::SetFilename ( const wxString &  name)
virtual

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

561 {
562  FileDialogBase::SetFilename(name);
563 
564  if (HasFdFlag(wxFD_SAVE))
565  {
566  gtk_file_chooser_set_current_name(GTK_FILE_CHOOSER(m_widget), wxGTK_CONV(name));
567  }
568 
569  else
570  {
571  wxString path( GetDirectory() );
572  if (path.empty())
573  {
574  // SetPath() fires an assert if fed other than filepaths
575  return;
576  }
577  SetPath(wxFileName(path, name).GetFullPath());
578  }
579 }

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

Here is the call graph for this function:

◆ SetFilterIndex()

void FileDialog::SetFilterIndex ( int  filterIndex)
virtual

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

600 {
601  m_fc.SetFilterIndex( filterIndex );
602 }

References m_fc.

Referenced by FileSelector(), Exporter::GetFilename(), ApplyMacroDialog::OnApplyToFiles(), and ProjectFileManager::ShowOpenDialog().

Here is the caller graph for this function:

◆ SetMessage()

void FileDialog::SetMessage ( const wxString &  message)
virtual

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

530 {
531  m_message = message;
532  SetTitle(message);
533 }

◆ SetPath()

void FileDialog::SetPath ( const wxString &  path)
virtual

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

536 {
537  FileDialogBase::SetPath(path);
538 
539  // Don't do anything if no path is specified, in particular don't set the
540  // path to m_dir below as this would result in opening the dialog in the
541  // parent directory of this one instead of m_dir itself.
542  if ( path.empty() )
543  return;
544 
545  // we need an absolute path for GTK native chooser so ensure that we have
546  // it: use the initial directory if it was set or just CWD otherwise (this
547  // is the default behaviour if m_dir is empty)
548  wxFileName fn(path);
549  fn.MakeAbsolute(m_dir);
550  m_fc.SetPath(fn.GetFullPath());
551 }

References fn, and m_fc.

Referenced by SetFilename().

Here is the caller graph for this function:

◆ SetupExtraControls()

void FileDialog::SetupExtraControls ( WXWindow  nativeWindow)
protected

◆ SetWildcard()

void FileDialog::SetWildcard ( const wxString &  wildCard)
virtual

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

594 {
595  FileDialogBase::SetWildcard(wildCard);
596  m_fc.SetWildcard( GetWildcard() );
597 }

References m_fc.

Referenced by Create().

Here is the caller graph for this function:

◆ ShowModal() [1/3]

int FileDialog::ShowModal ( )
virtual

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

446 {
447  WX_HOOK_MODAL_DIALOG();
448 
449  // Create the root window
450  wxBoxSizer *verticalSizer = new wxBoxSizer(wxVERTICAL);
451  wxPanel *root = new wxPanel(this, wxID_ANY);
452 
453  if (HasUserPaneCreator())
454  {
455  wxPanel *userpane = new wxPanel(root, wxID_ANY);
456  CreateUserPane(userpane);
457 
458  wxBoxSizer *horizontalSizer = new wxBoxSizer(wxHORIZONTAL);
459  horizontalSizer->Add(userpane, 1, wxEXPAND, 0);
460  verticalSizer->Add(horizontalSizer, 1, wxEXPAND|wxALL, 0);
461  }
462 
463  root->SetSizer(verticalSizer);
464  root->Layout();
465  verticalSizer->SetSizeHints(root);
466 
467  // Send an initial filter changed event
469 
470  return wxDialog::ShowModal();
471 }

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

Referenced by FileSelector(), FileSelectorEx(), Exporter::GetFilename(), ApplyMacroDialog::OnApplyToFiles(), EditCurvesDialog::OnExport(), ExportFFmpegOptions::OnExportPresets(), NyquistEffect::OnFileButton(), EditCurvesDialog::OnImport(), ExportFFmpegOptions::OnImportPresets(), NyquistEffect::OnLoad(), NyquistEffect::OnSave(), and ProjectFileManager::ShowOpenDialog().

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

◆ ShowModal() [2/3]

virtual int FileDialog::ShowModal ( )
virtual

◆ ShowModal() [3/3]

virtual int FileDialog::ShowModal ( )
virtual

◆ SupportsExtraControl() [1/2]

virtual bool FileDialog::SupportsExtraControl ( ) const
inlinevirtual

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

62 { return true; }

◆ SupportsExtraControl() [2/2]

virtual bool FileDialog::SupportsExtraControl ( ) const
virtual

Member Data Documentation

◆ m_bMovedWindow

bool FileDialog::m_bMovedWindow
private

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

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

◆ m_centreDir

int FileDialog::m_centreDir
private

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

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

◆ m_fc

wxGtkFileChooser FileDialog::m_fc
private

◆ m_fileNames

wxArrayString FileDialog::m_fileNames
protected

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

Referenced by MSWOnSelChange().

◆ m_FilterGroups

wxArrayString FileDialog::m_FilterGroups
private

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

Referenced by ParseFilter().

◆ m_Filters

wxArrayString FileDialog::m_Filters
private

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

Referenced by FilterFiles(), and ParseFilter().

◆ m_paths

wxArrayString FileDialog::m_paths
protected

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

◆ mChildDlg

HWND FileDialog::mChildDlg
private

◆ mDisabler

FileDialog::Disabler FileDialog::mDisabler
private

Referenced by MSWOnInitDialog().

◆ mMinSize

POINT FileDialog::mMinSize
private

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

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

◆ mParentDlg

HWND FileDialog::mParentDlg
private

◆ mParentProc

WNDPROC FileDialog::mParentProc
private

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

Referenced by MSWOnInitDialog(), and MSWParentHook().

◆ mRoot

wxPanel* FileDialog::mRoot
private

The documentation for this class was generated from the following files:
FileDialog::m_centreDir
int m_centreDir
Definition: win/FileDialogPrivate.h:90
FileDialog::SetPath
virtual void SetPath(const wxString &path)
Definition: gtk/FileDialogPrivate.cpp:535
fn
static const auto fn
Definition: WaveformView.cpp:1113
wxGTK_CONV_FN
#define wxGTK_CONV_FN(s)
Definition: gtk/FileDialogPrivate.cpp:29
entry
static ProjectFileIORegistry::WriterEntry entry
Definition: ProjectSettings.cpp:193
FileDialog::MSWOnGetMinMaxInfo
virtual void MSWOnGetMinMaxInfo(HWND hwnd, LPOPENFILENAME pOfn, LPMINMAXINFO pMmi)
Definition: win/FileDialogPrivate.cpp:217
FileDialog::Create
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)
Definition: gtk/FileDialogPrivate.cpp:263
FileDialog::MSWOnTypeChange
virtual void MSWOnTypeChange(HWND hwnd, LPOPENFILENAME pOfn)
Definition: win/FileDialogPrivate.cpp:437
FileDialog::MSWOnSelChange
virtual void MSWOnSelChange(HWND hwnd, LPOPENFILENAME pOfn)
Definition: win/FileDialogPrivate.cpp:402
FileDialog::mDisabler
FileDialog::Disabler mDisabler
FileDialog::ParentHook
static UINT_PTR APIENTRY ParentHook(HWND hDlg, UINT iMsg, WPARAM wParam, LPARAM lParam)
Definition: win/FileDialogPrivate.cpp:159
FileDialog::MSWOnFolderChange
virtual void MSWOnFolderChange(HWND hwnd, LPOPENFILENAME pOfn)
Definition: win/FileDialogPrivate.cpp:384
wxGtkString
Definition: gtk/FileDialogPrivate.cpp:36
FileDialog
Dialog used to present platform specific "Save As" dialog with custom controls.
Definition: gtk/FileDialogPrivate.h:23
FileDialogBase::FileDialogBase
FileDialogBase()
Definition: FileDialog.cpp:19
FileDialog::MSWOnInitDialog
virtual void MSWOnInitDialog(HWND hwnd, LPOPENFILENAME pOfn)
Definition: win/FileDialogPrivate.cpp:286
FileDialog::MSWOnDestroy
virtual void MSWOnDestroy(HWND hwnd, LPOPENFILENAME pOfn)
Definition: win/FileDialogPrivate.cpp:339
FileDialog::m_fileNames
wxArrayString m_fileNames
Definition: mac/FileDialogPrivate.h:29
FileDialog::mMinSize
POINT mMinSize
Definition: win/FileDialogPrivate.h:98
FileDialog::FilterFiles
void FilterFiles(HWND hwnd, bool refresh)
Definition: win/FileDialogPrivate.cpp:457
FileDialog::m_FilterGroups
wxArrayString m_FilterGroups
Definition: win/FileDialogPrivate.h:92
find_widget
static GtkWidget * find_widget(GtkWidget *parent, const gchar *name, int depth)
Definition: gtk/FileDialogPrivate.cpp:176
FileDialog::GetFullPath
wxString GetFullPath(HWND hwnd, int itm)
FileDialog::GetFilenames
virtual void GetFilenames(wxArrayString &files) const
Definition: gtk/FileDialogPrivate.cpp:519
FileDialog::mParentProc
WNDPROC mParentProc
Definition: win/FileDialogPrivate.h:97
FileDialog::GTKFilterChanged
void GTKFilterChanged()
Definition: gtk/FileDialogPrivate.cpp:633
FileDialog::m_bMovedWindow
bool m_bMovedWindow
Definition: win/FileDialogPrivate.h:89
name
const TranslatableString name
Definition: Distortion.cpp:98
FileDialog::ParseFilter
void ParseFilter(int index)
Definition: win/FileDialogPrivate.cpp:642
FileDialog::mRoot
wxPanel * mRoot
Definition: win/FileDialogPrivate.h:100
FileDialog::MSWDialogHook
virtual UINT_PTR MSWDialogHook(HWND hwnd, UINT iMsg, WPARAM wParam, LPARAM lParam, OPENFILENAME *pOfn)
Definition: win/FileDialogPrivate.cpp:241
FileDialog::Disabler::Init
void Init(wxWindow *root, HWND hwnd)
Definition: win/FileDialogPrivate.cpp:1173
gtk_filedialog_response_callback
static void gtk_filedialog_response_callback(GtkWidget *w, gint response, FileDialog *dialog)
Definition: gtk/FileDialogPrivate.cpp:125
FileDialog::MSWOnInitDone
virtual void MSWOnInitDone(HWND hwnd, LPOPENFILENAME pOfn)
Definition: win/FileDialogPrivate.cpp:351
FileDialog::MSWParentHook
virtual UINT_PTR MSWParentHook(HWND hwnd, UINT iMsg, WPARAM wParam, LPARAM lParam, OPENFILENAME *pOfn)
Definition: win/FileDialogPrivate.cpp:165
wxGTK_CONV
#define wxGTK_CONV(s)
Definition: gtk/FileDialogPrivate.cpp:28
WM_GETISHELLBROWSER
#define WM_GETISHELLBROWSER
Definition: win/FileDialogPrivate.cpp:455
wxMAXPATH
#define wxMAXPATH
Definition: win/FileDialogPrivate.cpp:63
FileDialog::mParentDlg
HWND mParentDlg
Definition: win/FileDialogPrivate.h:95
FileDialog::mChildDlg
HWND mChildDlg
Definition: win/FileDialogPrivate.h:96
FileDialogBase::HasUserPaneCreator
virtual bool HasUserPaneCreator() const
Definition: FileDialog.cpp:25
gtk_filedialog_selchanged_callback
static void gtk_filedialog_selchanged_callback(GtkFileChooser *chooser, FileDialog *dialog)
Definition: gtk/FileDialogPrivate.cpp:135
FileDialogBase::CreateUserPane
void CreateUserPane(wxWindow *parent)
Definition: FileDialog.cpp:36
gtk_filedialog_filterchanged_callback
static void gtk_filedialog_filterchanged_callback(GtkFileChooser *chooser, GParamSpec *pspec, FileDialog *dialog)
Definition: gtk/FileDialogPrivate.cpp:169
gs_rectDialog
static wxRect gs_rectDialog(0, 0, 428, 266)
FileDialog::m_fc
wxGtkFileChooser m_fc
Definition: gtk/FileDialogPrivate.h:85
gtk_filedialog_folderchanged_callback
static void gtk_filedialog_folderchanged_callback(GtkFileChooser *chooser, FileDialog *dialog)
Definition: gtk/FileDialogPrivate.cpp:163
anonymous_namespace{wxWidgetsBasicUI.cpp}::GetParent
wxWindow * GetParent(const BasicUI::WindowPlacement &placement)
Definition: wxWidgetsBasicUI.cpp:39
FileDialog::m_Filters
wxArrayString m_Filters
Definition: win/FileDialogPrivate.h:93
FileDialog::SetWildcard
virtual void SetWildcard(const wxString &wildCard)
Definition: gtk/FileDialogPrivate.cpp:593
FileDialog::SetFileExtension
virtual void SetFileExtension(const wxString &extension)
Definition: gtk/FileDialogPrivate.cpp:474
FileDialog::m_paths
wxArrayString m_paths
Definition: mac/FileDialogPrivate.h:30
FileDialog::GetFilterIndex
virtual int GetFilterIndex() const
Definition: gtk/FileDialogPrivate.cpp:604
gtk_filedialog_update_preview_callback
static void gtk_filedialog_update_preview_callback(GtkFileChooser *chooser, gpointer user_data)
Definition: gtk/FileDialogPrivate.cpp:143
FileDialog::MSWOnSize
virtual void MSWOnSize(HWND hwnd, LPOPENFILENAME pOfn)
Definition: win/FileDialogPrivate.cpp:183