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