utils.h 44 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398
  1. /////////////////////////////////////////////////////////////////////////////
  2. // Name: utils.h
  3. // Purpose: interface of various utility classes and functions
  4. // Author: wxWidgets team
  5. // Licence: wxWindows licence
  6. /////////////////////////////////////////////////////////////////////////////
  7. /**
  8. Signal constants used by wxProcess.
  9. */
  10. enum wxSignal
  11. {
  12. wxSIGNONE = 0, //!< verify if the process exists under Unix
  13. wxSIGHUP,
  14. wxSIGINT,
  15. wxSIGQUIT,
  16. wxSIGILL,
  17. wxSIGTRAP,
  18. wxSIGABRT,
  19. wxSIGEMT,
  20. wxSIGFPE,
  21. wxSIGKILL, //!< forcefully kill, dangerous!
  22. wxSIGBUS,
  23. wxSIGSEGV,
  24. wxSIGSYS,
  25. wxSIGPIPE,
  26. wxSIGALRM,
  27. wxSIGTERM //!< terminate the process gently
  28. };
  29. /**
  30. Return values for wxProcess::Kill.
  31. */
  32. enum wxKillError
  33. {
  34. wxKILL_OK, //!< no error
  35. wxKILL_BAD_SIGNAL, //!< no such signal
  36. wxKILL_ACCESS_DENIED, //!< permission denied
  37. wxKILL_NO_PROCESS, //!< no such process
  38. wxKILL_ERROR //!< another, unspecified error
  39. };
  40. enum wxKillFlags
  41. {
  42. wxKILL_NOCHILDREN = 0, //!< don't kill children
  43. wxKILL_CHILDREN = 1 //!< kill children
  44. };
  45. enum wxShutdownFlags
  46. {
  47. wxSHUTDOWN_FORCE = 1, //!< can be combined with other flags (MSW-only)
  48. wxSHUTDOWN_POWEROFF = 2, //!< power off the computer
  49. wxSHUTDOWN_REBOOT = 4, //!< shutdown and reboot
  50. wxSHUTDOWN_LOGOFF = 8 //!< close session (currently MSW-only)
  51. };
  52. /**
  53. @class wxWindowDisabler
  54. This class disables all windows of the application (may be with the
  55. exception of one of them) in its constructor and enables them back in its
  56. destructor.
  57. This is useful when you want to indicate to the user that the application
  58. is currently busy and cannot respond to user input.
  59. @library{wxcore}
  60. @category{misc}
  61. @see wxBusyCursor
  62. */
  63. class wxWindowDisabler
  64. {
  65. public:
  66. /**
  67. Disables all top level windows of the applications.
  68. If @a disable is @c false nothing is done. This can be convenient if
  69. the windows should be disabled depending on some condition.
  70. @since 2.9.0
  71. */
  72. wxWindowDisabler(bool disable = true);
  73. /**
  74. Disables all top level windows of the applications with the exception
  75. of @a winToSkip if it is not @NULL.
  76. Notice that under MSW if @a winToSkip appears in the taskbar, the user
  77. will be able to close the entire application (even though its main
  78. window is disabled) by right clicking on the taskbar icon and selecting
  79. the appropriate "Close" command from the context menu. To prevent this
  80. from happening you may want to use wxFRAME_TOOL_WINDOW, if applicable,
  81. or wxFRAME_NO_TASKBAR style when creating the window that will remain
  82. enabled.
  83. */
  84. wxWindowDisabler(wxWindow* winToSkip);
  85. /**
  86. Reenables the windows disabled by the constructor.
  87. */
  88. ~wxWindowDisabler();
  89. };
  90. /**
  91. @class wxBusyCursor
  92. This class makes it easy to tell your user that the program is temporarily
  93. busy. Just create a wxBusyCursor object on the stack, and within the
  94. current scope, the hourglass will be shown.
  95. For example:
  96. @code
  97. wxBusyCursor wait;
  98. for (int i = 0; i < 100000; i++)
  99. DoACalculation();
  100. @endcode
  101. It works by calling wxBeginBusyCursor() in the constructor, and
  102. wxEndBusyCursor() in the destructor.
  103. @library{wxcore}
  104. @category{misc}
  105. @see wxBeginBusyCursor(), wxEndBusyCursor(), wxWindowDisabler
  106. */
  107. class wxBusyCursor
  108. {
  109. public:
  110. /**
  111. Constructs a busy cursor object, calling wxBeginBusyCursor().
  112. */
  113. wxBusyCursor(const wxCursor* cursor = wxHOURGLASS_CURSOR);
  114. /**
  115. Destroys the busy cursor object, calling wxEndBusyCursor().
  116. */
  117. ~wxBusyCursor();
  118. };
  119. // ============================================================================
  120. // Global functions/macros
  121. // ============================================================================
  122. /** @addtogroup group_funcmacro_dialog */
  123. //@{
  124. /**
  125. Changes the cursor to the given cursor for all windows in the application.
  126. Use wxEndBusyCursor() to revert the cursor back to its previous state.
  127. These two calls can be nested, and a counter ensures that only the outer
  128. calls take effect.
  129. @see wxIsBusy(), wxBusyCursor
  130. @header{wx/utils.h}
  131. */
  132. void wxBeginBusyCursor(const wxCursor* cursor = wxHOURGLASS_CURSOR);
  133. /**
  134. Changes the cursor back to the original cursor, for all windows in the
  135. application. Use with wxBeginBusyCursor().
  136. @see wxIsBusy(), wxBusyCursor
  137. @header{wx/utils.h}
  138. */
  139. void wxEndBusyCursor();
  140. /**
  141. Returns @true if between two wxBeginBusyCursor() and wxEndBusyCursor()
  142. calls.
  143. @see wxBusyCursor.
  144. @header{wx/utils.h}
  145. */
  146. bool wxIsBusy();
  147. /**
  148. Ring the system bell.
  149. @note This function is categorized as a GUI one and so is not thread-safe.
  150. @header{wx/utils.h}
  151. @library{wxcore}
  152. */
  153. void wxBell();
  154. /**
  155. Shows a message box with the information about the wxWidgets build used,
  156. including its version, most important build parameters and the version of
  157. the underlying GUI toolkit. This is mainly used for diagnostic purposes
  158. and can be invoked by Ctrl-Alt-middle clicking on any wxWindow which
  159. doesn't otherwise handle this event.
  160. @since 2.9.0
  161. @see wxGetLibraryVersionInfo()
  162. @header{wx/utils.h}
  163. */
  164. void wxInfoMessageBox(wxWindow* parent);
  165. //@}
  166. /** @addtogroup group_funcmacro_version */
  167. //@{
  168. /**
  169. Get wxWidgets version information.
  170. @since 2.9.2
  171. @see wxVersionInfo
  172. @header{wx/utils.h}
  173. @library{wxcore}
  174. */
  175. wxVersionInfo wxGetLibraryVersionInfo();
  176. //@}
  177. /** @addtogroup group_funcmacro_env */
  178. //@{
  179. /**
  180. A map type containing environment variables names and values.
  181. This type is used with wxGetEnvMap() function and wxExecuteEnv structure
  182. optionally passed to wxExecute().
  183. @since 2.9.2
  184. @header{wx/utils.h}
  185. */
  186. typedef wxStringToStringHashMap wxEnvVariableHashMap;
  187. /**
  188. This is a macro defined as @c getenv() or its wide char version in Unicode
  189. mode.
  190. Note that under Win32 it may not return correct value for the variables set
  191. with wxSetEnv(), use wxGetEnv() function instead.
  192. @header{wx/utils.h}
  193. */
  194. wxChar* wxGetenv(const wxString& var);
  195. /**
  196. Returns the current value of the environment variable @a var in @a value.
  197. @a value may be @NULL if you just want to know if the variable exists and
  198. are not interested in its value.
  199. Returns @true if the variable exists, @false otherwise.
  200. @header{wx/utils.h}
  201. */
  202. bool wxGetEnv(const wxString& var, wxString* value);
  203. /**
  204. Sets the value of the environment variable @a var (adding it if necessary)
  205. to @a value.
  206. Notice that under Windows platforms the program may have two different
  207. environment blocks: the first one is that of a Windows process and is
  208. always present, but the CRT may maintain its own independent copy of the
  209. environment. wxSetEnv() will always update the first copy, which means that
  210. wxGetEnv(), which uses it directly, will always return the expected value
  211. after this call. But wxSetEnv() only updates the second copy for some
  212. compilers/CRT implementations (currently only MSVC and MinGW which uses the
  213. same MSVC CRT) and so using wxGetenv() (notice the difference in case) may
  214. not return the updated value.
  215. @param var
  216. The environment variable to be set, must not contain @c '=' character.
  217. @param value
  218. New value of the variable.
  219. @return
  220. @true on success or @false if changing the value failed.
  221. @see wxUnsetEnv()
  222. @header{wx/utils.h}
  223. */
  224. bool wxSetEnv(const wxString& var, const wxString& value);
  225. /**
  226. Removes the variable @a var from the environment.
  227. wxGetEnv() will return @NULL after the call to this function.
  228. Returns @true on success.
  229. @header{wx/utils.h}
  230. */
  231. bool wxUnsetEnv(const wxString& var);
  232. /**
  233. Fill a map with the complete content of current environment.
  234. The map will contain the environment variable names as keys and their
  235. values as values.
  236. @param map
  237. The environment map to fill, must be non-@NULL.
  238. @return
  239. @true if environment was successfully retrieved or @false otherwise.
  240. @header{wx/utils.h}
  241. @since 2.9.2
  242. */
  243. bool wxGetEnvMap(wxEnvVariableHashMap *map);
  244. //@}
  245. /** @addtogroup group_funcmacro_misc */
  246. //@{
  247. /**
  248. Returns battery state as one of @c wxBATTERY_NORMAL_STATE,
  249. @c wxBATTERY_LOW_STATE, @c wxBATTERY_CRITICAL_STATE,
  250. @c wxBATTERY_SHUTDOWN_STATE or @c wxBATTERY_UNKNOWN_STATE.
  251. @c wxBATTERY_UNKNOWN_STATE is also the default on platforms where this
  252. feature is not implemented (currently everywhere but MS Windows).
  253. @header{wx/utils.h}
  254. */
  255. wxBatteryState wxGetBatteryState();
  256. /**
  257. Returns the type of power source as one of @c wxPOWER_SOCKET,
  258. @c wxPOWER_BATTERY or @c wxPOWER_UNKNOWN. @c wxPOWER_UNKNOWN is also the
  259. default on platforms where this feature is not implemented (currently
  260. everywhere but MS Windows).
  261. @header{wx/utils.h}
  262. */
  263. wxPowerType wxGetPowerType();
  264. /**
  265. Under X only, returns the current display name.
  266. @see wxSetDisplayName()
  267. @header{wx/utils.h}
  268. */
  269. wxString wxGetDisplayName();
  270. /**
  271. For normal keys, returns @true if the specified key is currently down.
  272. For togglable keys (Caps Lock, Num Lock and Scroll Lock), returns @true if
  273. the key is toggled such that its LED indicator is lit. There is currently
  274. no way to test whether togglable keys are up or down.
  275. Even though there are virtual key codes defined for mouse buttons, they
  276. cannot be used with this function currently.
  277. @header{wx/utils.h}
  278. */
  279. bool wxGetKeyState(wxKeyCode key);
  280. /**
  281. Returns the mouse position in screen coordinates.
  282. @header{wx/utils.h}
  283. */
  284. wxPoint wxGetMousePosition();
  285. /**
  286. Returns the current state of the mouse. Returns a wxMouseState instance
  287. that contains the current position of the mouse pointer in screen
  288. coordinates, as well as boolean values indicating the up/down status of the
  289. mouse buttons and the modifier keys.
  290. @header{wx/utils.h}
  291. */
  292. wxMouseState wxGetMouseState();
  293. /**
  294. This function enables or disables all top level windows. It is used by
  295. wxSafeYield().
  296. @header{wx/utils.h}
  297. */
  298. void wxEnableTopLevelWindows(bool enable = true);
  299. /**
  300. Find the deepest window at the given mouse position in screen coordinates,
  301. returning the window if found, or @NULL if not.
  302. This function takes child windows at the given position into account even
  303. if they are disabled. The hidden children are however skipped by it.
  304. @header{wx/utils.h}
  305. */
  306. wxWindow* wxFindWindowAtPoint(const wxPoint& pt);
  307. /**
  308. @deprecated Replaced by wxWindow::FindWindowByLabel().
  309. Find a window by its label. Depending on the type of window, the label may
  310. be a window title or panel item label. If @a parent is @NULL, the search
  311. will start from all top-level frames and dialog boxes; if non-@NULL, the
  312. search will be limited to the given window hierarchy. The search is
  313. recursive in both cases.
  314. @header{wx/utils.h}
  315. */
  316. wxWindow* wxFindWindowByLabel(const wxString& label,
  317. wxWindow* parent = NULL);
  318. /**
  319. @deprecated Replaced by wxWindow::FindWindowByName().
  320. Find a window by its name (as given in a window constructor or @e Create
  321. function call). If @a parent is @NULL, the search will start from all
  322. top-level frames and dialog boxes; if non-@NULL, the search will be limited
  323. to the given window hierarchy. The search is recursive in both cases.
  324. If no such named window is found, wxFindWindowByLabel() is called.
  325. @header{wx/utils.h}
  326. */
  327. wxWindow* wxFindWindowByName(const wxString& name, wxWindow* parent = NULL);
  328. /**
  329. Find a menu item identifier associated with the given frame's menu bar.
  330. @header{wx/utils.h}
  331. */
  332. int wxFindMenuItemId(wxFrame* frame, const wxString& menuString,
  333. const wxString& itemString);
  334. /**
  335. @deprecated Ids generated by it can conflict with the Ids defined by the
  336. user code, use @c wxID_ANY to assign ids which are guaranteed
  337. to not conflict with the user-defined ids for the controls and
  338. menu items you create instead of using this function.
  339. Generates an integer identifier unique to this run of the program.
  340. @header{wx/utils.h}
  341. */
  342. int wxNewId();
  343. /**
  344. Ensures that Ids subsequently generated by wxNewId() do not clash with the
  345. given @a id.
  346. @header{wx/utils.h}
  347. */
  348. void wxRegisterId(int id);
  349. /**
  350. Opens the @a document in the application associated with the files of this
  351. type.
  352. The @a flags parameter is currently not used
  353. Returns @true if the application was successfully launched.
  354. @see wxLaunchDefaultBrowser(), wxExecute()
  355. @header{wx/utils.h}
  356. */
  357. bool wxLaunchDefaultApplication(const wxString& document, int flags = 0);
  358. /**
  359. Opens the @a url in user's default browser.
  360. If the @a flags parameter contains @c wxBROWSER_NEW_WINDOW flag, a new
  361. window is opened for the URL (currently this is only supported under
  362. Windows).
  363. And unless the @a flags parameter contains @c wxBROWSER_NOBUSYCURSOR flag,
  364. a busy cursor is shown while the browser is being launched (using
  365. wxBusyCursor).
  366. The parameter @a url is interpreted as follows:
  367. - if it has a valid scheme (e.g. @c "file:", @c "http:" or @c "mailto:")
  368. it is passed to the appropriate browser configured in the user system.
  369. - if it has no valid scheme (e.g. it's a local file path without the @c "file:"
  370. prefix), then ::wxFileExists and ::wxDirExists are used to test if it's a
  371. local file/directory; if it is, then the browser is called with the
  372. @a url parameter eventually prefixed by @c "file:".
  373. - if it has no valid scheme and it's not a local file/directory, then @c "http:"
  374. is prepended and the browser is called.
  375. Returns @true if the application was successfully launched.
  376. @note For some configurations of the running user, the application which is
  377. launched to open the given URL may be URL-dependent (e.g. a browser
  378. may be used for local URLs while another one may be used for remote
  379. URLs).
  380. @see wxLaunchDefaultApplication(), wxExecute()
  381. @header{wx/utils.h}
  382. */
  383. bool wxLaunchDefaultBrowser(const wxString& url, int flags = 0);
  384. /**
  385. Loads an object from Windows resource file.
  386. This function loads the resource with the given name and type from the
  387. resources embedded into a Windows application.
  388. The typical use for it is to load some data from the data files embedded
  389. into the program itself. For example, you could have the following fragment
  390. in your @c .rc file
  391. @code
  392. mydata MYDATA "myfile.dat"
  393. @endcode
  394. and then use it in the following way:
  395. @code
  396. const void* data = NULL;
  397. size_t size = 0;
  398. if ( !wxLoadUserResource(&data, &size, "mydata", "MYDATA") ) {
  399. ... handle error ...
  400. }
  401. else {
  402. // Use the data in any way, for example:
  403. wxMemoryInputStream is(data, size);
  404. ... read the data from stream ...
  405. }
  406. @endcode
  407. @param outData Filled with the pointer to the data on successful return.
  408. Notice that this pointer does @em not need to be freed by the caller.
  409. @param outLen Filled with the length of the data in bytes.
  410. @param resourceName The name of the resource to load.
  411. @param resourceType The type of the resource in usual Windows format, i.e.
  412. either a real string like "MYDATA" or an integer created by the
  413. standard Windows @c MAKEINTRESOURCE() macro, including any constants
  414. for the standard resources types like @c RT_RCDATA.
  415. @param module The @c HINSTANCE of the module to load the resources from.
  416. The current module is used by default.
  417. @return true if the data was loaded from resource or false if it couldn't
  418. be found (in which case no error is logged) or was found but couldn't
  419. be loaded (which is unexpected and does result in an error message).
  420. This function is available under Windows only.
  421. @library{wxbase}
  422. @header{wx/utils.h}
  423. @since 2.9.1
  424. */
  425. bool
  426. wxLoadUserResource(const void **outData,
  427. size_t *outLen,
  428. const wxString& resourceName,
  429. const wxChar* resourceType = "TEXT",
  430. WXHINSTANCE module = 0);
  431. /**
  432. Loads a user-defined Windows resource as a string.
  433. This is a wrapper for the general purpose overload wxLoadUserResource(const
  434. void**, size_t*, const wxString&, const wxChar*, WXHINSTANCE) and can be
  435. more convenient for the string data, but does an extra copy compared to the
  436. general version.
  437. @param resourceName The name of the resource to load.
  438. @param resourceType The type of the resource in usual Windows format, i.e.
  439. either a real string like "MYDATA" or an integer created by the
  440. standard Windows @c MAKEINTRESOURCE() macro, including any constants
  441. for the standard resources types like @c RT_RCDATA.
  442. @param pLen Filled with the length of the returned buffer if it is
  443. non-@NULL. This parameter should be used if NUL characters can occur in
  444. the resource data. It is new since wxWidgets 2.9.1
  445. @param module The @c HINSTANCE of the module to load the resources from.
  446. The current module is used by default. This parameter is new since
  447. wxWidgets 2.9.1.
  448. @return A pointer to the data to be <tt>delete[]</tt>d by caller on success
  449. or @NULL on error.
  450. This function is available under Windows only.
  451. @library{wxbase}
  452. @header{wx/utils.h}
  453. */
  454. char* wxLoadUserResource(const wxString& resourceName,
  455. const wxChar* resourceType = "TEXT",
  456. int* pLen = NULL,
  457. WXHINSTANCE module = 0);
  458. /**
  459. @deprecated Replaced by wxWindow::Close(). See the
  460. @ref overview_windowdeletion "window deletion overview".
  461. Tells the system to delete the specified object when all other events have
  462. been processed. In some environments, it is necessary to use this instead
  463. of deleting a frame directly with the delete operator, because some GUIs
  464. will still send events to a deleted window.
  465. @header{wx/utils.h}
  466. */
  467. void wxPostDelete(wxObject* object);
  468. /**
  469. Compare function type for use with wxQsort()
  470. @header{wx/utils.h}
  471. */
  472. typedef int (*wxSortCallback)(const void* pItem1, const void* pItem2, const void* user_data);
  473. /**
  474. Function implementing quick sort algorithm.
  475. This function sorts @a total_elems objects of size @a size located at @a
  476. pbase. It uses @a cmp function for comparing them and passes @a user_data
  477. pointer to the comparison function each time it's called.
  478. @header{wx/utils.h}
  479. */
  480. void wxQsort(void* pbase, size_t total_elems,
  481. size_t size, wxSortCallback cmp, const void* user_data);
  482. /**
  483. Under X only, sets the current display name. This is the X host and display
  484. name such as "colonsay:0.0", and the function indicates which display
  485. should be used for creating windows from this point on. Setting the display
  486. within an application allows multiple displays to be used.
  487. @see wxGetDisplayName()
  488. @header{wx/utils.h}
  489. */
  490. void wxSetDisplayName(const wxString& displayName);
  491. /**
  492. flags for wxStripMenuCodes
  493. */
  494. enum
  495. {
  496. // strip '&' characters
  497. wxStrip_Mnemonics = 1,
  498. // strip everything after '\t'
  499. wxStrip_Accel = 2,
  500. // strip everything (this is the default)
  501. wxStrip_All = wxStrip_Mnemonics | wxStrip_Accel
  502. };
  503. /**
  504. Strips any menu codes from @a str and returns the result.
  505. By default, the functions strips both the mnemonics character (@c '&')
  506. which is used to indicate a keyboard shortkey, and the accelerators, which
  507. are used only in the menu items and are separated from the main text by the
  508. @c \\t (TAB) character. By using @a flags of @c wxStrip_Mnemonics or
  509. @c wxStrip_Accel to strip only the former or the latter part, respectively.
  510. Notice that in most cases wxMenuItem::GetLabelFromText() or
  511. wxControl::GetLabelText() can be used instead.
  512. @header{wx/utils.h}
  513. */
  514. wxString wxStripMenuCodes(const wxString& str, int flags = wxStrip_All);
  515. //@}
  516. /** @addtogroup group_funcmacro_networkuseros */
  517. //@{
  518. /**
  519. Copies the user's email address into the supplied buffer, by concatenating
  520. the values returned by wxGetFullHostName() and wxGetUserId().
  521. @return @true if successful, @false otherwise.
  522. @header{wx/utils.h}
  523. */
  524. wxString wxGetEmailAddress();
  525. /**
  526. @deprecated Use wxGetEmailAddress() instead.
  527. @param buf Buffer to store the email address in.
  528. @param sz Size of the buffer.
  529. @return @true if successful, @false otherwise.
  530. @header{wx/utils.h}
  531. */
  532. bool wxGetEmailAddress(char* buf, int sz);
  533. /**
  534. Returns the amount of free memory in bytes under environments which support
  535. it, and -1 if not supported or failed to perform measurement.
  536. @header{wx/utils.h}
  537. */
  538. wxMemorySize wxGetFreeMemory();
  539. /**
  540. Return the (current) user's home directory.
  541. @see wxGetUserHome(), wxStandardPaths
  542. @header{wx/utils.h}
  543. */
  544. wxString wxGetHomeDir();
  545. /**
  546. Copies the current host machine's name into the supplied buffer. Please
  547. note that the returned name is @e not fully qualified, i.e. it does not
  548. include the domain name.
  549. Under Windows or NT, this function first looks in the environment variable
  550. SYSTEM_NAME; if this is not found, the entry @b HostName in the wxWidgets
  551. section of the WIN.INI file is tried.
  552. @return The hostname if successful or an empty string otherwise.
  553. @see wxGetFullHostName()
  554. @header{wx/utils.h}
  555. */
  556. wxString wxGetHostName();
  557. /**
  558. @deprecated Use wxGetHostName() instead.
  559. @param buf Buffer to store the host name in.
  560. @param sz Size of the buffer.
  561. @return @true if successful, @false otherwise.
  562. @header{wx/utils.h}
  563. */
  564. bool wxGetHostName(char* buf, int sz);
  565. /**
  566. Returns the FQDN (fully qualified domain host name) or an empty string on
  567. error.
  568. @see wxGetHostName()
  569. @header{wx/utils.h}
  570. */
  571. wxString wxGetFullHostName();
  572. /**
  573. Returns the home directory for the given user. If the @a user is empty
  574. (default value), this function behaves like wxGetHomeDir() (i.e. returns
  575. the current user home directory).
  576. If the home directory couldn't be determined, an empty string is returned.
  577. @header{wx/utils.h}
  578. */
  579. wxString wxGetUserHome(const wxString& user = wxEmptyString);
  580. /**
  581. This function returns the "user id" also known as "login name" under Unix
  582. (i.e. something like "jsmith"). It uniquely identifies the current user (on
  583. this system). Under Windows or NT, this function first looks in the
  584. environment variables USER and LOGNAME; if neither of these is found, the
  585. entry @b UserId in the @b wxWidgets section of the WIN.INI file is tried.
  586. @return The login name if successful or an empty string otherwise.
  587. @see wxGetUserName()
  588. @header{wx/utils.h}
  589. */
  590. wxString wxGetUserId();
  591. /**
  592. @deprecated Use wxGetUserId() instead.
  593. @param buf Buffer to store the login name in.
  594. @param sz Size of the buffer.
  595. @return @true if successful, @false otherwise.
  596. @header{wx/utils.h}
  597. */
  598. bool wxGetUserId(char* buf, int sz);
  599. /**
  600. This function returns the full user name (something like "Mr. John Smith").
  601. Under Windows or NT, this function looks for the entry UserName in the
  602. wxWidgets section of the WIN.INI file. If PenWindows is running, the entry
  603. Current in the section User of the PENWIN.INI file is used.
  604. @return The full user name if successful or an empty string otherwise.
  605. @see wxGetUserId()
  606. @header{wx/utils.h}
  607. */
  608. wxString wxGetUserName();
  609. /**
  610. @deprecated Use wxGetUserName() instead.
  611. @param buf Buffer to store the full user name in.
  612. @param sz Size of the buffer.
  613. @return @true if successful, @false otherwise.
  614. @header{wx/utils.h}
  615. */
  616. bool wxGetUserName(char* buf, int sz);
  617. /**
  618. Returns the string containing the description of the current platform in a
  619. user-readable form. For example, this function may return strings like
  620. "Windows NT Version 4.0" or "Linux 2.2.2 i386".
  621. @see wxGetOsVersion()
  622. @header{wx/utils.h}
  623. */
  624. wxString wxGetOsDescription();
  625. /**
  626. Gets the version and the operating system ID for currently running OS.
  627. The returned wxOperatingSystemId value can be used for a basic categorization
  628. of the OS family; the major and minor version numbers allows to detect a specific
  629. system.
  630. For Unix-like systems (@c wxOS_UNIX) the major and minor version integers will
  631. contain the kernel major and minor version numbers (as returned by the
  632. 'uname -r' command); e.g. "2" and "6" if the machine is using kernel 2.6.19.
  633. For Mac OS X systems (@c wxOS_MAC) the major and minor version integers are the
  634. natural version numbers associated with the OS; e.g. "10" and "6" if the machine
  635. is using Mac OS X Snow Leopard.
  636. For Windows-like systems (@c wxOS_WINDOWS) the major and minor version integers will
  637. contain the following values:
  638. @beginTable
  639. @row3col{<b>Windows OS name</b>, <b>Major version</b>, <b>Minor version</b>}
  640. @row3col{Windows 7, 6, 1}
  641. @row3col{Windows Server 2008 R2, 6, 1}
  642. @row3col{Windows Server 2008, 6, 0}
  643. @row3col{Windows Vista, 6, 0}
  644. @row3col{Windows Server 2003 R2, 5, 2}
  645. @row3col{Windows Server 2003, 5, 2}
  646. @row3col{Windows XP, 5, 1}
  647. @row3col{Windows 2000, 5, 0}
  648. @endDefList
  649. See the <a href="http://msdn.microsoft.com/en-us/library/ms724832(VS.85).aspx">MSDN</a>
  650. for more info about the values above.
  651. @see wxGetOsDescription(), wxPlatformInfo
  652. @header{wx/utils.h}
  653. */
  654. wxOperatingSystemId wxGetOsVersion(int* major = NULL, int* minor = NULL);
  655. /**
  656. Returns @true if the operating system the program is running under is 64
  657. bit. The check is performed at run-time and may differ from the value
  658. available at compile-time (at compile-time you can just check if
  659. <tt>sizeof(void*) == 8</tt>) since the program could be running in
  660. emulation mode or in a mixed 32/64 bit system (bi-architecture operating
  661. system).
  662. @note This function is not 100% reliable on some systems given the fact
  663. that there isn't always a standard way to do a reliable check on the
  664. OS architecture.
  665. @header{wx/utils.h}
  666. */
  667. bool wxIsPlatform64Bit();
  668. /**
  669. Returns @true if the current platform is little endian (instead of big
  670. endian). The check is performed at run-time.
  671. @see @ref group_funcmacro_byteorder "Byte Order Functions and Macros"
  672. @header{wx/utils.h}
  673. */
  674. bool wxIsPlatformLittleEndian();
  675. /**
  676. Returns a structure containing information about the currently running
  677. Linux distribution.
  678. This function uses the @c lsb_release utility which is part of the
  679. <tt>Linux Standard Base Core</tt> specification
  680. (see http://refspecs.linux-foundation.org/lsb.shtml) since the very first LSB
  681. release 1.0 (released in 2001).
  682. The @c lsb_release utility is very common on modern Linux distributions but in
  683. case it's not available, then this function will return a ::wxLinuxDistributionInfo
  684. structure containing empty strings.
  685. This function is Linux-specific and is only available when the @c __LINUX__
  686. symbol is defined.
  687. */
  688. wxLinuxDistributionInfo wxGetLinuxDistributionInfo();
  689. //@}
  690. /** @addtogroup group_funcmacro_procctrl */
  691. //@{
  692. /**
  693. @struct wxExecuteEnv
  694. This structure can optionally be passed to wxExecute() to specify
  695. additional options to use for the child process.
  696. @since 2.9.2
  697. @header{wx/utils.h}
  698. */
  699. struct wxExecuteEnv
  700. {
  701. /**
  702. The initial working directory for the new process.
  703. If this field is empty, the current working directory of this process
  704. is used.
  705. */
  706. wxString cwd;
  707. /**
  708. The environment variable map.
  709. If the map is empty, the environment variables of the current process
  710. are also used for the child one, otherwise only the variables defined
  711. in this map are used.
  712. */
  713. wxEnvVariableHashMap env;
  714. };
  715. /**
  716. Bit flags that can be used with wxExecute().
  717. */
  718. enum
  719. {
  720. /**
  721. Execute the process asynchronously.
  722. Notice that, due to its value, this is the default.
  723. */
  724. wxEXEC_ASYNC = 0,
  725. /**
  726. Execute the process synchronously.
  727. */
  728. wxEXEC_SYNC = 1,
  729. /**
  730. Always show the child process console under MSW.
  731. The child console is hidden by default if the child IO is redirected,
  732. this flag allows to change this and show it nevertheless.
  733. This flag is ignored under the other platforms.
  734. */
  735. wxEXEC_SHOW_CONSOLE = 2,
  736. /**
  737. Make the new process a group leader.
  738. Under Unix, if the process is the group leader then passing
  739. wxKILL_CHILDREN to wxKill() kills all children as well as pid.
  740. Under MSW, applies only to console applications and is only supported
  741. under NT family (i.e. not under Windows 9x). It corresponds to the
  742. native @c CREATE_NEW_PROCESS_GROUP and, in particular, ensures that
  743. Ctrl-Break signals will be sent to all children of this process as well
  744. to the process itself. Support for this flag under MSW was added in
  745. version 2.9.4 of wxWidgets.
  746. */
  747. wxEXEC_MAKE_GROUP_LEADER = 4,
  748. /**
  749. Don't disable the program UI while running the child synchronously.
  750. By default synchronous execution disables all program windows to avoid
  751. that the user interacts with the program while the child process is
  752. running, you can use this flag to prevent this from happening.
  753. This flag can only be used with ::wxEXEC_SYNC.
  754. */
  755. wxEXEC_NODISABLE = 8,
  756. /**
  757. Don't dispatch events while the child process is executed.
  758. By default, the event loop is run while waiting for synchronous
  759. execution to complete and this flag can be used to simply block the
  760. main process until the child process finishes
  761. This flag can only be used with ::wxEXEC_SYNC.
  762. */
  763. wxEXEC_NOEVENTS = 16,
  764. /**
  765. Hide child process console under MSW.
  766. Under MSW, hide the console of the child process if it has one,
  767. even if its IO is not redirected.
  768. This flag is ignored under the other platforms.
  769. */
  770. wxEXEC_HIDE_CONSOLE = 32,
  771. /**
  772. Convenient synonym for flags given system()-like behaviour.
  773. */
  774. wxEXEC_BLOCK = wxEXEC_SYNC | wxEXEC_NOEVENTS
  775. };
  776. /**
  777. Executes another program in Unix or Windows.
  778. In the overloaded versions of this function, if @a flags parameter contains
  779. @c wxEXEC_ASYNC flag (the default), flow of control immediately returns. If
  780. it contains @c wxEXEC_SYNC, the current application waits until the other
  781. program has terminated.
  782. In the case of synchronous execution, the return value is the exit code of
  783. the process (which terminates by the moment the function returns) and will
  784. be -1 if the process couldn't be started and typically 0 if the process
  785. terminated successfully. Also, while waiting for the process to terminate,
  786. wxExecute() will call wxYield(). Because of this, by default this function
  787. disables all application windows to avoid unexpected reentrancies which
  788. could result from the users interaction with the program while the child
  789. process is running. If you are sure that it is safe to not disable the
  790. program windows, you may pass @c wxEXEC_NODISABLE flag to prevent this
  791. automatic disabling from happening.
  792. For asynchronous execution, however, the return value is the process id and
  793. zero value indicates that the command could not be executed. As an added
  794. complication, the return value of -1 in this case indicates that we didn't
  795. launch a new process, but connected to the running one (this can only
  796. happen when using DDE under Windows for command execution). In particular,
  797. in this case only, the calling code will not get the notification about
  798. process termination.
  799. If @a callback isn't @NULL and if execution is asynchronous,
  800. wxProcess::OnTerminate() will be called when the process finishes.
  801. Specifying this parameter also allows you to redirect the standard input
  802. and/or output of the process being launched by calling
  803. wxProcess::Redirect().
  804. Under Windows, when launching a console process its console is shown by
  805. default but hidden if its IO is redirected. Both of these default
  806. behaviours may be overridden: if ::wxEXEC_HIDE_CONSOLE is specified, the
  807. console will never be shown. If ::wxEXEC_SHOW_CONSOLE is used, the console
  808. will be shown even if the child process IO is redirected. Neither of these
  809. flags affect non-console Windows applications or does anything under the
  810. other systems.
  811. Under Unix the flag @c wxEXEC_MAKE_GROUP_LEADER may be used to ensure that
  812. the new process is a group leader (this will create a new session if
  813. needed). Calling wxKill() passing wxKILL_CHILDREN will kill this process as
  814. well as all of its children (except those which have started their own
  815. session). Under MSW, this flag can be used with console processes only and
  816. corresponds to the native @c CREATE_NEW_PROCESS_GROUP flag.
  817. The @c wxEXEC_NOEVENTS flag prevents processing of any events from taking
  818. place while the child process is running. It should be only used for very
  819. short-lived processes as otherwise the application windows risk becoming
  820. unresponsive from the users point of view. As this flag only makes sense
  821. with @c wxEXEC_SYNC, @c wxEXEC_BLOCK equal to the sum of both of these
  822. flags is provided as a convenience.
  823. @note Currently wxExecute() can only be used from the main thread, calling
  824. this function from another thread will result in an assert failure in
  825. debug build and won't work.
  826. @param command
  827. The command to execute and any parameters to pass to it as a single
  828. string, i.e. "emacs file.txt".
  829. @param flags
  830. Must include either wxEXEC_ASYNC or wxEXEC_SYNC and can also include
  831. wxEXEC_SHOW_CONSOLE, wxEXEC_HIDE_CONSOLE, wxEXEC_MAKE_GROUP_LEADER (in
  832. either case) or wxEXEC_NODISABLE and wxEXEC_NOEVENTS or wxEXEC_BLOCK,
  833. which is equal to their combination, in wxEXEC_SYNC case.
  834. @param callback
  835. An optional pointer to wxProcess.
  836. @param env
  837. An optional pointer to additional parameters for the child process,
  838. such as its initial working directory and environment variables. This
  839. parameter is available in wxWidgets 2.9.2 and later only.
  840. @see wxShell(), wxProcess, @ref page_samples_exec,
  841. wxLaunchDefaultApplication(), wxLaunchDefaultBrowser()
  842. @header{wx/utils.h}
  843. @beginWxPerlOnly
  844. In wxPerl this function is called @c Wx::ExecuteCommand.
  845. @endWxPerlOnly
  846. */
  847. long wxExecute(const wxString& command, int flags = wxEXEC_ASYNC,
  848. wxProcess* callback = NULL,
  849. const wxExecuteEnv* env = NULL);
  850. //@}
  851. /** @addtogroup group_funcmacro_procctrl */
  852. //@{
  853. /**
  854. This is an overloaded version of wxExecute(const wxString&,int,wxProcess*),
  855. please see its documentation for general information.
  856. This version takes an array of values: a command, any number of arguments,
  857. terminated by @NULL.
  858. @param argv
  859. The command to execute should be the first element of this array, any
  860. additional ones are the command parameters and the array must be
  861. terminated with a @NULL pointer.
  862. @param flags
  863. Same as for wxExecute(const wxString&,int,wxProcess*) overload.
  864. @param callback
  865. An optional pointer to wxProcess.
  866. @param env
  867. An optional pointer to additional parameters for the child process,
  868. such as its initial working directory and environment variables. This
  869. parameter is available in wxWidgets 2.9.2 and later only.
  870. @see wxShell(), wxProcess, @ref page_samples_exec,
  871. wxLaunchDefaultApplication(), wxLaunchDefaultBrowser()
  872. @header{wx/utils.h}
  873. @beginWxPerlOnly
  874. In wxPerl this function is called @c Wx::ExecuteArgs.
  875. @endWxPerlOnly
  876. */
  877. long wxExecute(char** argv, int flags = wxEXEC_ASYNC,
  878. wxProcess* callback = NULL,
  879. const wxExecuteEnv *env = NULL);
  880. long wxExecute(wchar_t** argv, int flags = wxEXEC_ASYNC,
  881. wxProcess* callback = NULL,
  882. const wxExecuteEnv *env = NULL);
  883. //@}
  884. /** @addtogroup group_funcmacro_procctrl */
  885. //@{
  886. /**
  887. This is an overloaded version of wxExecute(const wxString&,int,wxProcess*),
  888. please see its documentation for general information.
  889. This version can be used to execute a process (always synchronously, the
  890. contents of @a flags is or'd with @c wxEXEC_SYNC) and capture its output in
  891. the array @e output.
  892. @param command
  893. The command to execute and any parameters to pass to it as a single
  894. string.
  895. @param output
  896. The string array where the stdout of the executed process is saved.
  897. @param flags
  898. Combination of flags to which ::wxEXEC_SYNC is always implicitly added.
  899. @param env
  900. An optional pointer to additional parameters for the child process,
  901. such as its initial working directory and environment variables. This
  902. parameter is available in wxWidgets 2.9.2 and later only.
  903. @see wxShell(), wxProcess, @ref page_samples_exec,
  904. wxLaunchDefaultApplication(), wxLaunchDefaultBrowser()
  905. @header{wx/utils.h}
  906. @beginWxPerlOnly
  907. This function is called @c Wx::ExecuteStdout: it only takes the
  908. @a command argument, and returns a 2-element list (@c status, @c output),
  909. where @c output in an array reference.
  910. @endWxPerlOnly
  911. */
  912. long wxExecute(const wxString& command, wxArrayString& output, int flags = 0,
  913. const wxExecuteEnv *env = NULL);
  914. /**
  915. This is an overloaded version of wxExecute(const wxString&,int,wxProcess*),
  916. please see its documentation for general information.
  917. This version adds the possibility to additionally capture the messages from
  918. standard error output in the @a errors array. As with the above overload
  919. capturing standard output only, execution is always synchronous.
  920. @param command
  921. The command to execute and any parameters to pass to it as a single
  922. string.
  923. @param output
  924. The string array where the stdout of the executed process is saved.
  925. @param errors
  926. The string array where the stderr of the executed process is saved.
  927. @param flags
  928. Combination of flags to which ::wxEXEC_SYNC is always implicitly added.
  929. @param env
  930. An optional pointer to additional parameters for the child process,
  931. such as its initial working directory and environment variables. This
  932. parameter is available in wxWidgets 2.9.2 and later only.
  933. @see wxShell(), wxProcess, @ref page_samples_exec,
  934. wxLaunchDefaultApplication(), wxLaunchDefaultBrowser()
  935. @header{wx/utils.h}
  936. @beginWxPerlOnly
  937. This function is called @c Wx::ExecuteStdoutStderr: it only takes the
  938. @a command argument, and returns a 3-element list (@c status, @c output,
  939. @c errors), where @c output and @c errors are array references.
  940. @endWxPerlOnly
  941. */
  942. long wxExecute(const wxString& command, wxArrayString& output,
  943. wxArrayString& errors, int flags = 0,
  944. const wxExecuteEnv *env = NULL);
  945. /**
  946. Returns the number uniquely identifying the current process in the system.
  947. If an error occurs, 0 is returned.
  948. @header{wx/utils.h}
  949. */
  950. unsigned long wxGetProcessId();
  951. /**
  952. Equivalent to the Unix kill function: send the given signal @a sig to the
  953. process with PID @a pid.
  954. The valid signal values are:
  955. @code
  956. enum wxSignal
  957. {
  958. wxSIGNONE = 0, // verify if the process exists under Unix
  959. wxSIGHUP,
  960. wxSIGINT,
  961. wxSIGQUIT,
  962. wxSIGILL,
  963. wxSIGTRAP,
  964. wxSIGABRT,
  965. wxSIGEMT,
  966. wxSIGFPE,
  967. wxSIGKILL, // forcefully kill, dangerous!
  968. wxSIGBUS,
  969. wxSIGSEGV,
  970. wxSIGSYS,
  971. wxSIGPIPE,
  972. wxSIGALRM,
  973. wxSIGTERM // terminate the process gently
  974. };
  975. @endcode
  976. @c wxSIGNONE, @c wxSIGKILL and @c wxSIGTERM have the same meaning under
  977. both Unix and Windows but all the other signals are equivalent to
  978. @c wxSIGTERM under Windows. Moreover, under Windows, @c wxSIGTERM is
  979. implemented by posting a message to the application window, so it only
  980. works if the application does have windows. If it doesn't, as is notably
  981. always the case for the console applications, you need to use @c wxSIGKILL
  982. to actually kill the process. Of course, this doesn't allow the process to
  983. shut down gracefully and so should be avoided if possible.
  984. Returns 0 on success, -1 on failure. If the @a rc parameter is not @NULL,
  985. it will be filled with a value from the @c wxKillError enum:
  986. @code
  987. enum wxKillError
  988. {
  989. wxKILL_OK, // no error
  990. wxKILL_BAD_SIGNAL, // no such signal
  991. wxKILL_ACCESS_DENIED, // permission denied
  992. wxKILL_NO_PROCESS, // no such process
  993. wxKILL_ERROR // another, unspecified error
  994. };
  995. @endcode
  996. The @a flags parameter can be wxKILL_NOCHILDREN (the default), or
  997. wxKILL_CHILDREN, in which case the child processes of this process will be
  998. killed too. Note that under Unix, for wxKILL_CHILDREN to work you should
  999. have created the process by passing wxEXEC_MAKE_GROUP_LEADER to
  1000. wxExecute().
  1001. @see wxProcess::Kill(), wxProcess::Exists(), @ref page_samples_exec
  1002. @header{wx/utils.h}
  1003. */
  1004. int wxKill(long pid, wxSignal sig = wxSIGTERM,
  1005. wxKillError* rc = NULL, int flags = wxKILL_NOCHILDREN);
  1006. /**
  1007. Executes a command in an interactive shell window. If no command is
  1008. specified, then just the shell is spawned.
  1009. @see wxExecute(), @ref page_samples_exec
  1010. @header{wx/utils.h}
  1011. */
  1012. bool wxShell(const wxString& command = wxEmptyString);
  1013. /**
  1014. This function shuts down or reboots the computer depending on the value of
  1015. the @a flags.
  1016. @note Note that performing the shutdown requires the corresponding access
  1017. rights (superuser under Unix, SE_SHUTDOWN privilege under Windows NT)
  1018. and that this function is only implemented under Unix and MSW.
  1019. @param flags
  1020. One of @c wxSHUTDOWN_POWEROFF, @c wxSHUTDOWN_REBOOT or
  1021. @c wxSHUTDOWN_LOGOFF (currently implemented only for MSW) possibly
  1022. combined with @c wxSHUTDOWN_FORCE which forces shutdown under MSW by
  1023. forcefully terminating all the applications. As doing this can result
  1024. in a data loss, this flag shouldn't be used unless really necessary.
  1025. @return @true on success, @false if an error occurred.
  1026. @header{wx/utils.h}
  1027. */
  1028. bool wxShutdown(int flags = wxSHUTDOWN_POWEROFF);
  1029. //@}
  1030. /** @addtogroup group_funcmacro_time */
  1031. //@{
  1032. /**
  1033. Sleeps for the specified number of microseconds. The microsecond resolution
  1034. may not, in fact, be available on all platforms (currently only Unix
  1035. platforms with nanosleep(2) may provide it) in which case this is the same
  1036. as calling wxMilliSleep() with the argument of @e microseconds/1000.
  1037. @header{wx/utils.h}
  1038. */
  1039. void wxMicroSleep(unsigned long microseconds);
  1040. /**
  1041. Sleeps for the specified number of milliseconds. Notice that usage of this
  1042. function is encouraged instead of calling usleep(3) directly because the
  1043. standard @e usleep() function is not MT safe.
  1044. @header{wx/utils.h}
  1045. */
  1046. void wxMilliSleep(unsigned long milliseconds);
  1047. /**
  1048. Returns a string representing the current date and time.
  1049. @header{wx/utils.h}
  1050. */
  1051. wxString wxNow();
  1052. /**
  1053. Sleeps for the specified number of seconds.
  1054. @header{wx/utils.h}
  1055. */
  1056. void wxSleep(int secs);
  1057. /**
  1058. @deprecated This function is deprecated because its name is misleading:
  1059. notice that the argument is in milliseconds, not microseconds.
  1060. Please use either wxMilliSleep() or wxMicroSleep() depending on
  1061. the resolution you need.
  1062. Sleeps for the specified number of milliseconds.
  1063. @header{wx/utils.h}
  1064. */
  1065. void wxUsleep(unsigned long milliseconds);
  1066. //@}