]> git.saurik.com Git - wxWidgets.git/blame - interface/wx/stdpaths.h
added support for bitmaps in wxButton to wxOSX/Cocoa
[wxWidgets.git] / interface / wx / stdpaths.h
CommitLineData
23324ae1
FM
1/////////////////////////////////////////////////////////////////////////////
2// Name: stdpaths.h
e54c96f1 3// Purpose: interface of wxStandardPaths
23324ae1
FM
4// Author: wxWidgets team
5// RCS-ID: $Id$
6// Licence: wxWindows license
7/////////////////////////////////////////////////////////////////////////////
8
9/**
10 @class wxStandardPaths
7c913512 11
23324ae1
FM
12 wxStandardPaths returns the standard locations in the file system and should be
13 used by applications to find their data files in a portable way.
7c913512 14
23324ae1
FM
15 In the description of the methods below, the example return values are given
16 for the Unix, Windows and Mac OS X systems, however please note that these are
17 just the examples and the actual values may differ. For example, under Windows:
18 the system administrator may change the standard directories locations, i.e.
4701dc09
FM
19 the Windows directory may be named @c "W:\Win2003" instead of
20 the default @c "C:\Windows".
7c913512 21
4701dc09
FM
22 The strings @c appname and @c username should be replaced with the value
23 returned by wxApp::GetAppName() and the name of the currently logged in user,
24 respectively. The string @c prefix is only used under Unix and is @c /usr/local by
23324ae1 25 default but may be changed using wxStandardPaths::SetInstallPrefix.
7c913512 26
4701dc09
FM
27 The directories returned by the methods of this class may or may not exist.
28 If they don't exist, it's up to the caller to create them, wxStandardPaths doesn't
23324ae1 29 do it.
7c913512 30
23324ae1
FM
31 Finally note that these functions only work with standardly packaged
32 applications. I.e. under Unix you should follow the standard installation
33 conventions and under Mac you should create your application bundle according
34 to the Apple guidelines. Again, this class doesn't help you to do it.
7c913512 35
23324ae1
FM
36 This class is MT-safe: its methods may be called concurrently from different
37 threads without additional locking.
7c913512 38
4701dc09
FM
39 Note that you don't allocate an instance of class wxStandardPaths, but retrieve the
40 global standard paths object using @c wxStandardPaths::Get on which you call the
0b1b2c71
SC
41 desired methods.
42
23324ae1
FM
43 @library{wxbase}
44 @category{file}
7c913512 45
e54c96f1 46 @see wxFileConfig
4701dc09 47*/
7c913512 48class wxStandardPaths
23324ae1
FM
49{
50public:
4cd15b49
VZ
51 /**
52 MSW-specific function undoing the effect of IgnoreAppSubDir() calls.
53
54 After a call to this function the program directory will be exactly the
55 directory containing the main application binary, i.e. it undoes the
56 effect of any previous IgnoreAppSubDir() calls including the ones done
57 indirectly by IgnoreAppBuildSubDirs() called from the class
58 constructor.
59
60 @since 2.9.1
61 */
62 void DontIgnoreAppSubDir();
63
23324ae1
FM
64 /**
65 Returns reference to the unique global standard paths object.
66 */
25f49256 67 static wxStandardPaths& Get();
23324ae1 68
d8efd219
VZ
69 /**
70 Return the directory for the document files used by this application.
71
72 If the application-specific directory doesn't exist, this function
73 returns GetDocumentsDir().
74
75 Example return values:
76 - Unix: @c ~/appname
77 - Windows: @c "C:\Documents and Settings\username\My Documents\appname"
78 - Mac: @c ~/Documents/appname
79
80 @since 2.9.0
81
82 @see GetAppDocumentsDir()
83 */
84 virtual wxString GetAppDocumentsDir() const;
85
23324ae1
FM
86 /**
87 Return the directory containing the system config files.
23324ae1 88 Example return values:
4701dc09
FM
89 - Unix: @c /etc
90 - Windows: @c "C:\Documents and Settings\All Users\Application Data"
91 - Mac: @c /Library/Preferences
3c4f71cc 92
4cc4bfaf 93 @see wxFileConfig
23324ae1 94 */
adaaa686 95 virtual wxString GetConfigDir() const;
23324ae1
FM
96
97 /**
98 Return the location of the applications global, i.e. not user-specific,
99 data files.
23324ae1 100 Example return values:
4701dc09
FM
101 - Unix: @c prefix/share/appname
102 - Windows: the directory where the executable file is located
103 - Mac: @c appname.app/Contents/SharedSupport bundle subdirectory
3c4f71cc 104
4cc4bfaf 105 @see GetLocalDataDir()
23324ae1 106 */
adaaa686 107 virtual wxString GetDataDir() const;
23324ae1
FM
108
109 /**
110 Return the directory containing the current user's documents.
d8efd219 111
23324ae1 112 Example return values:
4701dc09
FM
113 - Unix: @c ~ (the home directory)
114 - Windows: @c "C:\Documents and Settings\username\My Documents"
115 - Mac: @c ~/Documents
3c4f71cc 116
1e24c2af 117 @since 2.7.0
d8efd219
VZ
118
119 @see GetAppDocumentsDir()
23324ae1 120 */
adaaa686 121 virtual wxString GetDocumentsDir() const;
23324ae1
FM
122
123 /**
124 Return the directory and the filename for the current executable.
23324ae1 125 Example return values:
4701dc09
FM
126 - Unix: @c /usr/local/bin/exename
127 - Windows: @c "C:\Programs\AppFolder\exename.exe"
128 - Mac: @c /Programs/exename
23324ae1 129 */
adaaa686 130 virtual wxString GetExecutablePath() const;
23324ae1
FM
131
132 /**
4701dc09
FM
133 Return the program installation prefix, e.g. @c /usr, @c /opt or @c /home/zeitlin.
134
89666a22 135 If the prefix had been previously by SetInstallPrefix(), returns that
4701dc09
FM
136 value, otherwise tries to determine it automatically (Linux only right now)
137 and finally returns the default @c /usr/local value if it failed.
138
139 @note This function is only available under Unix.
23324ae1 140 */
328f5751 141 wxString GetInstallPrefix() const;
23324ae1
FM
142
143 /**
144 Return the location for application data files which are host-specific and
145 can't, or shouldn't, be shared with the other machines.
4701dc09
FM
146
147 This is the same as GetDataDir() except under Unix where it returns @c /etc/appname.
23324ae1 148 */
adaaa686 149 virtual wxString GetLocalDataDir() const;
23324ae1
FM
150
151 /**
152 Return the localized resources directory containing the resource files of the
153 specified category for the given language.
4701dc09
FM
154
155 In general this is just the same as @a lang subdirectory of GetResourcesDir()
156 (or @c lang.lproj under Mac OS X) but is something quite different for
157 message catalog category under Unix where it returns the standard
e3d8295c 158 @c prefix/share/locale/lang/LC_MESSAGES directory.
3c4f71cc 159
1e24c2af 160 @since 2.7.0
23324ae1 161 */
43c48e1e
FM
162 virtual wxString GetLocalizedResourcesDir(const wxString& lang,
163 ResourceCat category) const;
23324ae1
FM
164
165 /**
166 Return the directory where the loadable modules (plugins) live.
23324ae1 167 Example return values:
4701dc09
FM
168 - Unix: @c prefix/lib/appname
169 - Windows: the directory of the executable file
170 - Mac: @c appname.app/Contents/PlugIns bundle subdirectory
3c4f71cc 171
4cc4bfaf 172 @see wxDynamicLibrary
23324ae1 173 */
adaaa686 174 virtual wxString GetPluginsDir() const;
23324ae1
FM
175
176 /**
4701dc09
FM
177 Return the directory where the application resource files are located.
178
179 The resources are the auxiliary data files needed for the application to run
180 and include, for example, image and sound files it might use.
181
182 This function is the same as GetDataDir() for all platforms except Mac OS X.
23324ae1 183 Example return values:
4701dc09
FM
184 - Unix: @c prefix/share/appname
185 - Windows: the directory where the executable file is located
186 - Mac: @c appname.app/Contents/Resources bundle subdirectory
3c4f71cc 187
1e24c2af 188 @since 2.7.0
3c4f71cc 189
4cc4bfaf 190 @see GetLocalizedResourcesDir()
23324ae1 191 */
adaaa686 192 virtual wxString GetResourcesDir() const;
23324ae1
FM
193
194 /**
4701dc09
FM
195 Return the directory for storing temporary files.
196 To create unique temporary files, it is best to use wxFileName::CreateTempFileName
197 for correct behaviour when multiple processes are attempting to create temporary files.
3c4f71cc 198
1e24c2af 199 @since 2.7.2
23324ae1 200 */
adaaa686 201 virtual wxString GetTempDir() const;
23324ae1
FM
202
203 /**
204 Return the directory for the user config files:
4701dc09
FM
205 - Unix: @c ~ (the home directory)
206 - Windows: @c "C:\Documents and Settings\username\Application Data"
207 - Mac: @c ~/Library/Preferences
208
23324ae1 209 Only use this method if you have a single configuration file to put in this
4701dc09 210 directory, otherwise GetUserDataDir() is more appropriate.
23324ae1 211 */
adaaa686 212 virtual wxString GetUserConfigDir() const;
23324ae1
FM
213
214 /**
215 Return the directory for the user-dependent application data files:
4701dc09
FM
216 - Unix: @c ~/.appname
217 - Windows: @c "C:\Documents and Settings\username\Application Data\appname"
218 - Mac: @c "~/Library/Application Support/appname"
23324ae1 219 */
adaaa686 220 virtual wxString GetUserDataDir() const;
23324ae1
FM
221
222 /**
223 Return the directory for user data files which shouldn't be shared with
224 the other machines.
4701dc09 225
ad51d1c8 226 This is the same as GetUserDataDir() for all platforms except Windows where it returns
4701dc09 227 @c "C:\Documents and Settings\username\Local Settings\Application Data\appname"
23324ae1 228 */
adaaa686 229 virtual wxString GetUserLocalDataDir() const;
23324ae1 230
4cd15b49
VZ
231 /**
232 MSW-specific function to customize application directory detection.
233
234 This class supposes that data, plugins &c files are located under the
235 program directory which is the directory containing the application
236 binary itself. But sometimes this binary may be in a subdirectory of
237 the main program directory, e.g. this happens in at least the following
238 common cases:
239 - The program is in "bin" subdirectory of the installation directory.
240 - The program is in "debug" subdirectory of the directory containing
241 sources and data files during development
242
243 By calling this function you instruct the class to remove the last
244 component of the path if it matches its argument. Notice that it may be
245 called more than once, e.g. you can call both IgnoreAppSubDir("bin") and
246 IgnoreAppSubDir("debug") to take care of both production and development
247 cases above but that each call will only remove the last path component.
248 Finally note that the argument can contain wild cards so you can also
249 call IgnoreAppSubDir("vc*msw*") to ignore all build directories at once
250 when using wxWidgets-inspired output directories names.
251
252 @since 2.9.1
253
254 @see IgnoreAppBuildSubDirs()
255
256 @param subdirPattern
257 The subdirectory containing the application binary which should be
258 ignored when determining the top application directory. The pattern
259 is case-insensitive and may contain wild card characters @c '?' and
260 @c '*'.
261 */
262 void IgnoreAppSubDir(const wxString& subdirPattern);
263
264 /**
265 MSW-specific function to ignore all common build directories.
266
267 This function calls IgnoreAppSubDir() with all common values for build
268 directory, e.g. @c "debug" and @c "release".
269
270 It is called by the class constructor and so the build directories are
271 always ignored by default. You may use DontIgnoreAppSubDir() to avoid
272 ignoring them if this is inappropriate for your application.
273
274 @since 2.9.1
275 */
276 void IgnoreAppBuildSubDirs();
277
23324ae1 278 /**
23324ae1 279 Lets wxStandardPaths know about the real program installation prefix on a Unix
4701dc09
FM
280 system. By default, the value returned by GetInstallPrefix() is used.
281
23324ae1
FM
282 Although under Linux systems the program prefix may usually be determined
283 automatically, portable programs should call this function. Usually the prefix
284 is set during program configuration if using GNU autotools and so it is enough
285 to pass its value defined in @c config.h to this function.
4701dc09
FM
286
287 @note This function is only available under Unix.
23324ae1
FM
288 */
289 void SetInstallPrefix(const wxString& prefix);
290
291 /**
292 Controls what application information is used when constructing paths that
293 should be unique to this program, such as the application data directory, the
294 plugins directory on Unix, etc.
4701dc09
FM
295
296 Valid values for @a info are @c AppInfo_None and either one or combination
297 of @c AppInfo_AppName and @c AppInfo_VendorName. The first one tells this
298 class to not use neither application nor vendor name in the paths.
299
23324ae1
FM
300 By default, only the application name is used under Unix systems but both
301 application and vendor names are used under Windows and Mac.
302 */
303 void UseAppInfo(int info);
304};
e54c96f1 305