File: FileDialogPrivate.h

package info (click to toggle)
audacity 2.1.2-2
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 86,844 kB
  • sloc: ansic: 225,005; cpp: 221,240; sh: 27,327; python: 16,896; makefile: 8,186; lisp: 8,002; perl: 317; xml: 307; sed: 16
file content (124 lines) | stat: -rw-r--r-- 4,002 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
//
// Copied from wxWidgets 3.0.2 and modified for Audacity
//
/////////////////////////////////////////////////////////////////////////////
// Name:        wx/msw/filedlg.h
// Purpose:     wxFileDialog class
// Author:      Julian Smart
// Modified by: Leland Lucius
// Created:     01/02/97
// Copyright:   (c) Julian Smart
// Licence:     wxWindows licence
/////////////////////////////////////////////////////////////////////////////

#ifndef _WIN_FILEDIALOGPRIVATE_H_
#define _WIN_FILEDIALOGPRIVATE_H_

#include <windows.h>

#include <wx/modalhook.h>

//-------------------------------------------------------------------------
// FileDialog
//-------------------------------------------------------------------------

class FileDialog : public FileDialogBase
{
 public:
    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();

protected:
   // -----------------------------------------
   // wxMSW-specific implementation from now on
   // -----------------------------------------
   
#if !(defined(__SMARTPHONE__) && defined(__WXWINCE__))
    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;
#endif // !(__SMARTPHONE__ && __WXWINCE__)

private:
   void Init();

   wxString GetFullPath(HWND hwnd, int itm);
   void FilterFiles(HWND hwnd, bool refresh);
   void ParseFilter(int index);

   // Parent dialog hook
   static UINT_PTR APIENTRY ParentHook(HWND hDlg, UINT iMsg, WPARAM wParam, LPARAM lParam);
   virtual UINT_PTR MSWParentHook(HWND hwnd, UINT iMsg, WPARAM wParam, LPARAM lParam, OPENFILENAME *pOfn);

   // Message handlers for the parent dialog
   virtual void MSWOnSize(HWND hwnd, LPOPENFILENAME pOfn);
   virtual void MSWOnGetMinMaxInfo(HWND hwnd, LPOPENFILENAME pOfn, LPMINMAXINFO pMmi);

   // Child dialog hook
   static UINT_PTR APIENTRY DialogHook(HWND hDlg, UINT iMsg, WPARAM wParam, LPARAM lParam);
   virtual UINT_PTR MSWDialogHook(HWND hwnd, UINT iMsg, WPARAM wParam, LPARAM lParam, OPENFILENAME *pOfn);

   // Message handlers for the child dialog
   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);

private:
   wxArrayString m_fileNames;

   // remember if our SetPosition() or Centre() (which requires special
   // treatment) was called
   bool m_bMovedWindow;
   int m_centreDir;        // nothing to do if 0

   wxArrayString m_FilterGroups;
   wxArrayString m_Filters;
   wxChar *m_NameBuf;
   int m_NameBufLen;
   
   HWND mParentDlg;
   HWND mChildDlg;
   WNDPROC mParentProc;
   POINT mMinSize;

   wxPanel *mRoot;

   class Disabler : public wxModalDialogHook
   {
   public:
      Disabler();
      void Init(wxWindow *root, HWND hwnd);

   protected:
      int Enter(wxDialog *dialog);
      void Exit(wxDialog *dialog);
      bool IsChild(const wxDialog *dialog) const;

   private:
      wxWindow *mRoot;
      HWND mHwnd;
      int mModalCount;
   } mDisabler;

   DECLARE_DYNAMIC_CLASS(FileDialog)
   DECLARE_NO_COPY_CLASS(FileDialog)
};

#endif