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