Audacity 3.2.0
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)
 
virtual void SetFileExtension (const wxString &extension)
 

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

265{
266 Create(parent, message, defaultDir, defaultFileName, wildCard, style, pos, sz, name);
267}
const TranslatableString name
Definition: Distortion.cpp:76
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)

References name, and anonymous_namespace{AudacityDontAskAgainMessageDialog.cpp}::style.

◆ ~FileDialog()

FileDialog::~FileDialog ( )
virtual

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

430{
431 if (m_extraControl)
432 {
433 // get chooser to drop its reference right now, allowing wxWindow dtor
434 // to verify that ref count drops to zero
435 gtk_file_chooser_set_extra_widget(
436 GTK_FILE_CHOOSER(m_widget), NULL);
437 }
438}

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

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

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

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

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, Tuple::detail::npos(), SetWildcard(), anonymous_namespace{AudacityDontAskAgainMessageDialog.cpp}::style, wxGTK_CONV, wxGTK_CONV_FN, and wxT().

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

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}
static wxRect gs_rectDialog(0, 0, 428, 266)

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}
#define str(a)
wxArrayString m_Filters
#define WM_GETISHELLBROWSER

References m_Filters, str, 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 587 of file gtk/FileDialogPrivate.cpp.

588{
589 wxString currentFilename( m_fc.GetFilename() );
590 if (currentFilename.empty())
591 {
592 // m_fc.GetFilename() will return empty until the dialog has been shown
593 // in which case use any previously provided value
594 currentFilename = m_fileName;
595 }
596 return currentFilename;
597}

References m_fc.

◆ GetFilenames() [1/3]

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

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

526{
527 m_fc.GetFilenames( files );
528}

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 ; }
wxArrayString m_fileNames

References m_fileNames.

◆ GetFilenames() [3/3]

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

◆ GetFilterIndex()

int FileDialog::GetFilterIndex ( ) const
virtual

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

611{
612 return m_fc.GetFilterIndex();
613}

References m_fc.

Referenced by FileSelectorEx(), 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 520 of file gtk/FileDialogPrivate.cpp.

521{
522 return m_fc.GetPath();
523}

References m_fc.

Referenced by FileSelector(), FileSelectorEx(), EqualizationCurvesDialog::OnExport(), ExportFFmpegOptions::OnExportPresets(), NyquistEffect::OnFileButton(), EqualizationCurvesDialog::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 530 of file gtk/FileDialogPrivate.cpp.

531{
532 m_fc.GetPaths( paths );
533}

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; }
wxArrayString m_paths

References m_paths.

◆ GetPaths() [3/3]

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

◆ GTKFilterChanged()

void FileDialog::GTKFilterChanged ( )

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

640{
641 wxFileName filename;
642
643#if defined(__WXGTK3__)
644 filename.SetFullName(wxString::FromUTF8(gtk_file_chooser_get_current_name(GTK_FILE_CHOOSER(m_widget))));
645#else
646 GtkWidget *entry = find_widget(m_widget, "GtkFileChooserEntry", 0);
647 if (entry)
648 {
649 filename.SetFullName(wxString::FromUTF8(gtk_entry_get_text(GTK_ENTRY(entry))));
650 }
651#endif
652
653 if (filename.HasName())
654 {
655 wxString ext = m_fc.GetCurrentWildCard().AfterLast(wxT('.')).Lower();
656 if (!ext.empty() && ext != wxT("*") && ext != filename.GetExt())
657 {
658 SetFileExtension(ext);
659 }
660 }
661
662 wxFileCtrlEvent event(wxEVT_FILECTRL_FILTERCHANGED, this, GetId());
663
664 event.SetFilterIndex(GetFilterIndex());
665
666 GetEventHandler()->ProcessEvent(event);
667}
static ProjectFileIORegistry::AttributeWriterEntry entry
virtual int GetFilterIndex() const
virtual void SetFileExtension(const wxString &extension)

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

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

631{
632 wxFileCtrlEvent event(wxEVT_FILECTRL_FOLDERCHANGED, this, GetId());
633
634 event.SetDirectory(GetDirectory());
635
636 GetEventHandler()->ProcessEvent(event);
637}

Referenced by gtk_filedialog_folderchanged_callback().

Here is the caller graph for this function:

◆ GTKSelectionChanged()

void FileDialog::GTKSelectionChanged ( const wxString &  filename)

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

