::NewId
::RegisterId
::wxBeginBusyCursor
::wxBell
::wxCleanUp
::wxCreateDynamicObject
::wxDebugMsg
::wxDisplaySize
::wxEntry
::wxError
::wxEndBusyCursor
::wxExecute
::wxExit
::wxFatalError
::wxFindMenuItemId
::wxFindWindowByLabel
::wxFindWindowByName
::wxGetActiveWindow
::wxGetDisplayName
::wxGetHomeDir
::wxGetHostName
::wxGetElapsedTime
::wxGetFreeMemory
::wxGetMousePosition
::wxGetOsVersion
::wxGetResource
::wxGetUserId
::wxGetUserName
::wxKill
::wxInitClipboard
::wxIPCCleanUp
::wxIPCInitialize
::wxIsBusy
::wxLoadUserResource
::wxNow
::wxPostDelete
::wxSetDisplayName
::wxShell
::wxSleep
::wxStripMenuCodes
::wxStartTimer
::wxSubType
::wxToLower
::wxToUpper
::wxTrace
::wxTraceLevel
::wxWriteResource
::wxYield
long NewId(void)
Generates an integer identifier unique to this run of the program.
void RegisterId(long id)
Ensures that ids subsequently generated by NewId do not clash with the given id.
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.
void wxBell(void)
Ring the system bell.
void wxCleanUp(void)
Normally, wxWindows will call this cleanup function for you. However, if you call wxEntry in order to initialize wxWindows manually, then you should also call wxCleanUp before terminating wxWindows, if wxWindows does not get a chance to do it.
wxObject * wxCreateDynamicObject(char *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 wxDebugMsg(char *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.
void wxDisplaySize(int *width, int *height)
Gets the physical size of the display in pixels.
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. See also wxCleanUp.
void wxEntry(HANDLE hInstance, HANDLE hPrevInstance, char *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, char * commandLine) wxWindows initialization under Windows (for applications constructed as a DLL).
int wxEntry(int argc, char **argv)
wxWindows initialization under UNIX (XView or Motif).
void wxError(char *msg, char *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.
void wxEndBusyCursor(void)
Changes the cursor back to the original cursor, for all windows in the application. Use with wxBeginBusyCursor.
See also wxIsBusy.
long wxExecute(char *command, Bool sync = FALSE)
long wxExecute(char **argv, Bool sync = FALSE)
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.
If execution is asynchronous, the return value is the process id, otherwise it is a status value. A zero value indicates that the command could not be executed.
See also wxShell.
void wxExit(void)
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 wxFrame::OnClose and wxApp.
void wxFatalError(char *msg, char *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.
int wxFindMenuItemId(wxFrame *frame, char *menuString, char *itemString)
Find a menu item identifier associated with the given frame's menu bar.
wxWindow * wxFindWindowByLabel(char *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.
wxWindow * wxFindWindowByName(char *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.
wxWindow * wxGetActiveWindow(void)
Gets the currently active window (Windows only).
char * wxGetDisplayName(void)
Under X only, returns the current display name. See also wxSetDisplayName.
char * wxGetHomeDir(char *buf)
Fills the buffer with a string representing the user's home directory (UNIX only).
Bool wxGetHostName(char *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''.
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.
long wxGetFreeMemory(void)
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.
void wxGetMousePosition(int* x, int* y)
Returns the mouse position in screen coordinates.
int wxGetOsVersion(int *major = NULL, int *minor = NULL)
Gets operating system version information.
Platform | Return tyes |
XView | Return value is wxXVIEW_X, major is X version, minor is X revision. |
Macintosh | Return value is wxMACINTOSH. |
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. |
Bool wxGetResource(char *section, char *entry, char **value, char *file = NULL)
Bool wxGetResource(char *section, char *entry, float *value, char *file = NULL)
Bool wxGetResource(char *section, char *entry, long *value, char *file = NULL)
Bool wxGetResource(char *section, char *entry, int *value, char *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::wx_class) 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.
Bool wxGetUserId(char *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''.
Bool wxGetUserName(char *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''.
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.
void wxInitClipboard(void)
Initializes the generic clipboard system by creating an instance of the class wxClipboard.
void wxIPCCleanUp(void)
Call this when your application is terminating, if you have called wxIPCInitialize.
void wxIPCInitialize(void)
Initializes for interprocess communication operation. May be called multiple times without harm.
See also wxServer, wxClient, wxConnection and the relevant section of the user manual.
Bool wxIsBusy(void)
Returns TRUE if between two wxBeginBusyCursor and wxEndBusyCursor calls.
char * wxLoadUserResource(char *resourceName, char *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.
char * wxNow(void)
Returns a string representing the current date and time.
void wxPostDelete(wxObject *object)
Under X, 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 X will still send events to the window.
Now obsolete: use wxWindow::Close instead.
void wxSetDisplayName(char *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.
Bool wxShell(const char *command = NULL)
Executes a command in an interactive shell window. If no command is specified, then just the shell is spawned.
See also wxExecute.
void wxSleep(int secs)
Under X, sleeps for the specified number of seconds using the technique specified in the XView manual, not UNIX sleep.
void wxStripMenuCodes(char *in, char *out)
Strips any menu codes from in and places the result in out. Menu codes include & (mark the next character with an underline as a keyboard shortkey in Windows and Motif) and \t (tab in Windows).
void wxStartTimer(void)
Starts a stopwatch; use ::wxGetElapsedTime to get the elapsed time.
See also wxTimer.
Bool wxSubType(WXTYPE type1, WXTYPE type2)
OBSOLETE FUNCTION: please use wxObject::IsKindOf instead.
TRUE if type1 is a subtype of, or the same type as, type2. This can be useful when determining whether an object is an instance of a class derived from some other class, and its usage can make for generic code.
See also wxTypeTree and wxObject::__type.
Example:
wxNode *node = GetChildren()->First(); while (node) { // Find a child that's a subwindow, but not a dialog box. wxWindow *child = (wxWindow *)node->Data(); if ((wxSubType(child->__type, wxTYPE_PANEL) && !wxSubType(child->__type, wxTYPE_DIALOG_BOX)) || wxSubType(child->__type, wxTYPE_TEXT_WINDOW) || wxSubType(child->__type, wxTYPE_CANVAS)) { child->SetFocus(); return; } node = node->Next(); }
char wxToLower(char ch)
Converts the character to lower case. This is implemented as a macro for efficiency.
char wxToUpper(char ch)
Converts the character to upper case. This is implemented as a macro for efficiency.
void wxTrace(char *fmt, ...)
Takes printf-style variable argument syntax. Output is directed to the current output stream (see wxDebugContext).
void wxTraceLevel(int level, char *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.
Bool wxWriteResource(char *section, char *entry, char *value, char *file = NULL)
Bool wxWriteResource(char *section, char *entry, float value, char *file = NULL)
Bool wxWriteResource(char *section, char *entry, long value, char *file = NULL)
Bool wxWriteResource(char *section, char *entry, int value, char *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.
Bool wxYield(void)
Yields control to pending messages in the windowing system (has no effect under XView). 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.