]> git.saurik.com Git - wxWidgets.git/blob - include/wx/motif/filedlg.h
Small change
[wxWidgets.git] / include / wx / motif / filedlg.h
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: filedlg.h
3 // Purpose: wxFileDialog class
4 // Author: Julian Smart
5 // Modified by:
6 // Created: 17/09/98
7 // RCS-ID: $Id$
8 // Copyright: (c) Julian Smart
9 // Licence: wxWindows licence
10 /////////////////////////////////////////////////////////////////////////////
11
12 #ifndef _WX_FILEDLG_H_
13 #define _WX_FILEDLG_H_
14
15 #ifdef __GNUG__
16 #pragma interface "filedlg.h"
17 #endif
18
19 #include "wx/dialog.h"
20
21 /*
22 * File selector
23 */
24
25 WXDLLEXPORT_DATA(extern const char*) wxFileSelectorPromptStr;
26 WXDLLEXPORT_DATA(extern const char*) wxFileSelectorDefaultWildcardStr;
27
28 class WXDLLEXPORT wxFileDialog: public wxDialog
29 {
30 DECLARE_DYNAMIC_CLASS(wxFileDialog)
31 public:
32 wxString m_message;
33 long m_dialogStyle;
34 wxWindow * m_parent;
35 wxString m_dir;
36 wxString m_path; // Full path
37 wxString m_fileName;
38 wxString m_wildCard;
39 int m_filterIndex;
40
41 // For Motif
42 wxPoint m_pos;
43 static wxString m_fileSelectorAnswer;
44 static bool m_fileSelectorReturned;
45
46 public:
47 wxFileDialog(wxWindow *parent, const wxString& message = wxFileSelectorPromptStr,
48 const wxString& defaultDir = "", const wxString& defaultFile = "", const wxString& wildCard = wxFileSelectorDefaultWildcardStr,
49 long style = 0, const wxPoint& pos = wxDefaultPosition);
50
51 inline void SetMessage(const wxString& message) { m_message = message; }
52 inline void SetPath(const wxString& path) { m_path = path; }
53 inline void SetDirectory(const wxString& dir) { m_dir = dir; }
54 inline void SetFilename(const wxString& name) { m_fileName = name; }
55 inline void SetWildcard(const wxString& wildCard) { m_wildCard = wildCard; }
56 inline void SetStyle(long style) { m_dialogStyle = style; }
57 inline void SetFilterIndex(int filterIndex) { m_filterIndex = filterIndex; }
58
59 inline wxString GetMessage() const { return m_message; }
60 inline wxString GetPath() const { return m_path; }
61 inline void GetPaths(wxArrayString& a) { a.Empty(); a.Add(m_path); }
62 inline wxString GetDirectory() const { return m_dir; }
63 inline wxString GetFilename() const { return m_fileName; }
64 inline void GetFilenames(wxArrayString& a) { a.Empty();
65 a.Add( m_fileName); }
66 inline wxString GetWildcard() const { return m_wildCard; }
67 inline long GetStyle() const { return m_dialogStyle; }
68 inline int GetFilterIndex() const { return m_filterIndex ; }
69
70 int ShowModal();
71 };
72
73 #define wxOPEN 0x0001
74 #define wxSAVE 0x0002
75 #define wxOVERWRITE_PROMPT 0x0004
76 #define wxHIDE_READONLY 0x0008
77 #define wxFILE_MUST_EXIST 0x0010
78
79 // File selector - backward compatibility
80 WXDLLEXPORT wxString wxFileSelector(const char *message = wxFileSelectorPromptStr, const char *default_path = NULL,
81 const char *default_filename = NULL, const char *default_extension = NULL,
82 const char *wildcard = wxFileSelectorDefaultWildcardStr, int flags = 0,
83 wxWindow *parent = NULL, int x = -1, int y = -1);
84
85 // An extended version of wxFileSelector
86 WXDLLEXPORT wxString wxFileSelectorEx(const char *message = wxFileSelectorPromptStr, const char *default_path = NULL,
87 const char *default_filename = NULL, int *indexDefaultExtension = NULL,
88 const char *wildcard = wxFileSelectorDefaultWildcardStr, int flags = 0,
89 wxWindow *parent = NULL, int x = -1, int y = -1);
90
91 // Generic file load dialog
92 WXDLLEXPORT wxString wxLoadFileSelector(const char *what, const char *extension, const char *default_name = NULL, wxWindow *parent = NULL);
93
94 // Generic file save dialog
95 WXDLLEXPORT wxString wxSaveFileSelector(const char *what, const char *extension, const char *default_name = NULL, wxWindow *parent = NULL);
96
97 #endif
98 // _WX_FILEDLG_H_