616{
617 m_currentlySelectedFilename = filename;
618
619 wxFileCtrlEvent event(wxEVT_FILECTRL_SELECTIONCHANGED, this, GetId());
620
621 wxArrayString filenames;
622 GetFilenames(filenames);
623
624 event.SetDirectory(GetDirectory());
625 event.SetFiles(filenames);
626
627 GetEventHandler()->ProcessEvent(event);
628}
virtual void GetFilenames(wxArrayString &files) const

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}
virtual void MSWOnDestroy(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)
virtual void MSWOnInitDone(HWND hwnd, LPOPENFILENAME pOfn)
virtual void MSWOnInitDialog(HWND hwnd, LPOPENFILENAME pOfn)

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}
void FilterFiles(HWND hwnd, bool refresh)
#define wxMAXPATH

References FilterFiles(), 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
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}
void Init(wxWindow *root, HWND hwnd)
void CreateUserPane(wxWindow *parent)
Definition: FileDialog.cpp:36
virtual bool HasUserPaneCreator() const
Definition: FileDialog.cpp:25
FileDialog::Disabler mDisabler
static UINT_PTR APIENTRY ParentHook(HWND hDlg, UINT iMsg, WPARAM wParam, LPARAM lParam)

References FileDialogBase::CreateUserPane(), 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 m_fileNames, mChildDlg, mParentDlg, and wxMAXPATH.

Referenced by MSWDialogHook().

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}
void ParseFilter(int index)

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}
virtual void MSWOnSize(HWND hwnd, LPOPENFILENAME pOfn)
virtual void MSWOnGetMinMaxInfo(HWND hwnd, LPOPENFILENAME pOfn, LPMINMAXINFO pMmi)

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

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

References str.

◆ OnSize()

void FileDialog::OnSize ( wxSizeEvent &  )
private

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

515{
516 // avoid calling DoLayout(), which will set the (wrong) size of
517 // m_extraControl, its size is managed by GtkFileChooser
518}

◆ 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}
virtual UINT_PTR MSWParentHook(HWND hwnd, UINT iMsg, WPARAM wParam, LPARAM lParam, OPENFILENAME *pOfn)

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}
wxArrayString m_FilterGroups

References m_FilterGroups, m_Filters, and wxT().

Referenced by MSWOnTypeChange().

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

◆ SetDirectory()

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

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

560{
561 FileDialogBase::SetDirectory(dir);
562
563 m_fc.SetDirectory(dir);
564}

References m_fc.

◆ SetFileExtension() [1/3]

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

Reimplemented from FileDialogBase.

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

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

References entry, anonymous_namespace{CloudProjectFileIOExtensions.cpp}::extension, find_widget(), fn, and m_fc.

Referenced by GTKFilterChanged().

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

567{
568 FileDialogBase::SetFilename(name);
569
570 if (HasFdFlag(wxFD_SAVE))
571 {
572 gtk_file_chooser_set_current_name(GTK_FILE_CHOOSER(m_widget), wxGTK_CONV(name));
573 }
574
575 else
576 {
577 wxString path( GetDirectory() );
578 if (path.empty())
579 {
580 // SetPath() fires an assert if fed other than filepaths
581 return;
582 }
583 SetPath(wxFileName(path, name).GetFullPath());
584 }
585}
virtual void SetPath(const wxString &path)
wxString GetFullPath(HWND hwnd, int itm)

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

606{
607 m_fc.SetFilterIndex( filterIndex );
608}

References m_fc.

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

Here is the caller graph for this function:

◆ SetMessage()

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

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

536{
537 m_message = message;
538 SetTitle(message);
539}

◆ SetPath()

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

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

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

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

600{
601 FileDialogBase::SetWildcard(wildCard);
602 m_fc.SetWildcard( GetWildcard() );
603}

References m_fc.

Referenced by Create().

Here is the caller graph for this function:

◆ ShowModal() [1/3]

int FileDialog::ShowModal ( )
virtual

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

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

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

Referenced by FileSelector(), FileSelectorEx(), ApplyMacroDialog::OnApplyToFiles(), EqualizationCurvesDialog::OnExport(), ExportFFmpegOptions::OnExportPresets(), NyquistEffect::OnFileButton(), EqualizationCurvesDialog::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 GetFilenames(), and 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.

Referenced by GetPaths().

◆ 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: