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