| 1 |
// |
| 2 |
// Copied from wxWidgets 3.0.2 and modified for Audacity |
| 3 |
// |
| 4 |
///////////////////////////////////////////////////////////////////////////// |
| 5 |
// Name: wx/msw/filedlg.h |
| 6 |
// Purpose: wxFileDialog class |
| 7 |
// Author: Julian Smart |
| 8 |
// Modified by: Leland Lucius |
| 9 |
// Created: 01/02/97 |
| 10 |
// Copyright: (c) Julian Smart |
| 11 |
// Licence: wxWindows licence |
| 12 |
///////////////////////////////////////////////////////////////////////////// |
| 13 |
|
| 14 |
#ifndef _WIN_FILEDIALOGPRIVATE_H_ |
| 15 |
#define _WIN_FILEDIALOGPRIVATE_H_ |
| 16 |
|
| 17 |
#include <windows.h> |
| 18 |
|
| 19 |
#include <wx/modalhook.h> |
| 20 |
|
| 21 |
//------------------------------------------------------------------------- |
| 22 |
// FileDialog |
| 23 |
//------------------------------------------------------------------------- |
| 24 |
|
| 25 |
class WX_WRAPPERS_API FileDialog : public FileDialogBase |
| 26 |
{ |
| 27 |
public: |
| 28 |
FileDialog(); |
| 29 |
FileDialog(wxWindow *parent, |
| 30 |
const wxString& message = wxFileSelectorPromptStr, |
| 31 |
const wxString& defaultDir = wxEmptyString, |
| 32 |
const wxString& defaultFile = wxEmptyString, |
| 33 |
const wxString& wildCard = wxFileSelectorDefaultWildcardStr, |
| 34 |
long style = wxFD_DEFAULT_STYLE, |
| 35 |
const wxPoint& pos = wxDefaultPosition, |
| 36 |
const wxSize& sz = wxDefaultSize, |
| 37 |
const wxString& name = wxFileDialogNameStr); |
| 38 |
|
| 39 |
virtual void GetPaths(wxArrayString& paths) const; |
| 40 |
virtual void GetFilenames(wxArrayString& files) const; |
| 41 |
virtual int ShowModal(); |
| 42 |
|
| 43 |
virtual void SetFileExtension(const wxString& extension); |
| 44 |
|
| 45 |
protected: |
| 46 |
// ----------------------------------------- |
| 47 |
// wxMSW-specific implementation from now on |
| 48 |
// ----------------------------------------- |
| 49 |
|
| 50 |
#if !(defined(__SMARTPHONE__) && defined(__WXWINCE__)) |
| 51 |
virtual void DoMoveWindow(int x, int y, int width, int height); |
| 52 |
virtual void DoCentre(int dir); |
| 53 |
virtual void DoGetSize(int *width, int *height) const; |
| 54 |
virtual void DoGetPosition(int *x, int *y) const; |
| 55 |
#endif // !(__SMARTPHONE__ && __WXWINCE__) |
| 56 |
|
| 57 |
private: |
| 58 |
void Init(); |
| 59 |
|
| 60 |
wxString GetFullPath(HWND hwnd, int itm); |
| 61 |
void FilterFiles(HWND hwnd, bool refresh); |
| 62 |
void ParseFilter(int index); |
| 63 |
|
| 64 |
// Parent dialog hook |
| 65 |
static UINT_PTR APIENTRY ParentHook(HWND hDlg, UINT iMsg, WPARAM wParam, LPARAM lParam); |
| 66 |
virtual UINT_PTR MSWParentHook(HWND hwnd, UINT iMsg, WPARAM wParam, LPARAM lParam, OPENFILENAME *pOfn); |
| 67 |
|
| 68 |
// Message handlers for the parent dialog |
| 69 |
virtual void MSWOnSize(HWND hwnd, LPOPENFILENAME pOfn); |
| 70 |
virtual void MSWOnGetMinMaxInfo(HWND hwnd, LPOPENFILENAME pOfn, LPMINMAXINFO pMmi); |
| 71 |
|
| 72 |
// Child dialog hook |
| 73 |
static UINT_PTR APIENTRY DialogHook(HWND hDlg, UINT iMsg, WPARAM wParam, LPARAM lParam); |
| 74 |
virtual UINT_PTR MSWDialogHook(HWND hwnd, UINT iMsg, WPARAM wParam, LPARAM lParam, OPENFILENAME *pOfn); |
| 75 |
|
| 76 |
// Message handlers for the child dialog |
| 77 |
virtual void MSWOnInitDialog(HWND hwnd, LPOPENFILENAME pOfn); |
| 78 |
virtual void MSWOnDestroy(HWND hwnd, LPOPENFILENAME pOfn); |
| 79 |
virtual void MSWOnInitDone(HWND hwnd, LPOPENFILENAME pOfn); |
| 80 |
virtual void MSWOnFolderChange(HWND hwnd, LPOPENFILENAME pOfn); |
| 81 |
virtual void MSWOnSelChange(HWND hwnd, LPOPENFILENAME pOfn); |
| 82 |
virtual void MSWOnTypeChange(HWND hwnd, LPOPENFILENAME pOfn); |
| 83 |
|
| 84 |
private: |
| 85 |
wxArrayString m_fileNames; |
| 86 |
|
| 87 |
// remember if our SetPosition() or Centre() (which requires special |
| 88 |
// treatment) was called |
| 89 |
bool m_bMovedWindow; |
| 90 |
int m_centreDir; // nothing to do if 0 |
| 91 |
|
| 92 |
wxArrayString m_FilterGroups; |
| 93 |
wxArrayString m_Filters; |
| 94 |
|
| 95 |
HWND mParentDlg; |
| 96 |
HWND mChildDlg; |
| 97 |
WNDPROC mParentProc; |
| 98 |
POINT mMinSize; |
| 99 |
|
| 100 |
wxPanel *mRoot; |
| 101 |
|
| 102 |
class Disabler : public wxModalDialogHook |
| 103 |
{ |
| 104 |
public: |
| 105 |
Disabler(); |
| 106 |
void Init(wxWindow *root, HWND hwnd); |
| 107 |
|
| 108 |
protected: |
| 109 |
int Enter(wxDialog *dialog); |
| 110 |
void Exit(wxDialog *dialog); |
| 111 |
bool IsChild(const wxDialog *dialog) const; |
| 112 |
|
| 113 |
private: |
| 114 |
wxWindow *mRoot; |
| 115 |
HWND mHwnd; |
| 116 |
int mModalCount; |
| 117 |
} mDisabler; |
| 118 |
|
| 119 |
DECLARE_DYNAMIC_CLASS(FileDialog) |
| 120 |
DECLARE_NO_COPY_CLASS(FileDialog) |
| 121 |
}; |
| 122 |
|
| 123 |
#endif |
| 124 |
|