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