]> git.saurik.com Git - wxWidgets.git/blame - include/wx/stdpaths.h
Add wxDataViewRendererBase::GetEffectiveAlignment() and use it.
[wxWidgets.git] / include / wx / stdpaths.h
CommitLineData
1ee445c7 1///////////////////////////////////////////////////////////////////////////////
96e2aec5
VZ
2// Name: wx/stdpaths.h
3// Purpose: declaration of wxStandardPaths class
1ee445c7
VZ
4// Author: Vadim Zeitlin
5// Modified by:
6// Created: 2004-10-17
1ee445c7
VZ
7// Copyright: (c) 2004 Vadim Zeitlin <vadim@wxwindows.org>
8// Licence: wxWindows licence
9///////////////////////////////////////////////////////////////////////////////
10
0b75a1e0
VZ
11#ifndef _WX_STDPATHS_H_
12#define _WX_STDPATHS_H_
1ee445c7 13
07158944
VZ
14#include "wx/defs.h"
15
6cb5e50b 16#include "wx/string.h"
f45bffb6 17#include "wx/filefn.h"
6cb5e50b 18
25f49256
VZ
19class WXDLLIMPEXP_FWD_BASE wxStandardPaths;
20
1ee445c7 21// ----------------------------------------------------------------------------
96e2aec5 22// wxStandardPaths returns the standard locations in the file system
1ee445c7
VZ
23// ----------------------------------------------------------------------------
24
6ae3ead6
VS
25// NB: This is always compiled in, wxUSE_STDPATHS=0 only disables native
26// wxStandardPaths class, but a minimal version is always available
6cb5e50b 27class WXDLLIMPEXP_BASE wxStandardPathsBase
1ee445c7
VZ
28{
29public:
f1b08e84 30 // possible resources categories
3af9f2de
VZ
31 enum ResourceCat
32 {
33 // no special category
34 ResourceCat_None,
35
36 // message catalog resources
37 ResourceCat_Messages,
38
39 // end of enum marker
40 ResourceCat_Max
41 };
42
2b147f2e
VZ
43 // what should we use to construct paths unique to this application:
44 // (AppInfo_AppName and AppInfo_VendorName can be combined together)
45 enum
46 {
47 AppInfo_None = 0, // nothing
48 AppInfo_AppName = 1, // the application name
49 AppInfo_VendorName = 2 // the vendor name
50 };
51
3af9f2de 52
6cb5e50b 53 // return the global standard paths object
25f49256 54 static wxStandardPaths& Get();
48713afd 55
ac7ad70d
RR
56 // return the path (directory+filename) of the running executable or
57 // wxEmptyString if it couldn't be determined.
58 // The path is returned as an absolute path whenever possible.
59 // Default implementation only try to use wxApp->argv[0].
60 virtual wxString GetExecutablePath() const;
48713afd 61
1ee445c7 62 // return the directory with system config files:
6cb5e50b
VZ
63 // /etc under Unix, c:\Documents and Settings\All Users\Application Data
64 // under Windows, /Library/Preferences for Mac
65 virtual wxString GetConfigDir() const = 0;
1ee445c7
VZ
66
67 // return the directory for the user config files:
68 // $HOME under Unix, c:\Documents and Settings\username under Windows,
69 // ~/Library/Preferences under Mac
70 //
71 // only use this if you have a single file to put there, otherwise
72 // GetUserDataDir() is more appropriate
6cb5e50b 73 virtual wxString GetUserConfigDir() const = 0;
1ee445c7
VZ
74
75 // return the location of the applications global, i.e. not user-specific,
76 // data files
77 //
48713afd
VZ
78 // prefix/share/appname under Unix, c:\Program Files\appname under Windows,
79 // appname.app/Contents/SharedSupport app bundle directory under Mac
6cb5e50b 80 virtual wxString GetDataDir() const = 0;
1ee445c7
VZ
81
82 // return the location for application data files which are host-specific
83 //
84 // same as GetDataDir() except under Unix where it is /etc/appname
6cb5e50b 85 virtual wxString GetLocalDataDir() const;
1ee445c7
VZ
86
87 // return the directory for the user-dependent application data files
88 //
89 // $HOME/.appname under Unix,
90 // c:\Documents and Settings\username\Application Data\appname under Windows
48713afd 91 // and ~/Library/Application Support/appname under Mac
6cb5e50b 92 virtual wxString GetUserDataDir() const = 0;
1ee445c7
VZ
93
94 // return the directory for user data files which shouldn't be shared with
95 // the other machines
96 //
97 // same as GetUserDataDir() for all platforms except Windows where it is
98 // the "Local Settings\Application Data\appname" directory
6cb5e50b 99 virtual wxString GetUserLocalDataDir() const;
1ee445c7
VZ
100
101 // return the directory where the loadable modules (plugins) live
102 //
48713afd 103 // prefix/lib/appname under Unix, program directory under Windows and
1ee445c7 104 // Contents/Plugins app bundle subdirectory under Mac
6cb5e50b
VZ
105 virtual wxString GetPluginsDir() const = 0;
106
3af9f2de
VZ
107 // get resources directory: resources are auxiliary files used by the
108 // application and include things like image and sound files
109 //
110 // same as GetDataDir() for all platforms except Mac where it returns
111 // Contents/Resources subdirectory of the app bundle
112 virtual wxString GetResourcesDir() const { return GetDataDir(); }
113
114 // get localized resources directory containing the resource files of the
115 // specified category for the given language
116 //
117 // in general this is just GetResourcesDir()/lang under Windows and Unix
118 // and GetResourcesDir()/lang.lproj under Mac but is something quite
119 // different under Unix for message catalog category (namely the standard
120 // prefix/share/locale/lang/LC_MESSAGES)
121 virtual wxString
e0b3b9d0 122 GetLocalizedResourcesDir(const wxString& lang,
8c943368
VZ
123 ResourceCat WXUNUSED(category)
124 = ResourceCat_None) const
3af9f2de
VZ
125 {
126 return GetResourcesDir() + wxFILE_SEP_PATH + lang;
127 }
128
17af82fb
VZ
129 // return the "Documents" directory for the current user
130 //
9c498e84 131 // C:\Documents and Settings\username\My Documents under Windows,
17af82fb
VZ
132 // $HOME under Unix and ~/Documents under Mac
133 virtual wxString GetDocumentsDir() const;
134
d8efd219
VZ
135 // return the directory for the documents files used by this application:
136 // it's a subdirectory of GetDocumentsDir() constructed using the
137 // application name/vendor if it exists or just GetDocumentsDir() otherwise
138 virtual wxString GetAppDocumentsDir() const;
139
ecf9559d
JS
140 // return the temporary directory for the current user
141 virtual wxString GetTempDir() const;
142
6cb5e50b
VZ
143
144 // virtual dtor for the base class
145 virtual ~wxStandardPathsBase();
ce336c6d 146
2b147f2e
VZ
147 // Information used by AppendAppInfo
148 void UseAppInfo(int info)
149 {
150 m_usedAppInfo = info;
151 }
152
153 bool UsesAppInfo(int info) const { return (m_usedAppInfo & info) != 0; }
154
155
ce336c6d 156protected:
38aae140
VZ
157 // Ctor is protected as this is a base class which should never be created
158 // directly.
159 wxStandardPathsBase();
160
d8efd219
VZ
161 // append the path component, with a leading path separator if a
162 // path separator or dot (.) is not already at the end of dir
2b147f2e
VZ
163 static wxString AppendPathComponent(const wxString& dir, const wxString& component);
164
165 // append application information determined by m_usedAppInfo to dir
166 wxString AppendAppInfo(const wxString& dir) const;
167
168
169 // combination of AppInfo_XXX flags used by AppendAppInfo()
170 int m_usedAppInfo;
1ee445c7
VZ
171};
172
6ae3ead6 173#if wxUSE_STDPATHS
d98a58c5 174 #if defined(__WINDOWS__)
6ae3ead6
VS
175 #include "wx/msw/stdpaths.h"
176 #define wxHAS_NATIVE_STDPATHS
177 // We want CoreFoundation paths on both CarbonLib and Darwin (for all ports)
178 #elif defined(__WXMAC__) || defined(__DARWIN__)
ef0e9220 179 #include "wx/osx/core/stdpaths.h"
6ae3ead6
VS
180 #define wxHAS_NATIVE_STDPATHS
181 #elif defined(__OS2__)
182 #include "wx/os2/stdpaths.h"
183 #define wxHAS_NATIVE_STDPATHS
184 #elif defined(__UNIX__)
185 #include "wx/unix/stdpaths.h"
186 #define wxHAS_NATIVE_STDPATHS
6ae3ead6
VS
187 #endif
188#endif
46a28273
MW
189
190// ----------------------------------------------------------------------------
d6f42b1b 191// Minimal generic implementation
46a28273
MW
192// ----------------------------------------------------------------------------
193
6ae3ead6
VS
194// NB: Note that this minimal implementation is compiled in even if
195// wxUSE_STDPATHS=0, so that our code can still use wxStandardPaths.
196
197#ifndef wxHAS_NATIVE_STDPATHS
46a28273
MW
198class WXDLLIMPEXP_BASE wxStandardPaths : public wxStandardPathsBase
199{
200public:
201 void SetInstallPrefix(const wxString& prefix) { m_prefix = prefix; }
202 wxString GetInstallPrefix() const { return m_prefix; }
ac7ad70d
RR
203
204 virtual wxString GetExecutablePath() const { return m_prefix; }
46a28273
MW
205 virtual wxString GetConfigDir() const { return m_prefix; }
206 virtual wxString GetUserConfigDir() const { return m_prefix; }
207 virtual wxString GetDataDir() const { return m_prefix; }
208 virtual wxString GetLocalDataDir() const { return m_prefix; }
209 virtual wxString GetUserDataDir() const { return m_prefix; }
210 virtual wxString GetPluginsDir() const { return m_prefix; }
17af82fb 211 virtual wxString GetDocumentsDir() const { return m_prefix; }
46a28273 212
38aae140
VZ
213protected:
214 // Ctor is protected because wxStandardPaths::Get() should always be used
215 // to access the global wxStandardPaths object of the correct type instead
216 // of creating one of a possibly wrong type yourself.
217 wxStandardPaths() { }
218
46a28273
MW
219private:
220 wxString m_prefix;
221};
6ae3ead6 222#endif // !wxHAS_NATIVE_STDPATHS
07158944 223
0b75a1e0 224#endif // _WX_STDPATHS_H_
1ee445c7 225