]>
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 int wxKill(long pid
, wxSignal sig
, wxKillError
*krc
, int flags
)
134 // Execute a program in an Interactive Shell
135 bool wxShell(const wxString
& command
)
140 // Shutdown or reboot the PC
141 bool wxShutdown(wxShutdownFlags wFlags
)
146 // ----------------------------------------------------------------------------
148 // ----------------------------------------------------------------------------
150 // Get free memory in bytes, or -1 if cannot determine amount (e.g. on UNIX)
151 long wxGetFreeMemory()
156 unsigned long wxGetProcessId()
166 wxString
wxGetOsDescription()
173 wxToolkitInfo
& wxAppTraits::GetToolkitInfo()
175 static wxToolkitInfo info
;
176 info
.name
= _T("wxBase");
180 // ----------------------------------------------------------------------------
182 // ----------------------------------------------------------------------------
184 void wxMilliSleep(unsigned long milliseconds
)
188 void wxMicroSleep(unsigned long microseconds
)
192 void wxSleep(int nSecs
)
196 // ----------------------------------------------------------------------------
197 // font encoding <-> Win32 codepage conversion functions
198 // ----------------------------------------------------------------------------
200 extern WXDLLIMPEXP_BASE
long wxEncodingToCharset(wxFontEncoding encoding
)
205 // we have 2 versions of wxCharsetToCodepage(): the old one which directly
206 // looks up the vlaues in the registry and the new one which is more
207 // politically correct and has more chances to work on other Windows versions
208 // as well but the old version is still needed for !wxUSE_FONTMAP case
211 #include "wx/fontmap.h"
213 extern WXDLLIMPEXP_BASE
long wxEncodingToCodepage(wxFontEncoding encoding
)
218 extern long wxCharsetToCodepage(const wxChar
*name
)
223 #else // !wxUSE_FONTMAP
225 #include "wx/palmos/registry.h"
227 // this should work if Internet Exploiter is installed
228 extern long wxCharsetToCodepage(const wxChar
*name
)
233 #endif // wxUSE_FONTMAP/!wxUSE_FONTMAP