]> git.saurik.com Git - wxWidgets.git/blob - include/wx/gtk/filedlg.h
641c056762ed2d8e8d61c7479599ed2811d1ff24
[wxWidgets.git] / include / wx / gtk / filedlg.h
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: filedlg.h
3 // Purpose:
4 // Author: Robert Roebling
5 // Id: $Id$
6 // Copyright: (c) 1998 Robert Roebling
7 // Licence: wxWindows licence
8 /////////////////////////////////////////////////////////////////////////////
9
10
11 #ifndef __GTKFILEDLGH__
12 #define __GTKFILEDLGH__
13
14 #ifdef __GNUG__
15 #pragma interface
16 #endif
17
18 #include "wx/dialog.h"
19
20 //-------------------------------------------------------------------------
21 // File selector
22 //-------------------------------------------------------------------------
23
24 extern const char *wxFileSelectorPromptStr;
25 extern const char *wxFileSelectorDefaultWildcardStr;
26
27 class wxFileDialog: public wxDialog
28 {
29
30 DECLARE_DYNAMIC_CLASS(wxFileDialog)
31
32 friend void gtk_filedialog_ok_callback( GtkWidget *widget, gpointer data );
33
34 public:
35
36 wxFileDialog() {};
37
38 wxFileDialog(wxWindow *parent, const wxString& message = wxFileSelectorPromptStr,
39 const wxString& defaultDir = "", const wxString& defaultFile = "",
40 const wxString& wildCard = wxFileSelectorDefaultWildcardStr,
41 long style = 0, const wxPoint& pos = wxDefaultPosition);
42
43 inline void SetMessage(const wxString& message) { m_message = message; }
44 inline void SetPath(const wxString& path) { m_path = path; }
45 inline void SetDirectory(const wxString& dir) { m_dir = dir; }
46 inline void SetFilename(const wxString& name) { m_fileName = name; }
47 inline void SetWildcard(const wxString& wildCard) { m_wildCard = wildCard; }
48 inline void SetStyle(long style) { m_dialogStyle = style; }
49 inline void SetFilterIndex(int filterIndex) { m_filterIndex = filterIndex; }
50
51 inline wxString GetMessage(void) const { return m_message; }
52 inline wxString GetPath(void) const { return m_path; }
53 inline wxString GetDirectory(void) const { return m_dir; }
54 inline wxString GetFilename(void) const { return m_fileName; }
55 inline wxString GetWildcard(void) const { return m_wildCard; }
56 inline long GetStyle(void) const { return m_dialogStyle; }
57 inline int GetFilterIndex(void) const { return m_filterIndex ; }
58
59 int ShowModal(void);
60
61 protected:
62
63 wxString m_message;
64 long m_dialogStyle;
65 wxWindow * m_parent;
66 wxString m_dir;
67 wxString m_path; // Full path
68 wxString m_fileName;
69 wxString m_wildCard;
70 int m_filterIndex;
71 };
72
73 #define wxOPEN 1
74 #define wxSAVE 2
75 #define wxOVERWRITE_PROMPT 4
76 #define wxHIDE_READONLY 8
77 #define wxFILE_MUST_EXIST 16
78
79 // File selector - backward compatibility
80 WXDLLEXPORT wxString
81 wxFileSelector(const char *message = wxFileSelectorPromptStr,
82 const char *default_path = NULL,
83 const char *default_filename = NULL,
84 const char *default_extension = NULL,
85 const char *wildcard = wxFileSelectorDefaultWildcardStr,
86 int flags = 0,
87 wxWindow *parent = NULL,
88 int x = -1, int y = -1);
89
90 // An extended version of wxFileSelector
91 WXDLLEXPORT wxString
92 wxFileSelectorEx(const char *message = wxFileSelectorPromptStr,
93 const char *default_path = NULL,
94 const char *default_filename = NULL,
95 int *indexDefaultExtension = NULL,
96 const char *wildcard = wxFileSelectorDefaultWildcardStr,
97 int flags = 0,
98 wxWindow *parent = NULL,
99 int x = -1, int y = -1);
100
101 // Ask for filename to load
102 WXDLLEXPORT wxString
103 wxLoadFileSelector(const char *what,
104 const char *extension,
105 const char *default_name = (const char *)NULL,
106 wxWindow *parent = (wxWindow *) NULL);
107
108 // Ask for filename to save
109 WXDLLEXPORT wxString
110 wxSaveFileSelector(const char *what,
111 const char *extension,
112 const char *default_name = (const char *) NULL,
113 wxWindow *parent = (wxWindow *) NULL);
114
115 #endif
116 // __GTKFILEDLGH__