::wxNewId
::wxRegisterId
::wxBeginBusyCursor
::wxBell
::wxCreateDynamicObject
::wxDDECleanUp
::wxDDEInitialize
::wxDebugMsg
::wxDisplaySize
::wxEntry
::wxError
::wxEndBusyCursor
::wxExecute
::wxExit
::wxFatalError
::wxFindMenuItemId
::wxFindWindowByLabel
::wxFindWindowByName
::wxGetActiveWindow
::wxGetDisplayName
::wxGetHomeDir
::wxGetHostName
::wxGetElapsedTime
::wxGetFreeMemory
::wxGetMousePosition
::wxGetOsVersion
::wxGetResource
::wxGetUserId
::wxGetUserName
::wxKill
::wxIsBusy
::wxLoadUserResource
::wxNow
::wxPostDelete
::wxSetDisplayName
::wxShell
::wxSleep
::wxStripMenuCodes
::wxStartTimer
::wxToLower
::wxToUpper
::wxTrace
::wxTraceLevel
::wxWriteResource
::wxYield
long wxNewId()
Generates an integer identifier unique to this run of the program.
Include files
<wx/utils.h>
void wxRegisterId(long id)
Ensures that ids subsequently generated by NewId do not clash with the given id.
Include files
<wx/utils.h>
void wxBeginBusyCursor(wxCursor *cursor = wxHOURGLASS_CURSOR)
Changes the cursor to the given cursor for all windows in the application. Use wxEndBusyCursor to revert the cursor back to its previous state. These two calls can be nested, and a counter ensures that only the outer calls take effect.
See also wxIsBusy, wxBusyCursor.
Include files
<wx/utils.h>
void wxBell()
Ring the system bell.
Include files
<wx/utils.h>
wxObject * wxCreateDynamicObject(const wxString& className)
Creates and returns an object of the given class, if the class has been registered with the dynamic class system using DECLARE... and IMPLEMENT... macros.
void wxDDECleanUp()
Called when wxWindows exits, to clean up the DDE system. This no longer needs to be called by the application.
See also helprefwxDDEInitializewxddeinitialize.
Include files
<wx/dde.h>
void wxDDEInitialize()
Initializes the DDE system. May be called multiple times without harm.
This no longer needs to be called by the application: it will be called by wxWindows if necessary.
See also wxDDEServer, wxDDEClient, wxDDEConnection, wxDDECleanUp.
Include files
<wx/dde.h>
void wxDebugMsg(const wxString& fmt, ...)
Display a debugging message; under Windows, this will appear on the debugger command window, and under Unix, it will be written to standard error.
The syntax is identical to printf: pass a format string and a variable list of arguments.
Note that under Windows, you can see the debugging messages without a debugger if you have the DBWIN debug log application that comes with Microsoft C++.
Tip: under Windows, if your application crashes before the message appears in the debugging window, put a wxYield call after each wxDebugMsg call. wxDebugMsg seems to be broken under WIN32s (at least for Watcom C++): preformat your messages and use OutputDebugString instead.
This function is now obsolete, replaced by Log functions.
Include files
<wx/utils.h>
void wxDisplaySize(int *width, int *height)
Gets the physical size of the display in pixels.
Include files
<wx/gdicmn.h>
This initializes wxWindows in a platform-dependent way. Use this if you are not using the default wxWindows entry code (e.g. main or WinMain). For example, you can initialize wxWindows from an Microsoft Foundation Classes application using this function.
void wxEntry(HANDLE hInstance, HANDLE hPrevInstance, const wxString& commandLine, int cmdShow, bool enterLoop = TRUE)
wxWindows initialization under Windows (non-DLL). If enterLoop is FALSE, the function will return immediately after calling wxApp::OnInit. Otherwise, the wxWindows message loop will be entered.
void wxEntry(HANDLE hInstance, HANDLE hPrevInstance, WORD wDataSegment, WORD wHeapSize, const wxString& commandLine)
wxWindows initialization under Windows (for applications constructed as a DLL).
int wxEntry(int argc, const wxString& *argv)
wxWindows initialization under Unix.
Remarks
To clean up wxWindows, call wxApp::OnExit followed by the static function wxApp::CleanUp. For example, if exiting from an MFC application that also uses wxWindows:
int CTheApp::ExitInstance() { // OnExit isn't called by CleanUp so must be called explicitly. wxTheApp->OnExit(); wxApp::CleanUp(); return CWinApp::ExitInstance(); }Include files
<wx/app.h>
void wxError(const wxString& msg, const wxString& title = "wxWindows Internal Error")
Displays msg and continues. This writes to standard error under Unix, and pops up a message box under Windows. Used for internal wxWindows errors. See also wxFatalError.
Include files
<wx/utils.h>
void wxEndBusyCursor()
Changes the cursor back to the original cursor, for all windows in the application. Use with wxBeginBusyCursor.
See also wxIsBusy, wxBusyCursor.
Include files
<wx/utils.h>
long wxExecute(const wxString& command, bool sync = FALSE, wxProcess *callback = NULL)
long wxExecute(char **argv, bool sync = FALSE, wxProcess *callback = NULL)
Executes another program in Unix or Windows.
The first form takes a command string, such as "emacs file.txt".
The second form takes an array of values: a command, any number of arguments, terminated by NULL.
If sync is FALSE (the default), flow of control immediately returns. If TRUE, the current application waits until the other program has terminated.
In the case of synchronous execution, the return value is trhe exit code of the process (which terminates by the moment the function returns) and will be -1 if the process couldn't be started and typically 0 if the process terminated successfully.
For asynchronous execution, however, the return value is the process id and zero value indicates that the command could not be executed.
If callback isn't NULL and if execution is asynchronous (note that callback parameter can not be non NULL for synchronous execution), wxProcess::OnTerminate will be called when the process finishes.
Include files
<wx/utils.h>
void wxExit()
Exits application after calling wxApp::OnExit. Should only be used in an emergency: normally the top-level frame should be deleted (after deleting all other frames) to terminate the application. See wxWindow::OnCloseWindow and wxApp.
Include files
<wx/app.h>
void wxFatalError(const wxString& msg, const wxString& title = "wxWindows Fatal Error")
Displays msg and exits. This writes to standard error under Unix, and pops up a message box under Windows. Used for fatal internal wxWindows errors. See also wxError.
Include files
<wx/utils.h>
int wxFindMenuItemId(wxFrame *frame, const wxString& menuString, const wxString& itemString)
Find a menu item identifier associated with the given frame's menu bar.
Include files
<wx/utils.h>
wxWindow * wxFindWindowByLabel(const wxString& label, wxWindow *parent=NULL)
Find a window by its label. Depending on the type of window, the label may be a window title or panel item label. If parent is NULL, the search will start from all top-level frames and dialog boxes; if non-NULL, the search will be limited to the given window hierarchy. The search is recursive in both cases.
Include files
<wx/utils.h>
wxWindow * wxFindWindowByName(const wxString& name, wxWindow *parent=NULL)
Find a window by its name (as given in a window constructor or Create function call). If parent is NULL, the search will start from all top-level frames and dialog boxes; if non-NULL, the search will be limited to the given window hierarchy. The search is recursive in both cases.
If no such named window is found, wxFindWindowByLabel is called.
Include files
<wx/utils.h>
wxWindow * wxGetActiveWindow()
Gets the currently active window (Windows only).
Include files
<wx/windows.h>
wxString wxGetDisplayName()
Under X only, returns the current display name. See also wxSetDisplayName.
Include files
<wx/utils.h>
wxString wxGetHomeDir(const wxString& buf)
Fills the buffer with a string representing the user's home directory (Unix only).
Include files
<wx/utils.h>
bool wxGetHostName(const wxString& buf, int bufSize)
Copies the host name of the machine the program is running on into the buffer buf, of maximum size bufSize, returning TRUE if successful. Under Unix, this will return a machine name. Under Windows, this returns "windows''.
Include files
<wx/utils.h>
long wxGetElapsedTime(bool resetTimer = TRUE)
Gets the time in milliseconds since the last ::wxStartTimer.
If resetTimer is TRUE (the default), the timer is reset to zero by this call.
See also wxTimer.
Include files
<wx/timer.h>
long wxGetFreeMemory()
Returns the amount of free memory in Kbytes under environments which support it, and -1 if not supported. Currently, returns a positive value under Windows, and -1 under Unix.
Include files
<wx/utils.h>
void wxGetMousePosition(int* x, int* y)
Returns the mouse position in screen coordinates.
Include files
<wx/utils.h>
int wxGetOsVersion(int *major = NULL, int *minor = NULL)
Gets operating system version information.
Platform | Return tyes |
Macintosh | Return value is wxMACINTOSH. |
GTK | Return value is wxGTK, major is 1, minor is 0. (for GTK 1.0.X) |
Motif | Return value is wxMOTIF_X, major is X version, minor is X revision. |
OS/2 | Return value is wxOS2_PM. |
Windows 3.1 | Return value is wxWINDOWS, major is 3, minor is 1. |
Windows NT | Return value is wxWINDOWS_NT, major is 3, minor is 1. |
Windows 95 | Return value is wxWIN95, major is 3, minor is 1. |
Win32s (Windows 3.1) | Return value is wxWIN32S, major is 3, minor is 1. |
Watcom C++ 386 supervisor mode (Windows 3.1) | Return value is wxWIN386, major is 3, minor is 1. |
Include files
<wx/utils.h>
bool wxGetResource(const wxString& section, const wxString& entry, const wxString& *value, const wxString& file = NULL)
bool wxGetResource(const wxString& section, const wxString& entry, float *value, const wxString& file = NULL)
bool wxGetResource(const wxString& section, const wxString& entry, long *value, const wxString& file = NULL)
bool wxGetResource(const wxString& section, const wxString& entry, int *value, const wxString& file = NULL)
Gets a resource value from the resource database (for example, WIN.INI, or .Xdefaults). If file is NULL, WIN.INI or .Xdefaults is used, otherwise the specified file is used.
Under X, if an application class (wxApp::GetClassName) has been defined, it is appended to the string /usr/lib/X11/app-defaults/ to try to find an applications default file when merging all resource databases.
The reason for passing the result in an argument is that it can be convenient to define a default value, which gets overridden if the value exists in the resource file. It saves a separate test for that resource's existence, and it also allows the overloading of the function for different types.
See also wxWriteResource, wxConfigBase.
Include files
<wx/utils.h>
bool wxGetUserId(const wxString& buf, int bufSize)
Copies the user's login identity (such as "jacs'') into the buffer buf, of maximum size bufSize, returning TRUE if successful. Under Windows, this returns "user''.
Include files
<wx/utils.h>
bool wxGetUserName(const wxString& buf, int bufSize)
Copies the user's name (such as "Julian Smart'') into the buffer buf, of maximum size bufSize, returning TRUE if successful. Under Windows, this returns "unknown''.
Include files
<wx/utils.h>
int wxKill(long pid, int sig)
Under Unix (the only supported platform), equivalent to the Unix kill function. Returns 0 on success, -1 on failure.
Tip: sending a signal of 0 to a process returns -1 if the process does not exist. It does not raise a signal in the receiving process.
Include files
<wx/utils.h>
bool wxIsBusy()
Returns TRUE if between two wxBeginBusyCursor and wxEndBusyCursor calls.
See also wxBusyCursor.
Include files
<wx/utils.h>
wxString wxLoadUserResource(const wxString& resourceName, const wxString& resourceType="TEXT")
Loads a user-defined Windows resource as a string. If the resource is found, the function creates a new character array and copies the data into it. A pointer to this data is returned. If unsuccessful, NULL is returned.
The resource must be defined in the .rc file using the following syntax:
myResource TEXT file.extwhere file.ext is a file that the resource compiler can find.
One use of this is to store .wxr files instead of including the data in the C++ file; some compilers cannot cope with the long strings in a .wxr file. The resource data can then be parsed using wxResourceParseString.
This function is available under Windows only.
Include files
<wx/utils.h>
wxString wxNow()
Returns a string representing the current date and time.
Include files
<wx/utils.h>
void wxPostDelete(wxObject *object)
Tells the system to delete the specified object when all other events have been processed. In some environments, it is necessary to use this instead of deleting a frame directly with the delete operator, because some GUIs will still send events to a deleted window.
Now obsolete: use wxWindow::Close instead.
Include files
<wx/utils.h>
void wxSetDisplayName(const wxString& displayName)
Under X only, sets the current display name. This is the X host and display name such as "colonsay:0.0", and the function indicates which display should be used for creating windows from this point on. Setting the display within an application allows multiple displays to be used.
See also wxGetDisplayName.
Include files
<wx/utils.h>
bool wxShell(const wxString& command = NULL)
Executes a command in an interactive shell window. If no command is specified, then just the shell is spawned.
See also wxExecute.
Include files
<wx/utils.h>
void wxSleep(int secs)
Sleeps for the specified number of seconds.
Include files
<wx/utils.h>
wxString wxStripMenuCodes(const wxString& in)
void wxStripMenuCodes(char* in, char* out)
Strips any menu codes from in and places the result in out (or returns the new string, in the first form).
Menu codes include & (mark the next character with an underline as a keyboard shortkey in Windows and Motif) and \t (tab in Windows).
Include files
<wx/utils.h>
void wxStartTimer()
Starts a stopwatch; use ::wxGetElapsedTime to get the elapsed time.
See also wxTimer.
Include files
<wx/timer.h>
char wxToLower(char ch)
Converts the character to lower case. This is implemented as a macro for efficiency.
Include files
<wx/utils.h>
char wxToUpper(char ch)
Converts the character to upper case. This is implemented as a macro for efficiency.
Include files
<wx/utils.h>
void wxTrace(const wxString& fmt, ...)
Takes printf-style variable argument syntax. Output is directed to the current output stream (see wxDebugContext).
This function is now obsolete, replaced by Log functions.
Include files
<wx/memory.h>
void wxTraceLevel(int level, const wxString& fmt, ...)
Takes printf-style variable argument syntax. Output is directed to the current output stream (see wxDebugContext). The first argument should be the level at which this information is appropriate. It will only be output if the level returned by wxDebugContext::GetLevel is equal to or greater than this value.
This function is now obsolete, replaced by Log functions.
Include files
<wx/memory.h>
bool wxWriteResource(const wxString& section, const wxString& entry, const wxString& value, const wxString& file = NULL)
bool wxWriteResource(const wxString& section, const wxString& entry, float value, const wxString& file = NULL)
bool wxWriteResource(const wxString& section, const wxString& entry, long value, const wxString& file = NULL)
bool wxWriteResource(const wxString& section, const wxString& entry, int value, const wxString& file = NULL)
Writes a resource value into the resource database (for example, WIN.INI, or .Xdefaults). If file is NULL, WIN.INI or .Xdefaults is used, otherwise the specified file is used.
Under X, the resource databases are cached until the internal function wxFlushResources is called automatically on exit, when all updated resource databases are written to their files.
Note that it is considered bad manners to write to the .Xdefaults file under Unix, although the WIN.INI file is fair game under Windows.
See also wxGetResource, wxConfigBase.
Include files
<wx/utils.h>
bool wxYield()
Yields control to pending messages in the windowing system. This can be useful, for example, when a time-consuming process writes to a text window. Without an occasional yield, the text window will not be updated properly, and (since Windows multitasking is cooperative) other processes will not respond.
Caution should be exercised, however, since yielding may allow the user to perform actions which are not compatible with the current task. Disabling menu items or whole menus during processing can avoid unwanted reentrance of code.
Include files
<wx/utils.h>