]>
Commit | Line | Data |
---|---|---|
23324ae1 FM |
1 | ///////////////////////////////////////////////////////////////////////////// |
2 | // Name: busyinfo.h | |
e54c96f1 | 3 | // Purpose: interface of wxBusyInfo |
23324ae1 FM |
4 | // Author: wxWidgets team |
5 | // RCS-ID: $Id$ | |
6 | // Licence: wxWindows license | |
7 | ///////////////////////////////////////////////////////////////////////////// | |
8 | ||
9 | /** | |
10 | @class wxBusyInfo | |
11 | @wxheader{busyinfo.h} | |
7c913512 | 12 | |
23324ae1 FM |
13 | This class makes it easy to tell your user that the program is temporarily busy. |
14 | Just create a wxBusyInfo object on the stack, and within the current scope, | |
15 | a message window will be shown. | |
7c913512 | 16 | |
23324ae1 | 17 | For example: |
7c913512 | 18 | |
23324ae1 FM |
19 | @code |
20 | wxBusyInfo wait("Please wait, working..."); | |
7c913512 | 21 | |
23324ae1 FM |
22 | for (int i = 0; i 100000; i++) |
23 | { | |
24 | DoACalculation(); | |
25 | } | |
26 | @endcode | |
7c913512 | 27 | |
23324ae1 FM |
28 | It works by creating a window in the constructor, |
29 | and deleting it in the destructor. | |
7c913512 | 30 | |
23324ae1 FM |
31 | You may also want to call wxTheApp-Yield() to refresh the window |
32 | periodically (in case it had been obscured by other windows, for | |
33 | example) like this: | |
7c913512 | 34 | |
23324ae1 FM |
35 | @code |
36 | wxWindowDisabler disableAll; | |
7c913512 | 37 | |
23324ae1 | 38 | wxBusyInfo wait("Please wait, working..."); |
7c913512 | 39 | |
23324ae1 FM |
40 | for (int i = 0; i 100000; i++) |
41 | { | |
42 | DoACalculation(); | |
7c913512 | 43 | |
23324ae1 FM |
44 | if ( !(i % 1000) ) |
45 | wxTheApp-Yield(); | |
46 | } | |
47 | @endcode | |
7c913512 FM |
48 | |
49 | but take care to not cause undesirable reentrancies when doing it (see | |
23324ae1 FM |
50 | wxApp::Yield for more details). The simplest way to do |
51 | it is to use wxWindowDisabler class as illustrated | |
52 | in the above example. | |
7c913512 | 53 | |
23324ae1 FM |
54 | @library{wxcore} |
55 | @category{FIXME} | |
56 | */ | |
7c913512 | 57 | class wxBusyInfo |
23324ae1 FM |
58 | { |
59 | public: | |
60 | /** | |
4cc4bfaf | 61 | Constructs a busy info window as child of @a parent and displays @e msg |
23324ae1 | 62 | in it. |
4cc4bfaf | 63 | @b NB: If @a parent is not @NULL you must ensure that it is not |
23324ae1 FM |
64 | closed while the busy info is shown. |
65 | */ | |
4cc4bfaf | 66 | wxBusyInfo(const wxString& msg, wxWindow* parent = NULL); |
23324ae1 FM |
67 | |
68 | /** | |
69 | Hides and closes the window containing the information text. | |
70 | */ | |
71 | ~wxBusyInfo(); | |
72 | }; | |
e54c96f1 | 73 |