]> git.saurik.com Git - wxWidgets.git/blame - include/wx/utils.h
don't pass NULL pointer to printf(), this crashes Solaris printf
[wxWidgets.git] / include / wx / utils.h
CommitLineData
c801d85f
KB
1/////////////////////////////////////////////////////////////////////////////
2// Name: utils.h
3// Purpose: Miscellaneous utilities
4// Author: Julian Smart
5// Modified by:
6// Created: 29/01/98
7// RCS-ID: $Id$
8// Copyright: (c) 1998 Julian Smart
65571936 9// Licence: wxWindows licence
c801d85f
KB
10/////////////////////////////////////////////////////////////////////////////
11
34138703
JS
12#ifndef _WX_UTILSH__
13#define _WX_UTILSH__
c801d85f 14
d6b9496a
VZ
15// ----------------------------------------------------------------------------
16// headers
17// ----------------------------------------------------------------------------
18
e4844687
SN
19#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA) && !defined(__EMX__)
20// Some older compilers (such as EMX) cannot handle
cb719f2e 21// #pragma interface/implementation correctly, iff
e4844687
SN
22// #pragma implementation is used in _two_ translation
23// units (as created by e.g. event.cpp compiled for
24// libwx_base and event.cpp compiled for libwx_gui_core).
25// So we must not use those pragmas for those compilers in
26// such files.
d6b9496a 27 #pragma interface "utils.h"
c801d85f
KB
28#endif
29
c801d85f
KB
30#include "wx/object.h"
31#include "wx/list.h"
c801d85f 32#include "wx/filefn.h"
2da2f941
MB
33
34class WXDLLIMPEXP_BASE wxArrayString;
c801d85f 35
eadd7bd2
VZ
36// need this for wxGetDiskSpace() as we can't, unfortunately, forward declare
37// wxLongLong
38#include "wx/longlong.h"
39
c801d85f 40#ifdef __X__
d6b9496a
VZ
41 #include <dirent.h>
42 #include <unistd.h>
c801d85f
KB
43#endif
44
45#include <stdio.h>
46
d6b9496a
VZ
47// ----------------------------------------------------------------------------
48// Forward declaration
49// ----------------------------------------------------------------------------
50
62a9d04c
VS
51class WXDLLIMPEXP_CORE wxProcess;
52class WXDLLIMPEXP_CORE wxFrame;
53class WXDLLIMPEXP_CORE wxWindow;
54class WXDLLIMPEXP_CORE wxWindowList;
55class WXDLLIMPEXP_CORE wxPoint;
d6b9496a 56
d6b9496a
VZ
57// ----------------------------------------------------------------------------
58// Macros
59// ----------------------------------------------------------------------------
c801d85f 60
d6b9496a
VZ
61#define wxMax(a,b) (((a) > (b)) ? (a) : (b))
62#define wxMin(a,b) (((a) < (b)) ? (a) : (b))
c801d85f 63
9d8aca48
WS
64// wxGetFreeMemory can return huge amount of memory on 64-bit platforms
65// define wxMemorySize according to the type which best fits your platform
66#if wxUSE_LONGLONG && defined(__WIN64__)
67 // 64 bit Windowses have sizeof(long) only 32 bit long
68 // we need to use wxLongLong to express memory sizes
69 #define wxMemorySize wxLongLong
70#else
71 // 64 bit UNIX has sizeof(long) = 64
72 // assume 32 bit platforms cannnot return more than 32bits of
73 #define wxMemorySize long
74#endif
75
d6b9496a
VZ
76// ----------------------------------------------------------------------------
77// String functions (deprecated, use wxString)
78// ----------------------------------------------------------------------------
79
c801d85f 80// Make a copy of this string using 'new'
f526f752 81#if WXWIN_COMPATIBILITY_2_4
eecb33b0 82wxDEPRECATED( WXDLLIMPEXP_BASE wxChar* copystring(const wxChar *s) );
f526f752 83#endif
c801d85f 84
d6b9496a 85// A shorter way of using strcmp
9d2f3c71 86#define wxStringEq(s1, s2) (s1 && s2 && (wxStrcmp(s1, s2) == 0))
d6b9496a
VZ
87
88// ----------------------------------------------------------------------------
89// Miscellaneous functions
90// ----------------------------------------------------------------------------
91
92// Sound the bell
968eb2ef
MW
93#if !defined __EMX__ && \
94 (defined __WXMOTIF__ || defined __WXGTK__ || defined __WXX11__)
95WXDLLIMPEXP_CORE void wxBell();
96#else
bddd7a8d 97WXDLLIMPEXP_BASE void wxBell();
968eb2ef 98#endif
d6b9496a 99
bdc72a22 100// Get OS description as a user-readable string
bddd7a8d 101WXDLLIMPEXP_BASE wxString wxGetOsDescription();
bdc72a22 102
d6b9496a 103// Get OS version
bddd7a8d 104WXDLLIMPEXP_BASE int wxGetOsVersion(int *majorVsn = (int *) NULL,
bdc72a22 105 int *minorVsn = (int *) NULL);
d6b9496a
VZ
106
107// Return a string with the current date/time
bddd7a8d 108WXDLLIMPEXP_BASE wxString wxNow();
d6b9496a 109
77ffb593 110// Return path where wxWidgets is installed (mostly useful in Unices)
bddd7a8d 111WXDLLIMPEXP_BASE const wxChar *wxGetInstallPrefix();
2c18f21d 112// Return path to wxWin data (/usr/share/wx/%{version}) (Unices)
bddd7a8d 113WXDLLIMPEXP_BASE wxString wxGetDataDir();
134677bd
VS
114
115
e90c1d2a 116#if wxUSE_GUI
97698dc4
RD
117
118// Get the state of a key (true if pressed, false if not)
119// This is generally most useful getting the state of
120// the modifier or toggle keys.
1751226c 121WXDLLEXPORT bool wxGetKeyState(wxKeyCode key);
97698dc4 122
14dfb3d2 123
63cc5d9d
RR
124// Don't synthesize KeyUp events holding down a key and producing
125// KeyDown events with autorepeat. On by default and always on
126// in wxMSW.
f0492f7d
RR
127WXDLLEXPORT bool wxSetDetectableAutoRepeat( bool flag );
128
d6b9496a
VZ
129// ----------------------------------------------------------------------------
130// Window ID management
131// ----------------------------------------------------------------------------
132
c801d85f 133// Generate a unique ID
afb74891 134WXDLLEXPORT long wxNewId();
c801d85f
KB
135
136// Ensure subsequent IDs don't clash with this one
184b5d99 137WXDLLEXPORT void wxRegisterId(long id);
c801d85f
KB
138
139// Return the current ID
afb74891 140WXDLLEXPORT long wxGetCurrentId();
c801d85f 141
e90c1d2a
VZ
142#endif // wxUSE_GUI
143
d6b9496a
VZ
144// ----------------------------------------------------------------------------
145// Various conversions
146// ----------------------------------------------------------------------------
c801d85f 147
e12c92c2
VZ
148// these functions are deprecated, use wxString methods instead!
149#if WXWIN_COMPATIBILITY_2_4
150
16cba29d
WS
151extern WXDLLIMPEXP_DATA_BASE(const wxChar*) wxFloatToStringStr;
152extern WXDLLIMPEXP_DATA_BASE(const wxChar*) wxDoubleToStringStr;
c801d85f 153
eecb33b0
WS
154wxDEPRECATED( WXDLLIMPEXP_BASE void StringToFloat(const wxChar *s, float *number) );
155wxDEPRECATED( WXDLLIMPEXP_BASE wxChar* FloatToString(float number, const wxChar *fmt = wxFloatToStringStr) );
156wxDEPRECATED( WXDLLIMPEXP_BASE void StringToDouble(const wxChar *s, double *number) );
157wxDEPRECATED( WXDLLIMPEXP_BASE wxChar* DoubleToString(double number, const wxChar *fmt = wxDoubleToStringStr) );
158wxDEPRECATED( WXDLLIMPEXP_BASE void StringToInt(const wxChar *s, int *number) );
159wxDEPRECATED( WXDLLIMPEXP_BASE void StringToLong(const wxChar *s, long *number) );
160wxDEPRECATED( WXDLLIMPEXP_BASE wxChar* IntToString(int number) );
161wxDEPRECATED( WXDLLIMPEXP_BASE wxChar* LongToString(long number) );
c801d85f 162
e12c92c2
VZ
163#endif // WXWIN_COMPATIBILITY_2_4
164
c801d85f 165// Convert 2-digit hex number to decimal
bddd7a8d 166WXDLLIMPEXP_BASE int wxHexToDec(const wxString& buf);
c801d85f
KB
167
168// Convert decimal integer to 2-character hex string
bddd7a8d
VZ
169WXDLLIMPEXP_BASE void wxDecToHex(int dec, wxChar *buf);
170WXDLLIMPEXP_BASE wxString wxDecToHex(int dec);
c801d85f 171
d6b9496a
VZ
172// ----------------------------------------------------------------------------
173// Process management
174// ----------------------------------------------------------------------------
175
e0f6b731 176// NB: for backwards compatibility reasons the values of wxEXEC_[A]SYNC *must*
fbf456aa
VZ
177// be 0 and 1, don't change!
178
179enum
180{
e1082c9f
VZ
181 // execute the process asynchronously
182 wxEXEC_ASYNC = 0,
183
184 // execute it synchronously, i.e. wait until it finishes
185 wxEXEC_SYNC = 1,
186
187 // under Windows, don't hide the child even if it's IO is redirected (this
188 // is done by default)
189 wxEXEC_NOHIDE = 2,
190
e0f6b731
JS
191 // under Unix, if the process is the group leader then passing wxKILL_CHILDREN to wxKill
192 // kills all children as well as pid
f38f6899
VZ
193 wxEXEC_MAKE_GROUP_LEADER = 4,
194
195 // by default synchronous execution disables all program windows to avoid
196 // that the user interacts with the program while the child process is
197 // running, you can use this flag to prevent this from happening
198 wxEXEC_NODISABLE = 8
fbf456aa
VZ
199};
200
201// Execute another program.
202//
203// If flags contain wxEXEC_SYNC, return -1 on failure and the exit code of the
204// process if everything was ok. Otherwise (i.e. if wxEXEC_ASYNC), return 0 on
205// failure and the PID of the launched process if ok.
bddd7a8d 206WXDLLIMPEXP_BASE long wxExecute(wxChar **argv, int flags = wxEXEC_ASYNC,
c67daf87 207 wxProcess *process = (wxProcess *) NULL);
bddd7a8d 208WXDLLIMPEXP_BASE long wxExecute(const wxString& command, int flags = wxEXEC_ASYNC,
c67daf87 209 wxProcess *process = (wxProcess *) NULL);
c801d85f 210
fbf456aa
VZ
211// execute the command capturing its output into an array line by line, this is
212// always synchronous
bddd7a8d 213WXDLLIMPEXP_BASE long wxExecute(const wxString& command,
4d172154
VZ
214 wxArrayString& output,
215 int flags = 0);
f6bcfd97 216
fbf456aa 217// also capture stderr (also synchronous)
bddd7a8d 218WXDLLIMPEXP_BASE long wxExecute(const wxString& command,
4d172154
VZ
219 wxArrayString& output,
220 wxArrayString& error,
221 int flags = 0);
cd6ce4a9 222
d6b9496a
VZ
223enum wxSignal
224{
225 wxSIGNONE = 0, // verify if the process exists under Unix
226 wxSIGHUP,
227 wxSIGINT,
228 wxSIGQUIT,
229 wxSIGILL,
230 wxSIGTRAP,
231 wxSIGABRT,
232 wxSIGIOT = wxSIGABRT, // another name
233 wxSIGEMT,
234 wxSIGFPE,
235 wxSIGKILL,
236 wxSIGBUS,
237 wxSIGSEGV,
238 wxSIGSYS,
239 wxSIGPIPE,
240 wxSIGALRM,
241 wxSIGTERM
242
243 // further signals are different in meaning between different Unix systems
244};
c801d85f 245
50567b69
VZ
246enum wxKillError
247{
248 wxKILL_OK, // no error
249 wxKILL_BAD_SIGNAL, // no such signal
250 wxKILL_ACCESS_DENIED, // permission denied
251 wxKILL_NO_PROCESS, // no such process
252 wxKILL_ERROR // another, unspecified error
253};
254
e0f6b731
JS
255enum wxKillFlags
256{
257 wxKILL_NOCHILDREN = 0, // don't kill children
258 wxKILL_CHILDREN = 1 // kill children
259};
260
f6ba47d9
VZ
261enum wxShutdownFlags
262{
263 wxSHUTDOWN_POWEROFF, // power off the computer
264 wxSHUTDOWN_REBOOT // shutdown and reboot
265};
266
c1cb4153 267// Shutdown or reboot the PC
bddd7a8d 268WXDLLIMPEXP_BASE bool wxShutdown(wxShutdownFlags wFlags);
f6ba47d9 269
8ea92b4d
WS
270enum wxPowerType
271{
272 wxPOWER_SOCKET,
273 wxPOWER_BATTERY,
274 wxPOWER_UNKNOWN
275};
276
277WXDLLIMPEXP_BASE wxPowerType wxGetPowerType();
278
279enum wxBatteryState
280{
281 wxBATTERY_NORMAL_STATE, // system is fully usable
282 wxBATTERY_LOW_STATE, // start to worry
283 wxBATTERY_CRITICAL_STATE, // save quickly
284 wxBATTERY_SHUTDOWN_STATE, // too late
285 wxBATTERY_UNKNOWN_STATE
286};
287
288WXDLLIMPEXP_BASE wxBatteryState wxGetBatteryState();
289
50567b69
VZ
290// send the given signal to the process (only NONE and KILL are supported under
291// Windows, all others mean TERM), return 0 if ok and -1 on error
292//
293// return detailed error in rc if not NULL
bddd7a8d 294WXDLLIMPEXP_BASE int wxKill(long pid,
50567b69 295 wxSignal sig = wxSIGTERM,
e0f6b731
JS
296 wxKillError *rc = NULL,
297 int flags = wxKILL_NOCHILDREN);
c801d85f 298
2c8e4738 299// Execute a command in an interactive shell window (always synchronously)
c801d85f 300// If no command then just the shell
bddd7a8d 301WXDLLIMPEXP_BASE bool wxShell(const wxString& command = wxEmptyString);
c801d85f 302
2c8e4738
VZ
303// As wxShell(), but must give a (non interactive) command and its output will
304// be returned in output array
bddd7a8d 305WXDLLIMPEXP_BASE bool wxShell(const wxString& command, wxArrayString& output);
2c8e4738 306
b568d04f 307// Sleep for nSecs seconds
bddd7a8d 308WXDLLIMPEXP_BASE void wxSleep(int nSecs);
c801d85f 309
afb74891 310// Sleep for a given amount of milliseconds
08873d36
VZ
311WXDLLIMPEXP_BASE void wxMilliSleep(unsigned long milliseconds);
312
313// Sleep for a given amount of microseconds
314WXDLLIMPEXP_BASE void wxMicroSleep(unsigned long microseconds);
315
316// Sleep for a given amount of milliseconds (old, bad name), use wxMilliSleep
317wxDEPRECATED( WXDLLIMPEXP_BASE void wxUsleep(unsigned long milliseconds) );
afb74891 318
c1cb4153 319// Get the process id of the current process
bddd7a8d 320WXDLLIMPEXP_BASE unsigned long wxGetProcessId();
c1cb4153 321
c801d85f 322// Get free memory in bytes, or -1 if cannot determine amount (e.g. on UNIX)
9d8aca48 323WXDLLIMPEXP_BASE wxMemorySize wxGetFreeMemory();
c801d85f 324
a76d8a29
VZ
325#if wxUSE_ON_FATAL_EXCEPTION
326
a37a5a73 327// should wxApp::OnFatalException() be called?
cb719f2e 328WXDLLIMPEXP_BASE bool wxHandleFatalExceptions(bool doit = true);
a37a5a73 329
a76d8a29
VZ
330#endif // wxUSE_ON_FATAL_EXCEPTION
331
c4472055 332#if wxABI_VERSION >= 20601
498a1eeb
RN
333// Launch url in the user's default internet browser
334WXDLLIMPEXP_BASE bool wxLaunchDefaultBrowser(const wxString& url);
0f8218d7 335#endif
498a1eeb 336
8fd0d89b
VZ
337// ----------------------------------------------------------------------------
338// Environment variables
339// ----------------------------------------------------------------------------
340
cb719f2e 341// returns true if variable exists (value may be NULL if you just want to check
308978f6 342// for this)
bddd7a8d 343WXDLLIMPEXP_BASE bool wxGetEnv(const wxString& var, wxString *value);
8fd0d89b 344
cb719f2e 345// set the env var name to the given value, return true on success
bddd7a8d 346WXDLLIMPEXP_BASE bool wxSetEnv(const wxString& var, const wxChar *value);
8fd0d89b
VZ
347
348// remove the env var from environment
349inline bool wxUnsetEnv(const wxString& var) { return wxSetEnv(var, NULL); }
350
d6b9496a
VZ
351// ----------------------------------------------------------------------------
352// Network and username functions.
353// ----------------------------------------------------------------------------
c801d85f 354
d6b9496a 355// NB: "char *" functions are deprecated, use wxString ones!
c801d85f
KB
356
357// Get eMail address
bddd7a8d
VZ
358WXDLLIMPEXP_BASE bool wxGetEmailAddress(wxChar *buf, int maxSize);
359WXDLLIMPEXP_BASE wxString wxGetEmailAddress();
c801d85f
KB
360
361// Get hostname.
bddd7a8d
VZ
362WXDLLIMPEXP_BASE bool wxGetHostName(wxChar *buf, int maxSize);
363WXDLLIMPEXP_BASE wxString wxGetHostName();
d6b9496a
VZ
364
365// Get FQDN
bddd7a8d
VZ
366WXDLLIMPEXP_BASE wxString wxGetFullHostName();
367WXDLLIMPEXP_BASE bool wxGetFullHostName(wxChar *buf, int maxSize);
c801d85f 368
d6b9496a 369// Get user ID e.g. jacs (this is known as login name under Unix)
bddd7a8d
VZ
370WXDLLIMPEXP_BASE bool wxGetUserId(wxChar *buf, int maxSize);
371WXDLLIMPEXP_BASE wxString wxGetUserId();
c801d85f
KB
372
373// Get user name e.g. Julian Smart
bddd7a8d
VZ
374WXDLLIMPEXP_BASE bool wxGetUserName(wxChar *buf, int maxSize);
375WXDLLIMPEXP_BASE wxString wxGetUserName();
d6b9496a
VZ
376
377// Get current Home dir and copy to dest (returns pstr->c_str())
bddd7a8d
VZ
378WXDLLIMPEXP_BASE wxString wxGetHomeDir();
379WXDLLIMPEXP_BASE const wxChar* wxGetHomeDir(wxString *pstr);
d6b9496a
VZ
380
381// Get the user's home dir (caller must copy --- volatile)
382// returns NULL is no HOME dir is known
61ef57fc 383#if defined(__UNIX__) && wxUSE_UNICODE
bddd7a8d 384WXDLLIMPEXP_BASE const wxMB2WXbuf wxGetUserHome(const wxString& user = wxEmptyString);
61ef57fc 385#else
bddd7a8d 386WXDLLIMPEXP_BASE wxChar* wxGetUserHome(const wxString& user = wxEmptyString);
61ef57fc 387#endif
d6b9496a 388
eadd7bd2 389// get number of total/free bytes on the disk where path belongs
bddd7a8d 390WXDLLIMPEXP_BASE bool wxGetDiskSpace(const wxString& path,
eadd7bd2
VZ
391 wxLongLong *pTotal = NULL,
392 wxLongLong *pFree = NULL);
393
e90c1d2a
VZ
394#if wxUSE_GUI // GUI only things from now on
395
d6b9496a 396// ----------------------------------------------------------------------------
974e8d94 397// Menu accelerators related things
d6b9496a 398// ----------------------------------------------------------------------------
c801d85f 399
bc87fd68 400WXDLLEXPORT wxChar* wxStripMenuCodes(const wxChar *in, wxChar *out = (wxChar *) NULL);
184b5d99 401WXDLLEXPORT wxString wxStripMenuCodes(const wxString& str);
c801d85f 402
974e8d94
VZ
403#if wxUSE_ACCEL
404class WXDLLEXPORT wxAcceleratorEntry;
405WXDLLEXPORT wxAcceleratorEntry *wxGetAccelFromString(const wxString& label);
406#endif // wxUSE_ACCEL
407
d6b9496a
VZ
408// ----------------------------------------------------------------------------
409// Window search
410// ----------------------------------------------------------------------------
411
cb719f2e 412// Returns menu item id or wxNOT_FOUND if none.
184b5d99 413WXDLLEXPORT int wxFindMenuItemId(wxFrame *frame, const wxString& menuString, const wxString& itemString);
c801d85f 414
57591e0e
JS
415// Find the wxWindow at the given point. wxGenericFindWindowAtPoint
416// is always present but may be less reliable than a native version.
417WXDLLEXPORT wxWindow* wxGenericFindWindowAtPoint(const wxPoint& pt);
59a12e90
JS
418WXDLLEXPORT wxWindow* wxFindWindowAtPoint(const wxPoint& pt);
419
146ba0fe
VZ
420// NB: this function is obsolete, use wxWindow::FindWindowByLabel() instead
421//
422// Find the window/widget with the given title or label.
423// Pass a parent to begin the search from, or NULL to look through
424// all windows.
425WXDLLEXPORT wxWindow* wxFindWindowByLabel(const wxString& title, wxWindow *parent = (wxWindow *) NULL);
426
427// NB: this function is obsolete, use wxWindow::FindWindowByName() instead
428//
429// Find window by name, and if that fails, by label.
430WXDLLEXPORT wxWindow* wxFindWindowByName(const wxString& name, wxWindow *parent = (wxWindow *) NULL);
431
d6b9496a
VZ
432// ----------------------------------------------------------------------------
433// Message/event queue helpers
434// ----------------------------------------------------------------------------
c801d85f 435
ead7ce10 436// Yield to other apps/messages and disable user input
cb719f2e 437WXDLLEXPORT bool wxSafeYield(wxWindow *win = NULL, bool onlyIfNeeded = false);
ead7ce10 438
95dee651 439// Enable or disable input to all top level windows
cb719f2e 440WXDLLEXPORT void wxEnableTopLevelWindows(bool enable = true);
95dee651 441
d6b9496a
VZ
442// Check whether this window wants to process messages, e.g. Stop button
443// in long calculations.
444WXDLLEXPORT bool wxCheckForInterrupt(wxWindow *wnd);
445
446// Consume all events until no more left
447WXDLLEXPORT void wxFlushEvents();
448
cd6ce4a9
VZ
449// a class which disables all windows (except, may be, thegiven one) in its
450// ctor and enables them back in its dtor
451class WXDLLEXPORT wxWindowDisabler
452{
453public:
454 wxWindowDisabler(wxWindow *winToSkip = (wxWindow *)NULL);
455 ~wxWindowDisabler();
456
457private:
458 wxWindowList *m_winDisabled;
c1cb4153
VZ
459
460 DECLARE_NO_COPY_CLASS(wxWindowDisabler)
cd6ce4a9
VZ
461};
462
d6b9496a
VZ
463// ----------------------------------------------------------------------------
464// Cursors
465// ----------------------------------------------------------------------------
c801d85f
KB
466
467// Set the cursor to the busy cursor for all windows
468class WXDLLEXPORT wxCursor;
16cba29d 469extern WXDLLEXPORT_DATA(wxCursor*) wxHOURGLASS_CURSOR;
184b5d99 470WXDLLEXPORT void wxBeginBusyCursor(wxCursor *cursor = wxHOURGLASS_CURSOR);
e2a6f233 471
c801d85f 472// Restore cursor to normal
afb74891 473WXDLLEXPORT void wxEndBusyCursor();
d6b9496a 474
cb719f2e 475// true if we're between the above two calls
afb74891 476WXDLLEXPORT bool wxIsBusy();
c801d85f 477
e2a6f233
JS
478// Convenience class so we can just create a wxBusyCursor object on the stack
479class WXDLLEXPORT wxBusyCursor
480{
afb74891
VZ
481public:
482 wxBusyCursor(wxCursor* cursor = wxHOURGLASS_CURSOR)
483 { wxBeginBusyCursor(cursor); }
f6bcfd97 484 ~wxBusyCursor()
afb74891 485 { wxEndBusyCursor(); }
e2a6f233 486
f6bcfd97
BP
487 // FIXME: These two methods are currently only implemented (and needed?)
488 // in wxGTK. BusyCursor handling should probably be moved to
489 // common code since the wxGTK and wxMSW implementations are very
490 // similar except for wxMSW using HCURSOR directly instead of
491 // wxCursor.. -- RL.
492 static const wxCursor &GetStoredCursor();
493 static const wxCursor GetBusyCursor();
494};
c801d85f 495
c801d85f 496
d6b9496a 497// ----------------------------------------------------------------------------
c801d85f 498// Reading and writing resources (eg WIN.INI, .Xdefaults)
d6b9496a
VZ
499// ----------------------------------------------------------------------------
500
47d67540 501#if wxUSE_RESOURCES
62448488
JS
502WXDLLEXPORT bool wxWriteResource(const wxString& section, const wxString& entry, const wxString& value, const wxString& file = wxEmptyString);
503WXDLLEXPORT bool wxWriteResource(const wxString& section, const wxString& entry, float value, const wxString& file = wxEmptyString);
504WXDLLEXPORT bool wxWriteResource(const wxString& section, const wxString& entry, long value, const wxString& file = wxEmptyString);
505WXDLLEXPORT bool wxWriteResource(const wxString& section, const wxString& entry, int value, const wxString& file = wxEmptyString);
506
9d2f3c71 507WXDLLEXPORT bool wxGetResource(const wxString& section, const wxString& entry, wxChar **value, const wxString& file = wxEmptyString);
62448488
JS
508WXDLLEXPORT bool wxGetResource(const wxString& section, const wxString& entry, float *value, const wxString& file = wxEmptyString);
509WXDLLEXPORT bool wxGetResource(const wxString& section, const wxString& entry, long *value, const wxString& file = wxEmptyString);
510WXDLLEXPORT bool wxGetResource(const wxString& section, const wxString& entry, int *value, const wxString& file = wxEmptyString);
47d67540 511#endif // wxUSE_RESOURCES
c801d85f 512
c801d85f
KB
513void WXDLLEXPORT wxGetMousePosition( int* x, int* y );
514
515// MSW only: get user-defined resource from the .res file.
516// Returns NULL or newly-allocated memory, so use delete[] to clean up.
2049ba38 517#ifdef __WXMSW__
16cba29d 518 extern WXDLLEXPORT const wxChar* wxUserResourceStr;
373658eb 519 WXDLLEXPORT wxChar* wxLoadUserResource(const wxString& resourceName, const wxString& resourceType = wxUserResourceStr);
d6b9496a
VZ
520#endif // MSW
521
522// ----------------------------------------------------------------------------
523// Display and colorss (X only)
524// ----------------------------------------------------------------------------
c801d85f 525
d111a89a
VZ
526#ifdef __WXGTK__
527 void *wxGetDisplay();
528#endif
529
c801d85f 530#ifdef __X__
968eb2ef
MW
531 WXDLLIMPEXP_CORE WXDisplay *wxGetDisplay();
532 WXDLLIMPEXP_CORE bool wxSetDisplay(const wxString& display_name);
533 WXDLLIMPEXP_CORE wxString wxGetDisplayName();
d111a89a 534#endif // X or GTK+
c801d85f
KB
535
536#ifdef __X__
537
338dd992
JJ
538#ifdef __VMS__ // Xlib.h for VMS is not (yet) compatible with C++
539 // The resulting warnings are switched off here
540#pragma message disable nosimpint
541#endif
7266b672 542// #include <X11/Xlib.h>
338dd992
JJ
543#ifdef __VMS__
544#pragma message enable nosimpint
545#endif
c801d85f 546
c801d85f
KB
547#endif //__X__
548
e90c1d2a
VZ
549#endif // wxUSE_GUI
550
886dd7d2
VZ
551// ----------------------------------------------------------------------------
552// wxYield(): these functions are obsolete, please use wxApp methods instead!
553// ----------------------------------------------------------------------------
554
555// Yield to other apps/messages
bddd7a8d 556WXDLLIMPEXP_BASE bool wxYield();
886dd7d2
VZ
557
558// Like wxYield, but fails silently if the yield is recursive.
bddd7a8d 559WXDLLIMPEXP_BASE bool wxYieldIfNeeded();
886dd7d2 560
f6bcfd97 561// ----------------------------------------------------------------------------
77ffb593 562// Error message functions used by wxWidgets (deprecated, use wxLog)
f6bcfd97
BP
563// ----------------------------------------------------------------------------
564
73deed44
VZ
565#if WXWIN_COMPATIBILITY_2_2
566
f6bcfd97
BP
567// Format a message on the standard error (UNIX) or the debugging
568// stream (Windows)
ec157c8f 569wxDEPRECATED( WXDLLIMPEXP_BASE void wxDebugMsg(const wxChar *fmt ...) ATTRIBUTE_PRINTF_1 );
f6bcfd97
BP
570
571// Non-fatal error (continues)
16cba29d 572extern WXDLLIMPEXP_DATA_BASE(const wxChar*) wxInternalErrorStr;
ec157c8f 573wxDEPRECATED( WXDLLIMPEXP_BASE void wxError(const wxString& msg, const wxString& title = wxInternalErrorStr) );
f6bcfd97
BP
574
575// Fatal error (exits)
16cba29d 576extern WXDLLIMPEXP_DATA_BASE(const wxChar*) wxFatalErrorStr;
ec157c8f 577wxDEPRECATED( WXDLLIMPEXP_BASE void wxFatalError(const wxString& msg, const wxString& title = wxFatalErrorStr) );
f6bcfd97 578
73deed44 579#endif // WXWIN_COMPATIBILITY_2_2
f6bcfd97 580
c801d85f 581#endif
34138703 582 // _WX_UTILSH__