]>
Commit | Line | Data |
---|---|---|
99d80019 JS |
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 | ||
34138703 JS |
12 | #ifndef _WX_DIRDLG_H_BASE_ |
13 | #define _WX_DIRDLG_H_BASE_ | |
c801d85f | 14 | |
1e6feb95 VZ |
15 | #if wxUSE_DIRDLG |
16 | ||
48013bb0 GD |
17 | #include "wx/dialog.h" |
18 | ||
1044a386 JS |
19 | // ---------------------------------------------------------------------------- |
20 | // constants | |
21 | // ---------------------------------------------------------------------------- | |
22 | ||
63ec432b MR |
23 | extern WXDLLEXPORT_DATA(const wxChar) wxDirDialogNameStr[]; |
24 | extern WXDLLEXPORT_DATA(const wxChar) wxDirDialogDefaultFolderStr[]; | |
25 | extern WXDLLEXPORT_DATA(const wxChar) wxDirSelectorPromptStr[]; | |
26 | ||
1044a386 | 27 | |
30dfe2ff JS |
28 | #ifdef __WXWINCE__ |
29 | #define wxDD_DEFAULT_STYLE \ | |
30 | (wxDEFAULT_DIALOG_STYLE | wxDD_NEW_DIR_BUTTON) | |
31 | #else | |
32 | #define wxDD_DEFAULT_STYLE \ | |
33 | (wxDEFAULT_DIALOG_STYLE | wxRESIZE_BORDER | wxDD_NEW_DIR_BUTTON) | |
34 | #endif | |
e78d4a23 | 35 | |
b50747ea RR |
36 | //------------------------------------------------------------------------- |
37 | // wxDirDialogBase | |
38 | //------------------------------------------------------------------------- | |
e78d4a23 VZ |
39 | |
40 | class WXDLLEXPORT wxDirDialogBase : public wxDialog | |
41 | { | |
42 | public: | |
141d782d | 43 | wxDirDialogBase() {} |
e78d4a23 | 44 | wxDirDialogBase(wxWindow *parent, |
b50747ea | 45 | const wxString& title = wxDirSelectorPromptStr, |
e78d4a23 VZ |
46 | const wxString& defaultPath = wxEmptyString, |
47 | long style = wxDD_DEFAULT_STYLE, | |
48 | const wxPoint& pos = wxDefaultPosition, | |
49 | const wxSize& sz = wxDefaultSize, | |
b50747ea | 50 | const wxString& name = wxDirDialogNameStr) |
141d782d VZ |
51 | { |
52 | Create(parent, title, defaultPath, style, pos, sz, name); | |
53 | } | |
e78d4a23 | 54 | |
b50747ea | 55 | virtual ~wxDirDialogBase() {} |
e78d4a23 | 56 | |
141d782d VZ |
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 | ||
b50747ea RR |
74 | virtual void SetMessage(const wxString& message) { m_message = message; } |
75 | virtual void SetPath(const wxString& path) { m_path = path; } | |
b50747ea RR |
76 | |
77 | virtual wxString GetMessage() const { return m_message; } | |
78 | virtual wxString GetPath() const { return m_path; } | |
b50747ea RR |
79 | |
80 | protected: | |
81 | wxString m_message; | |
82 | wxString m_path; | |
e78d4a23 VZ |
83 | }; |
84 | ||
e78d4a23 | 85 | |
ba7463d8 | 86 | // Universal and non-port related switches with need for generic implementation |
51f5e282 WS |
87 | #if defined(__WXUNIVERSAL__) |
88 | ||
89 | #include "wx/generic/dirdlgg.h" | |
90 | #define wxDirDialog wxGenericDirDialog | |
91 | ||
92 | #elif defined(__WXMSW__) && (defined(__SALFORDC__) || \ | |
93 | !wxUSE_OLE || \ | |
94 | (defined (__GNUWIN32__) && !wxUSE_NORLANDER_HEADERS)) | |
ba7463d8 | 95 | |
4a70a30b | 96 | #include "wx/generic/dirdlgg.h" |
ba7463d8 | 97 | #define wxDirDialog wxGenericDirDialog |
9b141468 | 98 | |
bcfced36 JS |
99 | // MS PocketPC or MS Smartphone |
100 | #elif defined(__WXMSW__) && defined(__WXWINCE__) && !defined(__HANDHELDPC__) | |
9b141468 WS |
101 | |
102 | #include "wx/generic/dirdlgg.h" | |
103 | #define wxDirDialog wxGenericDirDialog | |
ba7463d8 WS |
104 | |
105 | // Native MSW | |
106 | #elif defined(__WXMSW__) | |
107 | ||
108 | #include "wx/msw/dirdlg.h" | |
109 | ||
d7313bdc | 110 | // Native GTK for gtk2.x and generic for gtk1.x |
b50747ea RR |
111 | #elif defined(__WXGTK__) |
112 | ||
d7313bdc | 113 | #if defined( __WXGTK20__ ) |
b50747ea RR |
114 | #include "wx/gtk/dirdlg.h" |
115 | #define wxDirDialog wxDirDialogGTK | |
d7313bdc JJ |
116 | #else |
117 | #include "wx/generic/dirdlgg.h" | |
118 | #define wxDirDialog wxGenericDirDialog | |
119 | #endif | |
b50747ea | 120 | |
ba7463d8 | 121 | // Native Mac |
34138703 | 122 | #elif defined(__WXMAC__) |
ba7463d8 | 123 | |
10eb1f1e | 124 | #include "wx/mac/dirdlg.h" |
c801d85f | 125 | |
937f314d VZ |
126 | // Native Cocoa |
127 | #elif defined(__WXCOCOA__) | |
128 | ||
129 | #include "wx/cocoa/dirdlg.h" | |
130 | ||
ba7463d8 WS |
131 | // Other ports use generic implementation |
132 | #elif defined(__WXMOTIF__) || \ | |
ba7463d8 WS |
133 | defined(__WXX11__) || \ |
134 | defined(__WXMGL__) || \ | |
135 | defined(__WXCOCOA__) || \ | |
136 | defined(__WXPM__) | |
137 | ||
138 | #include "wx/generic/dirdlgg.h" | |
e78d4a23 | 139 | #define wxDirDialog wxGenericDirDialog |
ba7463d8 | 140 | |
e78d4a23 VZ |
141 | #endif |
142 | ||
10eb1f1e VZ |
143 | // ---------------------------------------------------------------------------- |
144 | // common ::wxDirSelector() function | |
145 | // ---------------------------------------------------------------------------- | |
146 | ||
10eb1f1e VZ |
147 | WXDLLEXPORT wxString |
148 | wxDirSelector(const wxString& message = wxDirSelectorPromptStr, | |
149 | const wxString& defaultPath = wxEmptyString, | |
e78d4a23 | 150 | long style = wxDD_DEFAULT_STYLE, |
10eb1f1e VZ |
151 | const wxPoint& pos = wxDefaultPosition, |
152 | wxWindow *parent = NULL); | |
153 | ||
1e6feb95 VZ |
154 | #endif // wxUSE_DIRDLG |
155 | ||
c801d85f | 156 | #endif |
34138703 | 157 | // _WX_DIRDLG_H_BASE_ |