]> git.saurik.com Git - wxWidgets.git/blob - include/wx/dirdlg.h
non-pch universal build fix: combo.h should not include combobox.h
[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
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
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
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))
95
96 #include "wx/generic/dirdlgg.h"
97 #define wxDirDialog wxGenericDirDialog
98
99 // MS PocketPC or MS Smartphone
100 #elif defined(__WXMSW__) && defined(__WXWINCE__) && !defined(__HANDHELDPC__)
101
102 #include "wx/generic/dirdlgg.h"
103 #define wxDirDialog wxGenericDirDialog
104
105 // Native MSW
106 #elif defined(__WXMSW__)
107
108 #include "wx/msw/dirdlg.h"
109
110 // Native GTK for gtk2.x and generic for gtk1.x
111 #elif defined(__WXGTK__)
112
113 #if defined( __WXGTK20__ )
114 #include "wx/gtk/dirdlg.h"
115 #define wxDirDialog wxDirDialogGTK
116 #else
117 #include "wx/generic/dirdlgg.h"
118 #define wxDirDialog wxGenericDirDialog
119 #endif
120
121 // Native Mac
122 #elif defined(__WXMAC__)
123
124 #include "wx/mac/dirdlg.h"
125
126 // Native Cocoa
127 #elif defined(__WXCOCOA__)
128
129 #include "wx/cocoa/dirdlg.h"
130
131 // Other ports use generic implementation
132 #elif defined(__WXMOTIF__) || \
133 defined(__WXX11__) || \
134 defined(__WXMGL__) || \
135 defined(__WXCOCOA__) || \
136 defined(__WXPM__)
137
138 #include "wx/generic/dirdlgg.h"
139 #define wxDirDialog wxGenericDirDialog
140
141 #endif
142
143 // ----------------------------------------------------------------------------
144 // common ::wxDirSelector() function
145 // ----------------------------------------------------------------------------
146
147 WXDLLEXPORT wxString
148 wxDirSelector(const wxString& message = wxDirSelectorPromptStr,
149 const wxString& defaultPath = wxEmptyString,
150 long style = wxDD_DEFAULT_STYLE,
151 const wxPoint& pos = wxDefaultPosition,
152 wxWindow *parent = NULL);
153
154 #endif // wxUSE_DIRDLG
155
156 #endif
157 // _WX_DIRDLG_H_BASE_