Version: 3.1.0
utils.h File Reference

Classes

class  wxWindowDisabler
 This class disables all windows of the application (may be with the exception of one of them) in its constructor and enables them back in its destructor. More...
 
class  wxBusyCursor
 This class makes it easy to tell your user that the program is temporarily busy. More...
 
struct  wxExecuteEnv
 This structure can optionally be passed to wxExecute() to specify additional options to use for the child process. More...
 

Typedefs

typedef wxStringToStringHashMap wxEnvVariableHashMap
 A map type containing environment variables names and values. More...
 
typedef int(* wxSortCallback) (const void *pItem1, const void *pItem2, const void *user_data)
 Compare function type for use with wxQsort() More...
 

Enumerations

enum  wxSignal {
  wxSIGNONE = 0,
  wxSIGHUP,
  wxSIGINT,
  wxSIGQUIT,
  wxSIGILL,
  wxSIGTRAP,
  wxSIGABRT,
  wxSIGEMT,
  wxSIGFPE,
  wxSIGKILL,
  wxSIGBUS,
  wxSIGSEGV,
  wxSIGSYS,
  wxSIGPIPE,
  wxSIGALRM,
  wxSIGTERM
}
 Signal constants used by wxProcess. More...
 
enum  wxKillError {
  wxKILL_OK,
  wxKILL_BAD_SIGNAL,
  wxKILL_ACCESS_DENIED,
  wxKILL_NO_PROCESS,
  wxKILL_ERROR
}
 Return values for wxProcess::Kill. More...
 
enum  wxKillFlags {
  wxKILL_NOCHILDREN = 0,
  wxKILL_CHILDREN = 1
}
 
enum  wxShutdownFlags {
  wxSHUTDOWN_FORCE = 1,
  wxSHUTDOWN_POWEROFF = 2,
  wxSHUTDOWN_REBOOT = 4,
  wxSHUTDOWN_LOGOFF = 8
}
 
enum  {
  wxStrip_Mnemonics = 1,
  wxStrip_Accel = 2,
  wxStrip_All = wxStrip_Mnemonics | wxStrip_Accel
}
 flags for wxStripMenuCodes More...
 
enum  {
  wxEXEC_ASYNC = 0,
  wxEXEC_SYNC = 1,
  wxEXEC_SHOW_CONSOLE = 2,
  wxEXEC_MAKE_GROUP_LEADER = 4,
  wxEXEC_NODISABLE = 8,
  wxEXEC_NOEVENTS = 16,
  wxEXEC_HIDE_CONSOLE = 32,
  wxEXEC_BLOCK = wxEXEC_SYNC | wxEXEC_NOEVENTS
}
 Bit flags that can be used with wxExecute(). More...
 

Functions

void wxBeginBusyCursor (const wxCursor *cursor=wxHOURGLASS_CURSOR)
 Changes the cursor to the given cursor for all windows in the application. More...
 
void wxEndBusyCursor ()
 Changes the cursor back to the original cursor, for all windows in the application. More...
 
bool wxIsBusy ()
 Returns true if between two wxBeginBusyCursor() and wxEndBusyCursor() calls. More...
 
void wxBell ()
 Ring the system bell. More...
 
void wxInfoMessageBox (wxWindow *parent)
 Shows a message box with the information about the wxWidgets build used, including its version, most important build parameters and the version of the underlying GUI toolkit. More...
 
wxVersionInfo wxGetLibraryVersionInfo ()
 Get wxWidgets version information. More...
 
wxCharwxGetenv (const wxString &var)
 This is a macro defined as getenv() or its wide char version in Unicode mode. More...
 
bool wxGetEnv (const wxString &var, wxString *value)
 Returns the current value of the environment variable var in value. More...
 
bool wxSetEnv (const wxString &var, const wxString &value)
 Sets the value of the environment variable var (adding it if necessary) to value. More...
 
bool wxUnsetEnv (const wxString &var)
 Removes the variable var from the environment. More...
 
bool wxGetEnvMap (wxEnvVariableHashMap *map)
 Fill a map with the complete content of current environment. More...
 
