]>
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 | @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, and deleting it | |
29 | 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 it is to use | |
51 | wxWindowDisabler class as illustrated in the above example. | |
52 | ||
53 | @library{wxcore} | |
54 | @category{cmndlg} | |
55 | */ | |
56 | class wxBusyInfo | |
57 | { | |
58 | public: | |
59 | /** | |
60 | Constructs a busy info window as child of @a parent and displays @e msg in it. | |
61 | ||
62 | @note If @a parent is not @NULL you must ensure that it is not | |
63 | closed while the busy info is shown. | |
64 | */ | |
65 | wxBusyInfo(const wxString& msg, wxWindow* parent = NULL); | |
66 | ||
67 | /** | |
68 | Hides and closes the window containing the information text. | |
69 | */ | |
70 | virtual ~wxBusyInfo(); | |
71 | }; | |
72 |