]>
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 | ||
f36e602b VZ |
23 | extern WXDLLEXPORT_DATA(const char) wxDirDialogNameStr[]; |
24 | extern WXDLLEXPORT_DATA(const char) wxDirDialogDefaultFolderStr[]; | |
25 | extern WXDLLEXPORT_DATA(const char) wxDirSelectorPromptStr[]; | |
63ec432b | 26 | |
ff3e84ff | 27 | #define wxDD_CHANGE_DIR 0x0100 |
347f5baa VZ |
28 | #define wxDD_DIR_MUST_EXIST 0x0200 |
29 | ||
30 | // deprecated, on by default now, use wxDD_DIR_MUST_EXIST to disable it | |
31 | #define wxDD_NEW_DIR_BUTTON 0 | |
1044a386 | 32 | |
30dfe2ff | 33 | #ifdef __WXWINCE__ |
ff3e84ff | 34 | #define wxDD_DEFAULT_STYLE wxDEFAULT_DIALOG_STYLE |
30dfe2ff | 35 | #else |
ff3e84ff | 36 | #define wxDD_DEFAULT_STYLE (wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER) |
30dfe2ff | 37 | #endif |
e78d4a23 | 38 | |
b50747ea RR |
39 | //------------------------------------------------------------------------- |
40 | // wxDirDialogBase | |
41 | //------------------------------------------------------------------------- | |
e78d4a23 VZ |
42 | |
43 | class WXDLLEXPORT wxDirDialogBase : public wxDialog | |
44 | { | |
45 | public: | |
141d782d | 46 | wxDirDialogBase() {} |
e78d4a23 | 47 | wxDirDialogBase(wxWindow *parent, |
b50747ea | 48 | const wxString& title = wxDirSelectorPromptStr, |
e78d4a23 VZ |
49 | const wxString& defaultPath = wxEmptyString, |
50 | long style = wxDD_DEFAULT_STYLE, | |
51 | const wxPoint& pos = wxDefaultPosition, | |
52 | const wxSize& sz = wxDefaultSize, | |
b50747ea | 53 | const wxString& name = wxDirDialogNameStr) |
141d782d VZ |
54 | { |
55 | Create(parent, title, defaultPath, style, pos, sz, name); | |
56 | } | |
e78d4a23 | 57 | |
b50747ea | 58 | virtual ~wxDirDialogBase() {} |
e78d4a23 | 59 | |
141d782d VZ |
60 | |
61 | bool Create(wxWindow *parent, | |
62 | const wxString& title = wxDirSelectorPromptStr, | |
63 | const wxString& defaultPath = wxEmptyString, | |
64 | long style = wxDD_DEFAULT_STYLE, | |
65 | const wxPoint& pos = wxDefaultPosition, | |
66 | const wxSize& sz = wxDefaultSize, | |
67 | const wxString& name = wxDirDialogNameStr) | |
68 | { | |
69 | if (!wxDialog::Create(parent, wxID_ANY, title, pos, sz, style, name)) | |
70 | return false; | |
71 | m_path = defaultPath; | |
72 | m_message = title; | |
73 | return true; | |
74 | } | |
75 | ||
cc197ed4 VZ |
76 | #if WXWIN_COMPATIBILITY_2_6 |
77 | ||
78 | wxDEPRECATED( long GetStyle() const ); | |
79 | wxDEPRECATED( void SetStyle(long style) ); | |
80 | ||
81 | #endif // WXWIN_COMPATIBILITY_2_6 | |
141d782d | 82 | |
b50747ea RR |
83 | virtual void SetMessage(const wxString& message) { m_message = message; } |
84 | virtual void SetPath(const wxString& path) { m_path = path; } | |
b50747ea RR |
85 | |
86 | virtual wxString GetMessage() const { return m_message; } | |
87 | virtual wxString GetPath() const { return m_path; } | |
b50747ea RR |
88 | |
89 | protected: | |
90 | wxString m_message; | |
91 | wxString m_path; | |
e78d4a23 VZ |
92 | }; |
93 | ||
e78d4a23 | 94 | |
ba7463d8 | 95 | // Universal and non-port related switches with need for generic implementation |
51f5e282 | 96 | #if defined(__WXUNIVERSAL__) |
51f5e282 WS |
97 | #include "wx/generic/dirdlgg.h" |
98 | #define wxDirDialog wxGenericDirDialog | |
51f5e282 WS |
99 | #elif defined(__WXMSW__) && (defined(__SALFORDC__) || \ |
100 | !wxUSE_OLE || \ | |
101 | (defined (__GNUWIN32__) && !wxUSE_NORLANDER_HEADERS)) | |
4a70a30b | 102 | #include "wx/generic/dirdlgg.h" |
ba7463d8 | 103 | #define wxDirDialog wxGenericDirDialog |
bcfced36 | 104 | #elif defined(__WXMSW__) && defined(__WXWINCE__) && !defined(__HANDHELDPC__) |
ff3e84ff | 105 | #include "wx/generic/dirdlgg.h" // MS PocketPC or MS Smartphone |
9b141468 | 106 | #define wxDirDialog wxGenericDirDialog |
ba7463d8 | 107 | #elif defined(__WXMSW__) |
ff3e84ff | 108 | #include "wx/msw/dirdlg.h" // Native MSW |
ff654490 | 109 | #elif defined(__WXGTK20__) |
ff3e84ff | 110 | #include "wx/gtk/dirdlg.h" // Native GTK for gtk2.4 |
b50747ea | 111 | #elif defined(__WXGTK__) |
d7313bdc JJ |
112 | #include "wx/generic/dirdlgg.h" |
113 | #define wxDirDialog wxGenericDirDialog | |
34138703 | 114 | #elif defined(__WXMAC__) |
ff3e84ff | 115 | #include "wx/mac/dirdlg.h" // Native Mac |
937f314d | 116 | #elif defined(__WXCOCOA__) |
ff3e84ff | 117 | #include "wx/cocoa/dirdlg.h" // Native Cocoa |
ba7463d8 | 118 | #elif defined(__WXMOTIF__) || \ |
ba7463d8 WS |
119 | defined(__WXX11__) || \ |
120 | defined(__WXMGL__) || \ | |
121 | defined(__WXCOCOA__) || \ | |
122 | defined(__WXPM__) | |
ff3e84ff | 123 | #include "wx/generic/dirdlgg.h" // Other ports use generic implementation |
e78d4a23 VZ |
124 | #define wxDirDialog wxGenericDirDialog |
125 | #endif | |
126 | ||
10eb1f1e VZ |
127 | // ---------------------------------------------------------------------------- |
128 | // common ::wxDirSelector() function | |
129 | // ---------------------------------------------------------------------------- | |
130 | ||
10eb1f1e VZ |
131 | WXDLLEXPORT wxString |
132 | wxDirSelector(const wxString& message = wxDirSelectorPromptStr, | |
133 | const wxString& defaultPath = wxEmptyString, | |
e78d4a23 | 134 | long style = wxDD_DEFAULT_STYLE, |
10eb1f1e VZ |
135 | const wxPoint& pos = wxDefaultPosition, |
136 | wxWindow *parent = NULL); | |
137 | ||
1e6feb95 VZ |
138 | #endif // wxUSE_DIRDLG |
139 | ||
c801d85f | 140 | #endif |
34138703 | 141 | // _WX_DIRDLG_H_BASE_ |