wxBatteryState wxGetBatteryState ()
 Returns battery state as one of wxBATTERY_NORMAL_STATE, wxBATTERY_LOW_STATE, wxBATTERY_CRITICAL_STATE, wxBATTERY_SHUTDOWN_STATE or wxBATTERY_UNKNOWN_STATE. More...
 
wxPowerType wxGetPowerType ()
 Returns the type of power source as one of wxPOWER_SOCKET, wxPOWER_BATTERY or wxPOWER_UNKNOWN. More...
 
wxString wxGetDisplayName ()
 Under X only, returns the current display name. More...
 
bool wxGetKeyState (wxKeyCode key)
 For normal keys, returns true if the specified key is currently down. More...
 
wxPoint wxGetMousePosition ()
 Returns the mouse position in screen coordinates. More...
 
wxMouseState wxGetMouseState ()
 Returns the current state of the mouse. More...
 
void wxEnableTopLevelWindows (bool enable=true)
 This function enables or disables all top level windows. More...
 
wxWindowwxFindWindowAtPoint (const wxPoint &pt)
 Find the deepest window at the given mouse position in screen coordinates, returning the window if found, or NULL if not. More...
 
wxWindowwxFindWindowByLabel (const wxString &label, wxWindow *parent=NULL)
 
wxWindowwxFindWindowByName (const wxString &name, wxWindow *parent=NULL)
 
int wxFindMenuItemId (wxFrame *frame, const wxString &menuString, const wxString &itemString)
 Find a menu item identifier associated with the given frame's menu bar. More...
 
int wxNewId ()
 
void wxRegisterId (int id)
 Ensures that Ids subsequently generated by wxNewId() do not clash with the given id. More...
 
bool wxLaunchDefaultApplication (const wxString &document, int flags=0)
 Opens the document in the application associated with the files of this type. More...
 
bool wxLaunchDefaultBrowser (const wxString &url, int flags=0)
 Opens the url in user's default browser. More...
 
bool wxLoadUserResource (const void **outData, size_t *outLen, const wxString &resourceName, const wxChar *resourceType="TEXT", WXHINSTANCE module=0)
 Loads an object from Windows resource file. More...
 
char * wxLoadUserResource (const wxString &resourceName, const wxChar *resourceType="TEXT", int *pLen=NULL, WXHINSTANCE module=0)
 Loads a user-defined Windows resource as a string. More...
 
void wxPostDelete (wxObject *object)
 
void wxQsort (void *pbase, size_t total_elems, size_t size, wxSortCallback cmp, const void *user_data)
 Function implementing quick sort algorithm. More...
 
void wxSetDisplayName (const wxString &displayName)
 Under X only, sets the current display name. More...
 
wxString wxStripMenuCodes (const wxString &str, int flags=wxStrip_All)
 Strips any menu codes from str and returns the result. More...
 
wxString wxGetEmailAddress ()
 Copies the user's email address into the supplied buffer, by concatenating the values returned by wxGetFullHostName() and wxGetUserId(). More...
 
bool wxGetEmailAddress (char *buf, int sz)
 
wxMemorySize wxGetFreeMemory ()
 Returns the amount of free memory in bytes under environments which support it, and -1 if not supported or failed to perform measurement. More...
 
wxString wxGetHomeDir ()
 Return the (current) user's home directory. More...
 
wxString wxGetHostName ()
 Copies the current host machine's name into the supplied buffer. More...
 
bool wxGetHostName (char *buf, int sz)
 
wxString wxGetFullHostName ()
 Returns the FQDN (fully qualified domain host name) or an empty string on error. More...
 
wxString wxGetUserHome (const wxString &user=wxEmptyString)
 Returns the home directory for the given user. More...
 
