]>
git.saurik.com Git - wxWidgets.git/blob - src/stubs/utils.cpp
1 /////////////////////////////////////////////////////////////////////////////
3 // Purpose: Various utilities
8 // Copyright: (c) AUTHOR
9 // Licence: wxWindows licence
10 /////////////////////////////////////////////////////////////////////////////
13 // Note: this is done in utilscmn.cpp now.
14 // #pragma implementation
15 // #pragma implementation "utils.h"
29 // Get full hostname (eg. DoDo.BSn-Germany.crg.de)
30 bool wxGetHostName(char *buf
, int maxSize
)
36 // Get user ID e.g. jacs
37 bool wxGetUserId(char *buf
, int maxSize
)
43 // Get user name e.g. AUTHOR
44 bool wxGetUserName(char *buf
, int maxSize
)
50 int wxKill(long pid
, int sig
)
57 // Execute a program in an Interactive Shell
59 bool wxShell(const wxString
& command
)
65 // Get free memory in bytes, or -1 if cannot determine amount (e.g. on UNIX)
66 long wxGetFreeMemory()
72 void wxSleep(int nSecs
)
77 // Consume all events until no more left
82 // Output a debug message, in a system dependent fashion.
83 void wxDebugMsg(const char *fmt
...)
86 static char buffer
[512];
88 if (!wxTheApp
->GetWantDebugOutput())
93 // wvsprintf(buffer,fmt,ap) ;
94 // TODO: output buffer
99 // Non-fatal error: pop up message box and (possibly) continue
100 void wxError(const wxString
& msg
, const wxString
& title
)
106 // Fatal error: pop up message box and abort
107 void wxFatalError(const wxString
& msg
, const wxString
& title
)
118 int wxGetOsVersion(int *majorVsn
, int *minorVsn
)
124 // Reading and writing resources (eg WIN.INI, .Xdefaults)
126 bool wxWriteResource(const wxString
& section
, const wxString
& entry
, const wxString
& value
, const wxString
& file
)
132 bool wxWriteResource(const wxString
& section
, const wxString
& entry
, float value
, const wxString
& file
)
135 sprintf(buf
, "%.4f", value
);
136 return wxWriteResource(section
, entry
, buf
, file
);
139 bool wxWriteResource(const wxString
& section
, const wxString
& entry
, long value
, const wxString
& file
)
142 sprintf(buf
, "%ld", value
);
143 return wxWriteResource(section
, entry
, buf
, file
);
146 bool wxWriteResource(const wxString
& section
, const wxString
& entry
, int value
, const wxString
& file
)
149 sprintf(buf
, "%d", value
);
150 return wxWriteResource(section
, entry
, buf
, file
);
153 bool wxGetResource(const wxString
& section
, const wxString
& entry
, char **value
, const wxString
& file
)
159 bool wxGetResource(const wxString
& section
, const wxString
& entry
, float *value
, const wxString
& file
)
162 bool succ
= wxGetResource(section
, entry
, (char **)&s
, file
);
165 *value
= (float)strtod(s
, NULL
);
172 bool wxGetResource(const wxString
& section
, const wxString
& entry
, long *value
, const wxString
& file
)
175 bool succ
= wxGetResource(section
, entry
, (char **)&s
, file
);
178 *value
= strtol(s
, NULL
, 10);
185 bool wxGetResource(const wxString
& section
, const wxString
& entry
, int *value
, const wxString
& file
)
188 bool succ
= wxGetResource(section
, entry
, (char **)&s
, file
);
191 *value
= (int)strtol(s
, NULL
, 10);
197 #endif // wxUSE_RESOURCES
199 static int wxBusyCursorCount
= 0;
201 // Set the cursor to the busy cursor for all windows
202 void wxBeginBusyCursor(wxCursor
*cursor
)
204 wxBusyCursorCount
++;
205 if (wxBusyCursorCount
== 1)
215 // Restore cursor to normal
216 void wxEndBusyCursor()
218 if (wxBusyCursorCount
== 0)
221 wxBusyCursorCount
--;
222 if (wxBusyCursorCount
== 0)
228 // TRUE if we're between the above two calls
231 return (wxBusyCursorCount
> 0);
234 char *wxGetUserHome (const wxString
& user
)
240 // Check whether this window wants to process messages, e.g. Stop button
241 // in long calculations.
242 bool wxCheckForInterrupt(wxWindow
*wnd
)
248 void wxGetMousePosition( int* x
, int* y
)
253 // Return TRUE if we have a colour display
254 bool wxColourDisplay()
260 // Returns depth of screen
267 // Get size of display
268 void wxDisplaySize(int *width
, int *height
)