File/dir dialog styles and other changes (patch 1488371):
[wxWidgets.git] / include / wx / dirdlg.h
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: wx/dirdlg.h
3 // Purpose: wxDirDialog base class
4 // Author: Robert Roebling
5 // Modified by:
6 // Created:
7 // Copyright: (c) Robert Roebling
8 // RCS-ID: $Id$
9 // Licence: wxWindows Licence
10 /////////////////////////////////////////////////////////////////////////////
11
12 #ifndef _WX_DIRDLG_H_BASE_
13 #define _WX_DIRDLG_H_BASE_
14
15 #if wxUSE_DIRDLG
16
17 #include "wx/dialog.h"
18
19 // ----------------------------------------------------------------------------
20 // constants
21 // ----------------------------------------------------------------------------
22
23 extern WXDLLEXPORT_DATA(const wxChar) wxDirDialogNameStr[];
24 extern WXDLLEXPORT_DATA(const wxChar) wxDirDialogDefaultFolderStr[];
25 extern WXDLLEXPORT_DATA(const wxChar) wxDirSelectorPromptStr[];
26
27 #define wxDD_DIR_MUST_EXIST 0x0080
28 #define wxDD_CHANGE_DIR 0x0100
29
30 #ifdef __WXWINCE__
31 #define wxDD_DEFAULT_STYLE wxDEFAULT_DIALOG_STYLE
32 #else
33 #define wxDD_DEFAULT_STYLE (wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER)
34 #endif
35
36 //-------------------------------------------------------------------------
37 // wxDirDialogBase
38 //-------------------------------------------------------------------------
39
40 class WXDLLEXPORT wxDirDialogBase : public wxDialog
41 {
42 public:
43 wxDirDialogBase() {}
44 wxDirDialogBase(wxWindow *parent,
45 const wxString& title = wxDirSelectorPromptStr,
46 const wxString& defaultPath = wxEmptyString,
47 long style = wxDD_DEFAULT_STYLE,
48 const wxPoint& pos = wxDefaultPosition,
49 const wxSize& sz = wxDefaultSize,
50 const wxString& name = wxDirDialogNameStr)
51 {
52 Create(parent, title, defaultPath, style, pos, sz, name);
53 }
54
55 virtual ~wxDirDialogBase() {}
56
57
58 bool Create(wxWindow *parent,
59 const wxString& title = wxDirSelectorPromptStr,
60 const wxString& defaultPath = wxEmptyString,
61 long style = wxDD_DEFAULT_STYLE,
62 const wxPoint& pos = wxDefaultPosition,
63 const wxSize& sz = wxDefaultSize,
64 const wxString& name = wxDirDialogNameStr)
65 {
66 if (!wxDialog::Create(parent, wxID_ANY, title, pos, sz, style, name))
67 return false;
68 m_path = defaultPath;
69 m_message = title;
70 return true;
71 }
72
73
74 virtual void SetMessage(const wxString& message) { m_message = message; }
75 virtual void SetPath(const wxString& path) { m_path = path; }
76
77 virtual wxString GetMessage() const { return m_message; }
78 virtual wxString GetPath() const { return m_path; }
79
80 protected:
81 wxString m_message;
82 wxString m_path;
83 };
84
85
86 // Universal and non-port related switches with need for generic implementation
87 #if defined(__WXUNIVERSAL__)
88 #include "wx/generic/dirdlgg.h"
89 #define wxDirDialog wxGenericDirDialog
90 #elif defined(__WXMSW__) && (defined(__SALFORDC__) || \
91 !wxUSE_OLE || \
92 (defined (__GNUWIN32__) && !wxUSE_NORLANDER_HEADERS))
93 #include "wx/generic/dirdlgg.h"
94 #define wxDirDialog wxGenericDirDialog
95 #elif defined(__WXMSW__) && defined(__WXWINCE__) && !defined(__HANDHELDPC__)
96 #include "wx/generic/dirdlgg.h" // MS PocketPC or MS Smartphone
97 #define wxDirDialog wxGenericDirDialog
98 #elif defined(__WXMSW__)
99 #include "wx/msw/dirdlg.h" // Native MSW
100 #elif defined(__WXGTK24__)
101 #include "wx/gtk/dirdlg.h" // Native GTK for gtk2.4
102 #elif defined(__WXGTK__)
103 #include "wx/generic/dirdlgg.h"
104 #define wxDirDialog wxGenericDirDialog
105 #elif defined(__WXMAC__)
106 #include "wx/mac/dirdlg.h" // Native Mac
107 #elif defined(__WXCOCOA__)
108 #include "wx/cocoa/dirdlg.h" // Native Cocoa
109 #elif defined(__WXMOTIF__) || \
110 defined(__WXX11__) || \
111 defined(__WXMGL__) || \
112 defined(__WXCOCOA__) || \
113 defined(__WXPM__)
114 #include "wx/generic/dirdlgg.h" // Other ports use generic implementation
115 #define wxDirDialog wxGenericDirDialog
116 #endif
117
118 // ----------------------------------------------------------------------------
119 // common ::wxDirSelector() function
120 // ----------------------------------------------------------------------------
121
122 WXDLLEXPORT wxString
123 wxDirSelector(const wxString& message = wxDirSelectorPromptStr,
124 const wxString& defaultPath = wxEmptyString,
125 long style = wxDD_DEFAULT_STYLE,
126 const wxPoint& pos = wxDefaultPosition,
127 wxWindow *parent = NULL);
128
129 #endif // wxUSE_DIRDLG
130
131 #endif
132 // _WX_DIRDLG_H_BASE_