wxString wxGetUserId ()
 This function returns the "user id" also known as "login name" under Unix (i.e. More...
 
bool wxGetUserId (char *buf, int sz)
 
wxString wxGetUserName ()
 This function returns the full user name (something like "Mr. John Smith"). More...
 
bool wxGetUserName (char *buf, int sz)
 
wxString wxGetOsDescription ()
 Returns the string containing the description of the current platform in a user-readable form. More...
 
wxOperatingSystemId wxGetOsVersion (int *major=NULL, int *minor=NULL)
 Gets the version and the operating system ID for currently running OS. More...
 
bool wxCheckOsVersion (int majorVsn, int minorVsn=0)
 Returns true if the version of the operating system on which the program is running under is the same or later than the given version. More...
 
bool wxIsPlatform64Bit ()
 Returns true if the operating system the program is running under is 64 bit. More...
 
bool wxIsPlatformLittleEndian ()
 Returns true if the current platform is little endian (instead of big endian). More...
 
wxLinuxDistributionInfo wxGetLinuxDistributionInfo ()
 Returns a structure containing information about the currently running Linux distribution. More...
 
long wxExecute (const wxString &command, int flags=wxEXEC_ASYNC, wxProcess *callback=NULL, const wxExecuteEnv *env=NULL)
 Executes another program in Unix or Windows. More...
 
long wxExecute (char **argv, int flags=wxEXEC_ASYNC, wxProcess *callback=NULL, const wxExecuteEnv *env=NULL)
 This is an overloaded version of wxExecute(const wxString&,int,wxProcess*), please see its documentation for general information. More...
 
long wxExecute (wchar_t **argv, int flags=wxEXEC_ASYNC, wxProcess *callback=NULL, const wxExecuteEnv *env=NULL)
 
long wxExecute (const wxString &command, wxArrayString &output, int flags=0, const wxExecuteEnv *env=NULL)
 This is an overloaded version of wxExecute(const wxString&,int,wxProcess*), please see its documentation for general information. More...
 
long wxExecute (const wxString &command, wxArrayString &output, wxArrayString &errors, int flags=0, const wxExecuteEnv *env=NULL)
 This is an overloaded version of wxExecute(const wxString&,int,wxProcess*), please see its documentation for general information. More...
 
unsigned long wxGetProcessId ()
 Returns the number uniquely identifying the current process in the system. More...
 
int wxKill (long pid, wxSignal sig=wxSIGTERM, wxKillError *rc=NULL, int flags=wxKILL_NOCHILDREN)
 Equivalent to the Unix kill function: send the given signal sig to the process with PID pid. More...
 
bool wxShell (const wxString &command=wxEmptyString)
 Executes a command in an interactive shell window. More...
 
bool wxShutdown (int flags=wxSHUTDOWN_POWEROFF)
 This function shuts down or reboots the computer depending on the value of the flags. More...
 
void wxMicroSleep (unsigned long microseconds)
 Sleeps for the specified number of microseconds. More...
 
void wxMilliSleep (unsigned long milliseconds)
 Sleeps for the specified number of milliseconds. More...
 
wxString wxNow ()
 Returns a string representing the current date and time. More...
 
void wxSleep (int secs)
 Sleeps for the specified number of seconds. More...
 
void wxUsleep (unsigned long milliseconds)
 

Enumeration Type Documentation

Return values for wxProcess::Kill.

Enumerator
wxKILL_OK 

no error

wxKILL_BAD_SIGNAL 

no such signal

wxKILL_ACCESS_DENIED 

permission denied

wxKILL_NO_PROCESS 

no such process

wxKILL_ERROR 

another, unspecified error

Enumerator
wxKILL_NOCHILDREN 

don't kill children

wxKILL_CHILDREN 

kill children

Enumerator
wxSHUTDOWN_FORCE 

can be combined with other flags (MSW-only)

wxSHUTDOWN_POWEROFF 

power off the computer

wxSHUTDOWN_REBOOT 

shutdown and reboot

wxSHUTDOWN_LOGOFF 

close session (currently MSW-only)

enum wxSignal

Signal constants used by wxProcess.

Enumerator
wxSIGNONE 

verify if the process exists under Unix

wxSIGHUP 
wxSIGINT 
wxSIGQUIT 
wxSIGILL 
wxSIGTRAP 
wxSIGABRT 
wxSIGEMT 
wxSIGFPE 
wxSIGKILL 

forcefully kill, dangerous!

wxSIGBUS 
wxSIGSEGV 
wxSIGSYS 
wxSIGPIPE 
wxSIGALRM 
wxSIGTERM 

terminate the process gently