]>
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 | |
7c913512 | 11 | |
23324ae1 FM |
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. | |
7c913512 | 15 | |
23324ae1 | 16 | For example: |
7c913512 | 17 | |
23324ae1 | 18 | @code |
8024723d | 19 | wxBusyInfo wait("Please wait, working..."); |
7c913512 | 20 | |
8024723d | 21 | for (int i = 0; i < 100000; i++) |
23324ae1 FM |
22 | { |
23 | DoACalculation(); | |
24 | } | |
25 | @endcode | |
7c913512 | 26 | |
8024723d FM |
27 | It works by creating a window in the constructor, and deleting it |
28 | in the destructor. | |
7c913512 | 29 | |
de1ac181 | 30 | You may also want to call wxTheApp->Yield() to refresh the window |
23324ae1 FM |
31 | periodically (in case it had been obscured by other windows, for |
32 | example) like this: | |
7c913512 | 33 | |
23324ae1 | 34 | @code |
8024723d | 35 | wxWindowDisabler disableAll; |
23324ae1 | 36 | wxBusyInfo wait("Please wait, working..."); |
7c913512 | 37 | |
8024723d | 38 | for (int i = 0; i < 100000; i++) |
23324ae1 FM |
39 | { |
40 | DoACalculation(); | |
7c913512 | 41 | |
23324ae1 | 42 | if ( !(i % 1000) ) |
ea53cb4a | 43 | wxTheApp->Yield(); |
23324ae1 FM |
44 | } |
45 | @endcode | |
7c913512 FM |
46 | |
47 | but take care to not cause undesirable reentrancies when doing it (see | |
8024723d FM |
48 | wxApp::Yield for more details). The simplest way to do it is to use |
49 | wxWindowDisabler class as illustrated in the above example. | |
7c913512 | 50 | |
e1215210 FM |
51 | Note that a wxBusyInfo is always built with the @c wxSTAY_ON_TOP window style |
52 | (see wxFrame window styles for more info). | |
53 | ||
23324ae1 | 54 | @library{wxcore} |
8024723d | 55 | @category{cmndlg} |
23324ae1 | 56 | */ |
7c913512 | 57 | class wxBusyInfo |
23324ae1 FM |
58 | { |
59 | public: | |
60 | /** | |
8024723d FM |
61 | Constructs a busy info window as child of @a parent and displays @e msg in it. |
62 | ||
63 | @note If @a parent is not @NULL you must ensure that it is not | |
64 | closed while the busy info is shown. | |
23324ae1 | 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 | */ | |
d2aa927a | 71 | virtual ~wxBusyInfo(); |
23324ae1 | 72 | }; |
e54c96f1 | 73 |