X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/d1df23991564a5a288463eaef440ebc0ab1c1db3..3cb6eaec797ebbe20a0e05e5c9ba625909845e72:/src/palmos/utils.cpp diff --git a/src/palmos/utils.cpp b/src/palmos/utils.cpp index 71db037551..c8d8d84908 100644 --- a/src/palmos/utils.cpp +++ b/src/palmos/utils.cpp @@ -1,11 +1,11 @@ ///////////////////////////////////////////////////////////////////////////// -// Name: palmos/utils.cpp +// Name: src/palmos/utils.cpp // Purpose: Various utilities -// Author: William Osborne -// Modified by: +// Author: William Osborne - minimal working wxPalmOS port +// Modified by: Wlodzimierz ABX Skiba - real functionality // Created: 10/13/04 -// RCS-ID: $Id: -// Copyright: (c) William Osborne +// RCS-ID: $Id$ +// Copyright: (c) William Osborne, Wlodzimierz Skiba // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// @@ -29,16 +29,18 @@ #include "wx/app.h" #include "wx/intl.h" #include "wx/log.h" + #include "wx/timer.h" #endif //WX_PRECOMP #include "wx/apptrait.h" #include "wx/dynload.h" #include "wx/confbase.h" -#include "wx/timer.h" +#include "wx/power.h" #include #include #include +#include // ============================================================================ // implementation @@ -88,9 +90,9 @@ bool wxGetUserName(wxChar *buf, int maxSize) return false; } - wxStrncpy (buf, wxConvertMB2WX(id), maxSize - 1); + wxStrncpy (buf, wxSafeConvertMB2WX(id), maxSize - 1); - // free the buffer + // free the buffer MemPtrUnlock(id); return true; @@ -106,12 +108,7 @@ wxChar *wxGetUserHome(const wxString& WXUNUSED(user)) return NULL; } -bool wxDirExists(const wxString& dir) -{ - return false; -} - -bool wxGetDiskSpace(const wxString& path, wxLongLong *pTotal, wxLongLong *pFree) +bool wxGetDiskSpace(const wxString& path, wxDiskspaceSize_t *pTotal, wxDiskspaceSize_t *pFree) { return false; } @@ -130,6 +127,11 @@ bool wxSetEnv(const wxString& var, const wxChar *value) return false; } +bool wxUnsetEnv(const wxString& var) +{ + return false; +} + // ---------------------------------------------------------------------------- // process management // ---------------------------------------------------------------------------- @@ -151,12 +153,27 @@ bool wxShutdown(wxShutdownFlags wFlags) return false; } +// ---------------------------------------------------------------------------- +// power management +// ---------------------------------------------------------------------------- + +wxPowerType wxGetPowerType() +{ + return wxPOWER_BATTERY; +} + +wxBatteryState wxGetBatteryState() +{ + // TODO + return wxBATTERY_UNKNOWN_STATE; +} + // ---------------------------------------------------------------------------- // misc // ---------------------------------------------------------------------------- // Get free memory in bytes, or -1 if cannot determine amount (e.g. on UNIX) -long wxGetFreeMemory() +wxMemorySize wxGetFreeMemory() { uint32_t freeTotal = 0; uint32_t freeHeap; @@ -171,7 +188,7 @@ long wxGetFreeMemory() freeTotal+=freeHeap; } - return freeTotal; + return (wxMemorySize)freeTotal; } unsigned long wxGetProcessId() @@ -185,18 +202,34 @@ void wxBell() SndPlaySystemSound(sndWarning); } +bool wxIsPlatform64Bit() +{ + return false; +} + wxString wxGetOsDescription() { - wxString str; + wxString strOS = _T("PalmOS"); - return str; + char *version = SysGetOSVersionString(); + if(version) + { + wxString str = wxString::FromAscii(version); + MemPtrFree(version); + if(!str.empty()) + { + strOS << _(" ") << str; + } + } + + return strOS; } -wxToolkitInfo& wxAppTraits::GetToolkitInfo() +wxOperatingSystemId wxGetOsVersion(int *verMaj, int *verMin) { - static wxToolkitInfo info; - info.name = _T("wxBase"); - return info; + // TODO + + return wxOS_UNKNOWN; } // ---------------------------------------------------------------------------- @@ -244,8 +277,6 @@ extern long wxCharsetToCodepage(const wxChar *name) #else // !wxUSE_FONTMAP -#include "wx/palmos/registry.h" - // this should work if Internet Exploiter is installed extern long wxCharsetToCodepage(const wxChar *name) { @@ -253,4 +284,3 @@ extern long wxCharsetToCodepage(const wxChar *name) } #endif // wxUSE_FONTMAP/!wxUSE_FONTMAP -