]>
Commit | Line | Data |
---|---|---|
23324ae1 FM |
1 | ///////////////////////////////////////////////////////////////////////////// |
2 | // Name: busyinfo.h | |
3 | // Purpose: documentation for wxBusyInfo class | |
4 | // Author: wxWidgets team | |
5 | // RCS-ID: $Id$ | |
6 | // Licence: wxWindows license | |
7 | ///////////////////////////////////////////////////////////////////////////// | |
8 | ||
9 | /** | |
10 | @class wxBusyInfo | |
11 | @wxheader{busyinfo.h} | |
12 | ||
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. | |
16 | ||
17 | For example: | |
18 | ||
19 | @code | |
20 | wxBusyInfo wait("Please wait, working..."); | |
21 | ||
22 | for (int i = 0; i 100000; i++) | |
23 | { | |
24 | DoACalculation(); | |
25 | } | |
26 | @endcode | |
27 | ||
28 | It works by creating a window in the constructor, | |
29 | and deleting it in the destructor. | |
30 | ||
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: | |
34 | ||
35 | @code | |
36 | wxWindowDisabler disableAll; | |
37 | ||
38 | wxBusyInfo wait("Please wait, working..."); | |
39 | ||
40 | for (int i = 0; i 100000; i++) | |
41 | { | |
42 | DoACalculation(); | |
43 | ||
44 | if ( !(i % 1000) ) | |
45 | wxTheApp-Yield(); | |
46 | } | |
47 | @endcode | |
48 | ||
49 | but take care to not cause undesirable reentrancies when doing it (see | |
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. | |
53 | ||
54 | @library{wxcore} | |
55 | @category{FIXME} | |
56 | */ | |
57 | class wxBusyInfo | |
58 | { | |
59 | public: | |
60 | /** | |
61 | Constructs a busy info window as child of @e parent and displays @e msg | |
62 | in it. | |
63 | ||
64 | @b NB: If @e parent is not @NULL you must ensure that it is not | |
65 | closed while the busy info is shown. | |
66 | */ | |
67 | wxBusyInfo(const wxString& msg, wxWindow* parent = @NULL); | |
68 | ||
69 | /** | |
70 | Hides and closes the window containing the information text. | |
71 | */ | |
72 | ~wxBusyInfo(); | |
73 | }; |