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