]> git.saurik.com Git - wxWidgets.git/blob - src/stubs/utils.cpp
attempts at making modal dialogs without parent work - failed
[wxWidgets.git] / src / stubs / utils.cpp
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: utils.cpp
3 // Purpose: Various utilities
4 // Author: AUTHOR
5 // Modified by:
6 // Created: ??/??/98
7 // RCS-ID: $Id$
8 // Copyright: (c) AUTHOR
9 // Licence: wxWindows licence
10 /////////////////////////////////////////////////////////////////////////////
11
12 #ifdef __GNUG__
13 // Note: this is done in utilscmn.cpp now.
14 // #pragma implementation
15 // #pragma implementation "utils.h"
16 #endif
17
18 #include "wx/setup.h"
19 #include "wx/utils.h"
20 #include "wx/app.h"
21
22 #include <ctype.h>
23
24 #include <stdio.h>
25 #include <stdlib.h>
26 #include <string.h>
27 #include <stdarg.h>
28
29 // Get full hostname (eg. DoDo.BSn-Germany.crg.de)
30 bool wxGetHostName(char *buf, int maxSize)
31 {
32 // TODO
33 return FALSE;
34 }
35
36 // Get user ID e.g. jacs
37 bool wxGetUserId(char *buf, int maxSize)
38 {
39 // TODO
40 return FALSE;
41 }
42
43 // Get user name e.g. AUTHOR
44 bool wxGetUserName(char *buf, int maxSize)
45 {
46 // TODO
47 return FALSE;
48 }
49
50 int wxKill(long pid, int sig)
51 {
52 // TODO
53 return 0;
54 }
55
56 //
57 // Execute a program in an Interactive Shell
58 //
59 bool wxShell(const wxString& command)
60 {
61 // TODO
62 return FALSE;
63 }
64
65 // Get free memory in bytes, or -1 if cannot determine amount (e.g. on UNIX)
66 long wxGetFreeMemory()
67 {
68 // TODO
69 return 0;
70 }
71
72 void wxSleep(int nSecs)
73 {
74 // TODO
75 }
76
77 // Consume all events until no more left
78 void wxFlushEvents()
79 {
80 }
81
82 // Output a debug message, in a system dependent fashion.
83 void wxDebugMsg(const char *fmt ...)
84 {
85 va_list ap;
86 static char buffer[512];
87
88 if (!wxTheApp->GetWantDebugOutput())
89 return ;
90
91 va_start(ap, fmt);
92
93 // wvsprintf(buffer,fmt,ap) ;
94 // TODO: output buffer
95
96 va_end(ap);
97 }
98
99 // Non-fatal error: pop up message box and (possibly) continue
100 void wxError(const wxString& msg, const wxString& title)
101 {
102 // TODO
103 wxExit();
104 }
105
106 // Fatal error: pop up message box and abort
107 void wxFatalError(const wxString& msg, const wxString& title)
108 {
109 // TODO
110 }
111
112 // Emit a beeeeeep
113 void wxBell()
114 {
115 // TODO
116 }
117
118 int wxGetOsVersion(int *majorVsn, int *minorVsn)
119 {
120 // TODO
121 return 0;
122 }
123
124 // Reading and writing resources (eg WIN.INI, .Xdefaults)
125 #if wxUSE_RESOURCES
126 bool wxWriteResource(const wxString& section, const wxString& entry, const wxString& value, const wxString& file)
127 {
128 // TODO
129 return FALSE;
130 }
131
132 bool wxWriteResource(const wxString& section, const wxString& entry, float value, const wxString& file)
133 {
134 char buf[50];
135 sprintf(buf, "%.4f", value);
136 return wxWriteResource(section, entry, buf, file);
137 }
138
139 bool wxWriteResource(const wxString& section, const wxString& entry, long value, const wxString& file)
140 {
141 char buf[50];
142 sprintf(buf, "%ld", value);
143 return wxWriteResource(section, entry, buf, file);
144 }
145
146 bool wxWriteResource(const wxString& section, const wxString& entry, int value, const wxString& file)
147 {
148 char buf[50];
149 sprintf(buf, "%d", value);
150 return wxWriteResource(section, entry, buf, file);
151 }
152
153 bool wxGetResource(const wxString& section, const wxString& entry, char **value, const wxString& file)
154 {
155 // TODO
156 return FALSE;
157 }
158
159 bool wxGetResource(const wxString& section, const wxString& entry, float *value, const wxString& file)
160 {
161 char *s = NULL;
162 bool succ = wxGetResource(section, entry, (char **)&s, file);
163 if (succ)
164 {
165 *value = (float)strtod(s, NULL);
166 delete[] s;
167 return TRUE;
168 }
169 else return FALSE;
170 }
171
172 bool wxGetResource(const wxString& section, const wxString& entry, long *value, const wxString& file)
173 {
174 char *s = NULL;
175 bool succ = wxGetResource(section, entry, (char **)&s, file);
176 if (succ)
177 {
178 *value = strtol(s, NULL, 10);
179 delete[] s;
180 return TRUE;
181 }
182 else return FALSE;
183 }
184
185 bool wxGetResource(const wxString& section, const wxString& entry, int *value, const wxString& file)
186 {
187 char *s = NULL;
188 bool succ = wxGetResource(section, entry, (char **)&s, file);
189 if (succ)
190 {
191 *value = (int)strtol(s, NULL, 10);
192 delete[] s;
193 return TRUE;
194 }
195 else return FALSE;
196 }
197 #endif // wxUSE_RESOURCES
198
199 static int wxBusyCursorCount = 0;
200
201 // Set the cursor to the busy cursor for all windows
202 void wxBeginBusyCursor(wxCursor *cursor)
203 {
204 wxBusyCursorCount ++;
205 if (wxBusyCursorCount == 1)
206 {
207 // TODO
208 }
209 else
210 {
211 // TODO
212 }
213 }
214
215 // Restore cursor to normal
216 void wxEndBusyCursor()
217 {
218 if (wxBusyCursorCount == 0)
219 return;
220
221 wxBusyCursorCount --;
222 if (wxBusyCursorCount == 0)
223 {
224 // TODO
225 }
226 }
227
228 // TRUE if we're between the above two calls
229 bool wxIsBusy()
230 {
231 return (wxBusyCursorCount > 0);
232 }
233
234 char *wxGetUserHome (const wxString& user)
235 {
236 // TODO
237 return NULL;
238 }
239
240 // Check whether this window wants to process messages, e.g. Stop button
241 // in long calculations.
242 bool wxCheckForInterrupt(wxWindow *wnd)
243 {
244 // TODO
245 return FALSE;
246 }
247
248 void wxGetMousePosition( int* x, int* y )
249 {
250 // TODO
251 };
252
253 // Return TRUE if we have a colour display
254 bool wxColourDisplay()
255 {
256 // TODO
257 return TRUE;
258 }
259
260 // Returns depth of screen
261 int wxDisplayDepth()
262 {
263 // TODO
264 return 0;
265 }
266
267 // Get size of display
268 void wxDisplaySize(int *width, int *height)
269 {
270 // TODO
271 }
272