stdpaths.h 3.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495
  1. ///////////////////////////////////////////////////////////////////////////////
  2. // Name: wx/msw/stdpaths.h
  3. // Purpose: wxStandardPaths for Win32
  4. // Author: Vadim Zeitlin
  5. // Modified by:
  6. // Created: 2004-10-19
  7. // Copyright: (c) 2004 Vadim Zeitlin <vadim@wxwindows.org>
  8. // Licence: wxWindows licence
  9. ///////////////////////////////////////////////////////////////////////////////
  10. #ifndef _WX_MSW_STDPATHS_H_
  11. #define _WX_MSW_STDPATHS_H_
  12. // ----------------------------------------------------------------------------
  13. // wxStandardPaths
  14. // ----------------------------------------------------------------------------
  15. class WXDLLIMPEXP_BASE wxStandardPaths : public wxStandardPathsBase
  16. {
  17. public:
  18. // implement base class pure virtuals
  19. virtual wxString GetExecutablePath() const;
  20. virtual wxString GetConfigDir() const;
  21. virtual wxString GetUserConfigDir() const;
  22. virtual wxString GetDataDir() const;
  23. virtual wxString GetUserDataDir() const;
  24. virtual wxString GetUserLocalDataDir() const;
  25. virtual wxString GetPluginsDir() const;
  26. virtual wxString GetDocumentsDir() const;
  27. // MSW-specific methods
  28. // This class supposes that data, plugins &c files are located under the
  29. // program directory which is the directory containing the application
  30. // binary itself. But sometimes this binary may be in a subdirectory of the
  31. // main program directory, e.g. this happens in at least the following
  32. // common cases:
  33. // 1. The program is in "bin" subdirectory of the installation directory.
  34. // 2. The program is in "debug" subdirectory of the directory containing
  35. // sources and data files during development
  36. //
  37. // By calling this function you instruct the class to remove the last
  38. // component of the path if it matches its argument. Notice that it may be
  39. // called more than once, e.g. you can call both IgnoreAppSubDir("bin") and
  40. // IgnoreAppSubDir("debug") to take care of both production and development
  41. // cases above but that each call will only remove the last path component.
  42. // Finally note that the argument can contain wild cards so you can also
  43. // call IgnoreAppSubDir("vc*msw*") to ignore all build directories at once
  44. // when using wxWidgets-inspired output directories names.
  45. void IgnoreAppSubDir(const wxString& subdirPattern);
  46. // This function is used to ignore all common build directories and is
  47. // called from the ctor -- use DontIgnoreAppSubDir() to undo this.
  48. void IgnoreAppBuildSubDirs();
  49. // Undo the effects of all preceding IgnoreAppSubDir() calls.
  50. void DontIgnoreAppSubDir();
  51. // Returns the directory corresponding to the specified Windows shell CSIDL
  52. static wxString MSWGetShellDir(int csidl);
  53. protected:
  54. // Ctor is protected, use wxStandardPaths::Get() instead of instantiating
  55. // objects of this class directly.
  56. //
  57. // It calls IgnoreAppBuildSubDirs() and also sets up the object to use
  58. // both vendor and application name by default.
  59. wxStandardPaths();
  60. // get the path corresponding to the given standard CSIDL_XXX constant
  61. static wxString DoGetDirectory(int csidl);
  62. // return the directory of the application itself
  63. wxString GetAppDir() const;
  64. // directory returned by GetAppDir()
  65. mutable wxString m_appDir;
  66. };
  67. // ----------------------------------------------------------------------------
  68. // wxStandardPathsWin16: this class is for internal use only
  69. // ----------------------------------------------------------------------------
  70. // override config file locations to be compatible with the values used by
  71. // wxFileConfig (dating from Win16 days which explains the class name)
  72. class WXDLLIMPEXP_BASE wxStandardPathsWin16 : public wxStandardPaths
  73. {
  74. public:
  75. virtual wxString GetConfigDir() const;
  76. virtual wxString GetUserConfigDir() const;
  77. };
  78. #endif // _WX_MSW_STDPATHS_H_