]> git.saurik.com Git - wxWidgets.git/blame - src/palmos/utils.cpp
use a different indicator when binding parameters and columns (patch 1718474)
[wxWidgets.git] / src / palmos / utils.cpp
CommitLineData
ffecfa5a 1/////////////////////////////////////////////////////////////////////////////
6929fe3a 2// Name: src/palmos/utils.cpp
ffecfa5a 3// Purpose: Various utilities
6929fe3a
WS
4// Author: William Osborne - minimal working wxPalmOS port
5// Modified by: Wlodzimierz ABX Skiba - real functionality
ffecfa5a 6// Created: 10/13/04
6929fe3a
WS
7// RCS-ID: $Id$
8// Copyright: (c) William Osborne, Wlodzimierz Skiba
ffecfa5a
JS
9// Licence: wxWindows licence
10/////////////////////////////////////////////////////////////////////////////
11
12// ============================================================================
13// declarations
14// ============================================================================
15
16// ----------------------------------------------------------------------------
17// headers
18// ----------------------------------------------------------------------------
19
20// For compilers that support precompilation, includes "wx.h".
21#include "wx/wxprec.h"
22
23#ifdef __BORLANDC__
24 #pragma hdrstop
25#endif
26
27#ifndef WX_PRECOMP
28 #include "wx/utils.h"
29 #include "wx/app.h"
30 #include "wx/intl.h"
31 #include "wx/log.h"
c0badb70 32 #include "wx/timer.h"
ffecfa5a
JS
33#endif //WX_PRECOMP
34
35#include "wx/apptrait.h"
36#include "wx/dynload.h"
d1df2399 37#include "wx/confbase.h"
355debca 38#include "wx/power.h"
ffecfa5a 39
d1df2399
WS
40#include <MemoryMgr.h>
41#include <DLServer.h>
42#include <SoundMgr.h>
20bc5ad8 43#include <SysUtils.h>
ffecfa5a
JS
44
45// ============================================================================
46// implementation
47// ============================================================================
48
49// ----------------------------------------------------------------------------
50// get host name and related
51// ----------------------------------------------------------------------------
52
53// Get hostname only (without domain name)
54bool wxGetHostName(wxChar *buf, int maxSize)
55{
56 return false;
57}
58
59// get full hostname (with domain name if possible)
60bool wxGetFullHostName(wxChar *buf, int maxSize)
61{
62 return false;
63}
64
65// Get user ID e.g. jacs
66bool wxGetUserId(wxChar *buf, int maxSize)
67{
d1df2399 68 return wxGetUserName(buf, maxSize);
ffecfa5a
JS
69}
70
71// Get user name e.g. Julian Smart
72bool wxGetUserName(wxChar *buf, int maxSize)
73{
d1df2399
WS
74 *buf = wxT('\0');
75
76 // buffer allocation
77 MemHandle handle = MemHandleNew(maxSize-1);
78 if( handle == NULL )
79 return false;
80
81 // lock the buffer
82 char *id = (char *)MemHandleLock(handle);
83 if( id == NULL )
84 return false;
85
86 // get user's name
87 if( DlkGetSyncInfo(NULL, NULL, NULL, id, NULL, NULL) != errNone )
88 {
89 MemPtrUnlock(id);
90 return false;
91 }
92
69c928ef 93 wxStrncpy (buf, wxSafeConvertMB2WX(id), maxSize - 1);
d1df2399 94
9d8aca48 95 // free the buffer
d1df2399
WS
96 MemPtrUnlock(id);
97
98 return true;
ffecfa5a
JS
99}
100
101const wxChar* wxGetHomeDir(wxString *pstr)
102{
103 return NULL;
104}
105
106wxChar *wxGetUserHome(const wxString& WXUNUSED(user))
107{
108 return NULL;
109}
110
7ba7c4e6 111bool wxGetDiskSpace(const wxString& path, wxDiskspaceSize_t *pTotal, wxDiskspaceSize_t *pFree)
ffecfa5a
JS
112{
113 return false;
114}
115
116// ----------------------------------------------------------------------------
117// env vars
118// ----------------------------------------------------------------------------
119
120bool wxGetEnv(const wxString& var, wxString *value)
121{
122 return false;
123}
124
125bool wxSetEnv(const wxString& var, const wxChar *value)
126{
127 return false;
128}
129
130// ----------------------------------------------------------------------------
131// process management
132// ----------------------------------------------------------------------------
133
e0f6b731 134int wxKill(long pid, wxSignal sig, wxKillError *krc, int flags)
ffecfa5a
JS
135{
136 return 0;
137}
138
139// Execute a program in an Interactive Shell
140bool wxShell(const wxString& command)
141{
142 return false;
143}
144
145// Shutdown or reboot the PC
146bool wxShutdown(wxShutdownFlags wFlags)
147{
148 return false;
149}
150
355debca
VZ
151// ----------------------------------------------------------------------------
152// power management
153// ----------------------------------------------------------------------------
154
8ea92b4d
WS
155wxPowerType wxGetPowerType()
156{
157 return wxPOWER_BATTERY;
158}
159
160wxBatteryState wxGetBatteryState()
161{
162 // TODO
163 return wxBATTERY_UNKNOWN_STATE;
164}
165
ffecfa5a
JS
166// ----------------------------------------------------------------------------
167// misc
168// ----------------------------------------------------------------------------
169
170// Get free memory in bytes, or -1 if cannot determine amount (e.g. on UNIX)
9d8aca48 171wxMemorySize wxGetFreeMemory()
ffecfa5a 172{
d1df2399
WS
173 uint32_t freeTotal = 0;
174 uint32_t freeHeap;
175 uint32_t freeChunk;
176
177 // executed twice: for the dynamic heap, and for the non-secure RAM storage heap
178 for ( uint16_t i=0; i<MemNumRAMHeaps(); i++)
179 {
180 status_t err = MemHeapFreeBytes(i, &freeHeap, &freeChunk);
181 if( err != errNone )
182 return -1;
183 freeTotal+=freeHeap;
184 }
185
9d8aca48 186 return (wxMemorySize)freeTotal;
ffecfa5a
JS
187}
188
189unsigned long wxGetProcessId()
190{
191 return 0;
192}
193
194// Emit a beeeeeep
195void wxBell()
196{
d1df2399 197 SndPlaySystemSound(sndWarning);
ffecfa5a
JS
198}
199
cdbce971
WS
200bool wxIsPlatform64Bit()
201{
202 return false;
203}
204
ffecfa5a
JS
205wxString wxGetOsDescription()
206{
cc2c11e2 207 wxString strOS = _T("PalmOS");
ffecfa5a 208
cc2c11e2
WS
209 char *version = SysGetOSVersionString();
210 if(version)
211 {
212 wxString str = wxString::FromAscii(version);
6929fe3a 213 MemPtrFree(version);
cc2c11e2
WS
214 if(!str.empty())
215 {
216 strOS << _(" ") << str;
217 }
218 }
219
220 return strOS;
ffecfa5a
JS
221}
222
8bb6b2c0 223wxOperatingSystemId wxGetOsVersion(int *verMaj, int *verMin)
ffecfa5a 224{
8bb6b2c0
VZ
225 // TODO
226
227 return wxOS_UNKNOWN;
ffecfa5a
JS
228}
229
230// ----------------------------------------------------------------------------
231// sleep functions
232// ----------------------------------------------------------------------------
233
234void wxMilliSleep(unsigned long milliseconds)
235{
236}
237
238void wxMicroSleep(unsigned long microseconds)
239{
240}
241
242void wxSleep(int nSecs)
243{
244}
245
246// ----------------------------------------------------------------------------
247// font encoding <-> Win32 codepage conversion functions
248// ----------------------------------------------------------------------------
249
250extern WXDLLIMPEXP_BASE long wxEncodingToCharset(wxFontEncoding encoding)
251{
252 return 0;
253}
254
255// we have 2 versions of wxCharsetToCodepage(): the old one which directly
256// looks up the vlaues in the registry and the new one which is more
257// politically correct and has more chances to work on other Windows versions
258// as well but the old version is still needed for !wxUSE_FONTMAP case
259#if wxUSE_FONTMAP
260
261#include "wx/fontmap.h"
262
263extern WXDLLIMPEXP_BASE long wxEncodingToCodepage(wxFontEncoding encoding)
264{
265 return 0;
266}
267
268extern long wxCharsetToCodepage(const wxChar *name)
269{
270 return 0;
271}
272
273#else // !wxUSE_FONTMAP
274
ffecfa5a
JS
275// this should work if Internet Exploiter is installed
276extern long wxCharsetToCodepage(const wxChar *name)
277{
278 return 0;
279}
280
281#endif // wxUSE_FONTMAP/!wxUSE_FONTMAP