]>
git.saurik.com Git - wxWidgets.git/blob - src/palmos/utils.cpp
   1 ///////////////////////////////////////////////////////////////////////////// 
   2 // Name:        palmos/utils.cpp 
   3 // Purpose:     Various utilities 
   4 // Author:      William Osborne 
   8 // Copyright:   (c) William Osborne 
   9 // Licence:     wxWindows licence 
  10 ///////////////////////////////////////////////////////////////////////////// 
  12 // ============================================================================ 
  14 // ============================================================================ 
  16 // ---------------------------------------------------------------------------- 
  18 // ---------------------------------------------------------------------------- 
  20 // For compilers that support precompilation, includes "wx.h". 
  21 #include "wx/wxprec.h" 
  34 #include "wx/apptrait.h" 
  35 #include "wx/dynload.h" 
  37 #include "wx/confbase.h"        // for wxExpandEnvVars() 
  41 // VZ: there is some code using NetXXX() functions to get the full user name: 
  42 //     I don't think it's a good idea because they don't work under Win95 and 
  43 //     seem to return the same as wxGetUserId() under NT. If you really want 
  44 //     to use them, just #define USE_NET_API 
  51 // ---------------------------------------------------------------------------- 
  53 // ---------------------------------------------------------------------------- 
  55 // In the WIN.INI file 
  56 static const wxChar WX_SECTION
[] = wxT("wxWindows"); 
  57 static const wxChar eUSERNAME
[]  = wxT("UserName"); 
  59 // ============================================================================ 
  61 // ============================================================================ 
  63 // ---------------------------------------------------------------------------- 
  64 // get host name and related 
  65 // ---------------------------------------------------------------------------- 
  67 // Get hostname only (without domain name) 
  68 bool wxGetHostName(wxChar 
*buf
, int maxSize
) 
  73 // get full hostname (with domain name if possible) 
  74 bool wxGetFullHostName(wxChar 
*buf
, int maxSize
) 
  79 // Get user ID e.g. jacs 
  80 bool wxGetUserId(wxChar 
*buf
, int maxSize
) 
  85 // Get user name e.g. Julian Smart 
  86 bool wxGetUserName(wxChar 
*buf
, int maxSize
) 
  91 const wxChar
* wxGetHomeDir(wxString 
*pstr
) 
  96 wxChar 
*wxGetUserHome(const wxString
& WXUNUSED(user
)) 
 101 bool wxDirExists(const wxString
& dir
) 
 106 bool wxGetDiskSpace(const wxString
& path
, wxLongLong 
*pTotal
, wxLongLong 
*pFree
) 
 111 // ---------------------------------------------------------------------------- 
 113 // ---------------------------------------------------------------------------- 
 115 bool wxGetEnv(const wxString
& var
, wxString 
*value
) 
 120 bool wxSetEnv(const wxString
& var
, const wxChar 
*value
) 
 125 // ---------------------------------------------------------------------------- 
 126 // process management 
 127 // ---------------------------------------------------------------------------- 
 129 // structure used to pass parameters from wxKill() to wxEnumFindByPidProc() 
 130 int wxKill(long pid
, wxSignal sig
, wxKillError 
*krc
) 
 135 // Execute a program in an Interactive Shell 
 136 bool wxShell(const wxString
& command
) 
 141 // Shutdown or reboot the PC 
 142 bool wxShutdown(wxShutdownFlags wFlags
) 
 147 // ---------------------------------------------------------------------------- 
 149 // ---------------------------------------------------------------------------- 
 151 // Get free memory in bytes, or -1 if cannot determine amount (e.g. on UNIX) 
 152 long wxGetFreeMemory() 
 157 unsigned long wxGetProcessId() 
 167 wxString 
wxGetOsDescription() 
 174 wxToolkitInfo
& wxAppTraits::GetToolkitInfo() 
 176     static wxToolkitInfo info
; 
 177     info
.name 
= _T("wxBase"); 
 181 // ---------------------------------------------------------------------------- 
 183 // ---------------------------------------------------------------------------- 
 185 void wxMilliSleep(unsigned long milliseconds
) 
 189 void wxMicroSleep(unsigned long microseconds
) 
 193 void wxSleep(int nSecs
) 
 197 // ---------------------------------------------------------------------------- 
 198 // font encoding <-> Win32 codepage conversion functions 
 199 // ---------------------------------------------------------------------------- 
 201 extern WXDLLIMPEXP_BASE 
long wxEncodingToCharset(wxFontEncoding encoding
) 
 206 // we have 2 versions of wxCharsetToCodepage(): the old one which directly 
 207 // looks up the vlaues in the registry and the new one which is more 
 208 // politically correct and has more chances to work on other Windows versions 
 209 // as well but the old version is still needed for !wxUSE_FONTMAP case 
 212 #include "wx/fontmap.h" 
 214 extern WXDLLIMPEXP_BASE 
long wxEncodingToCodepage(wxFontEncoding encoding
) 
 219 extern long wxCharsetToCodepage(const wxChar 
*name
) 
 224 #else // !wxUSE_FONTMAP 
 226 #include "wx/palmos/registry.h" 
 228 // this should work if Internet Exploiter is installed 
 229 extern long wxCharsetToCodepage(const wxChar 
*name
) 
 234 #endif // wxUSE_FONTMAP/!wxUSE_FONTMAP