]> git.saurik.com Git - wxWidgets.git/blob - include/wx/dirdlg.h
Allow specifying non default port for wxFTP connections.
[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 WXDLLIMPEXP_DATA_CORE(const char) wxDirDialogNameStr[];
24 extern WXDLLIMPEXP_DATA_CORE(const char) wxDirDialogDefaultFolderStr[];
25 extern WXDLLIMPEXP_DATA_CORE(const char) wxDirSelectorPromptStr[];
26
27 #define wxDD_CHANGE_DIR 0x0100
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
32
33 #ifdef __WXWINCE__
34 #define wxDD_DEFAULT_STYLE wxDEFAULT_DIALOG_STYLE
35 #else
36 #define wxDD_DEFAULT_STYLE (wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER)
37 #endif
38
39 //-------------------------------------------------------------------------
40 // wxDirDialogBase
41 //-------------------------------------------------------------------------
42
43 class WXDLLIMPEXP_CORE wxDirDialogBase : public wxDialog
44 {
45 public:
46 wxDirDialogBase() {}
47 wxDirDialogBase(wxWindow *parent,
48 const wxString& title = wxDirSelectorPromptStr,
49 const wxString& defaultPath = wxEmptyString,
50 long style = wxDD_DEFAULT_STYLE,
51 const wxPoint& pos = wxDefaultPosition,
52 const wxSize& sz = wxDefaultSize,
53 const wxString& name = wxDirDialogNameStr)
54 {
55 Create(parent, title, defaultPath, style, pos, sz, name);
56 }
57
58 virtual ~wxDirDialogBase() {}
59
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
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
82
83 virtual void SetMessage(const wxString& message) { m_message = message; }
84 virtual void SetPath(const wxString& path) { m_path = path; }
85
86 virtual wxString GetMessage() const { return m_message; }
87 virtual wxString GetPath() const { return m_path; }
88
89 protected:
90 wxString m_message;
91 wxString m_path;
92 };
93
94
95 // Universal and non-port related switches with need for generic implementation
96 #if defined(__WXUNIVERSAL__)
97 #include "wx/generic/dirdlgg.h"
98 #define wxDirDialog wxGenericDirDialog
99 #elif defined(__WXMSW__) && (!wxUSE_OLE || \
100 (defined (__GNUWIN32__) && !wxUSE_NORLANDER_HEADERS))
101 #include "wx/generic/dirdlgg.h"
102 #define wxDirDialog wxGenericDirDialog
103 #elif defined(__WXMSW__) && defined(__WXWINCE__) && !defined(__HANDHELDPC__)
104 #include "wx/generic/dirdlgg.h" // MS PocketPC or MS Smartphone
105 #define wxDirDialog wxGenericDirDialog
106 #elif defined(__WXMSW__)
107 #include "wx/msw/dirdlg.h" // Native MSW
108 #elif defined(__WXGTK20__)
109 #include "wx/gtk/dirdlg.h" // Native GTK for gtk2.4
110 #elif defined(__WXGTK__)
111 #include "wx/generic/dirdlgg.h"
112 #define wxDirDialog wxGenericDirDialog
113 #elif defined(__WXMAC__)
114 #include "wx/osx/dirdlg.h" // Native Mac
115 #elif defined(__WXCOCOA__)
116 #include "wx/cocoa/dirdlg.h" // Native Cocoa
117 #elif defined(__WXMOTIF__) || \
118 defined(__WXX11__) || \
119 defined(__WXMGL__) || \
120 defined(__WXCOCOA__) || \
121 defined(__WXPALMOS__) || \
122 defined(__WXPM__)
123 #include "wx/generic/dirdlgg.h" // Other ports use generic implementation
124 #define wxDirDialog wxGenericDirDialog
125 #endif
126
127 // ----------------------------------------------------------------------------
128 // common ::wxDirSelector() function
129 // ----------------------------------------------------------------------------
130
131 WXDLLIMPEXP_CORE wxString
132 wxDirSelector(const wxString& message = wxDirSelectorPromptStr,
133 const wxString& defaultPath = wxEmptyString,
134 long style = wxDD_DEFAULT_STYLE,
135 const wxPoint& pos = wxDefaultPosition,
136 wxWindow *parent = NULL);
137
138 #endif // wxUSE_DIRDLG
139
140 #endif
141 // _WX_DIRDLG_H_BASE_