]> git.saurik.com Git - wxWidgets.git/blame_incremental - interface/wx/busyinfo.h
Make storing non-trivial data in wxThreadSpecificInfo possible.
[wxWidgets.git] / interface / wx / busyinfo.h
... / ...
CommitLineData
1/////////////////////////////////////////////////////////////////////////////
2// Name: busyinfo.h
3// Purpose: interface of wxBusyInfo
4// Author: wxWidgets team
5// Licence: wxWindows licence
6/////////////////////////////////////////////////////////////////////////////
7
8/**
9 @class wxBusyInfo
10
11 This class makes it easy to tell your user that the program is temporarily busy.
12 Just create a wxBusyInfo object on the stack, and within the current scope,
13 a message window will be shown.
14
15 For example:
16
17 @code
18 wxBusyInfo wait("Please wait, working...");
19
20 for (int i = 0; i < 100000; i++)
21 {
22 DoACalculation();
23 }
24 @endcode
25
26 It works by creating a window in the constructor, and deleting it
27 in the destructor.
28
29 You may also want to call wxTheApp->Yield() to refresh the window
30 periodically (in case it had been obscured by other windows, for
31 example) like this:
32
33 @code
34 wxWindowDisabler disableAll;
35 wxBusyInfo wait("Please wait, working...");
36
37 for (int i = 0; i < 100000; i++)
38 {
39 DoACalculation();
40
41 if ( !(i % 1000) )
42 wxTheApp->Yield();
43 }
44 @endcode
45
46 but take care to not cause undesirable reentrancies when doing it (see
47 wxApp::Yield for more details). The simplest way to do it is to use
48 wxWindowDisabler class as illustrated in the above example.
49
50 Note that a wxBusyInfo is always built with the @c wxSTAY_ON_TOP window style
51 (see wxFrame window styles for more info).
52
53 @library{wxcore}
54 @category{cmndlg}
55*/
56class wxBusyInfo
57{
58public:
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