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