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