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