]> git.saurik.com Git - wxWidgets.git/blob - include/wx/dirdlg.h
fix VC compilation warnings about implicit int->bool conversion after last check in
[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 #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 WXDLLEXPORT 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
77 virtual void SetMessage(const wxString& message) { m_message = message; }
78 virtual void SetPath(const wxString& path) { m_path = path; }
79
80 virtual wxString GetMessage() const { return m_message; }
81 virtual wxString GetPath() const { return m_path; }
82
83 protected:
84 wxString m_message;
85 wxString m_path;
86 };
87
88
89 // Universal and non-port related switches with need for generic implementation
90 #if defined(__WXUNIVERSAL__)
91 #include "wx/generic/dirdlgg.h"
92 #define wxDirDialog wxGenericDirDialog
93 #elif defined(__WXMSW__) && (defined(__SALFORDC__) || \
94 !wxUSE_OLE || \
95 (defined (__GNUWIN32__) && !wxUSE_NORLANDER_HEADERS))
96 #include "wx/generic/dirdlgg.h"
97 #define wxDirDialog wxGenericDirDialog
98 #elif defined(__WXMSW__) && defined(__WXWINCE__) && !defined(__HANDHELDPC__)
99 #include "wx/generic/dirdlgg.h" // MS PocketPC or MS Smartphone
100 #define wxDirDialog wxGenericDirDialog
101 #elif defined(__WXMSW__)
102 #include "wx/msw/dirdlg.h" // Native MSW
103 #elif defined(__WXGTK24__)
104 #include "wx/gtk/dirdlg.h" // Native GTK for gtk2.4
105 #elif defined(__WXGTK__)
106 #include "wx/generic/dirdlgg.h"
107 #define wxDirDialog wxGenericDirDialog
108 #elif defined(__WXMAC__)
109 #include "wx/mac/dirdlg.h" // Native Mac
110 #elif defined(__WXCOCOA__)
111 #include "wx/cocoa/dirdlg.h" // Native Cocoa
112 #elif defined(__WXMOTIF__) || \
113 defined(__WXX11__) || \
114 defined(__WXMGL__) || \
115 defined(__WXCOCOA__) || \
116 defined(__WXPM__)
117 #include "wx/generic/dirdlgg.h" // Other ports use generic implementation
118 #define wxDirDialog wxGenericDirDialog
119 #endif
120
121 // ----------------------------------------------------------------------------
122 // common ::wxDirSelector() function
123 // ----------------------------------------------------------------------------
124
125 WXDLLEXPORT wxString
126 wxDirSelector(const wxString& message = wxDirSelectorPromptStr,
127 const wxString& defaultPath = wxEmptyString,
128 long style = wxDD_DEFAULT_STYLE,
129 const wxPoint& pos = wxDefaultPosition,
130 wxWindow *parent = NULL);
131
132 #endif // wxUSE_DIRDLG
133
134 #endif
135 // _WX_DIRDLG_H_BASE_