]>
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 | 19 | @code |
8024723d | 20 | wxBusyInfo wait("Please wait, working..."); |
7c913512 | 21 | |
8024723d | 22 | for (int i = 0; i < 100000; i++) |
23324ae1 FM |
23 | { |
24 | DoACalculation(); | |
25 | } | |
26 | @endcode | |
7c913512 | 27 | |
8024723d FM |
28 | It works by creating a window in the constructor, and deleting it |
29 | 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 | 35 | @code |
8024723d | 36 | wxWindowDisabler disableAll; |
7c913512 | 37 | |
23324ae1 | 38 | wxBusyInfo wait("Please wait, working..."); |
7c913512 | 39 | |
8024723d | 40 | for (int i = 0; i < 100000; i++) |
23324ae1 FM |
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 | |
8024723d FM |
50 | wxApp::Yield for more details). The simplest way to do it is to use |
51 | wxWindowDisabler class as illustrated in the above example. | |
7c913512 | 52 | |
23324ae1 | 53 | @library{wxcore} |
8024723d | 54 | @category{cmndlg} |
23324ae1 | 55 | */ |
7c913512 | 56 | class wxBusyInfo |
23324ae1 FM |
57 | { |
58 | public: | |
59 | /** | |
8024723d FM |
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. | |
23324ae1 | 64 | */ |
4cc4bfaf | 65 | wxBusyInfo(const wxString& msg, wxWindow* parent = NULL); |
23324ae1 FM |
66 | |
67 | /** | |
68 | Hides and closes the window containing the information text. | |
69 | */ | |
d2aa927a | 70 | virtual ~wxBusyInfo(); |
23324ae1 | 71 | }; |
e54c96f1 | 72 |