]> git.saurik.com Git - wxWidgets.git/blame - interface/wx/busyinfo.h
Make storing non-trivial data in wxThreadSpecificInfo possible.
[wxWidgets.git] / interface / wx / busyinfo.h
CommitLineData
23324ae1
FM
1/////////////////////////////////////////////////////////////////////////////
2// Name: busyinfo.h
e54c96f1 3// Purpose: interface of wxBusyInfo
23324ae1 4// Author: wxWidgets team
526954c5 5// Licence: wxWindows licence
23324ae1
FM
6/////////////////////////////////////////////////////////////////////////////
7
8/**
9 @class wxBusyInfo
7c913512 10
23324ae1
FM
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.
7c913512 14
23324ae1 15 For example:
7c913512 16
23324ae1 17 @code
8024723d 18 wxBusyInfo wait("Please wait, working...");
7c913512 19
8024723d 20 for (int i = 0; i < 100000; i++)
23324ae1
FM
21 {
22 DoACalculation();
23 }
24 @endcode
7c913512 25
8024723d
FM
26 It works by creating a window in the constructor, and deleting it
27 in the destructor.
7c913512 28
de1ac181 29 You may also want to call wxTheApp->Yield() to refresh the window
23324ae1
FM
30 periodically (in case it had been obscured by other windows, for
31 example) like this:
7c913512 32
23324ae1 33 @code
8024723d 34 wxWindowDisabler disableAll;
23324ae1 35 wxBusyInfo wait("Please wait, working...");
7c913512 36
8024723d 37 for (int i = 0; i < 100000; i++)
23324ae1
FM
38 {
39 DoACalculation();
7c913512 40
23324ae1 41 if ( !(i % 1000) )
ea53cb4a 42 wxTheApp->Yield();
23324ae1
FM
43 }
44 @endcode
7c913512
FM
45
46 but take care to not cause undesirable reentrancies when doing it (see
8024723d
FM
47 wxApp::Yield for more details). The simplest way to do it is to use
48 wxWindowDisabler class as illustrated in the above example.
7c913512 49
e1215210
FM
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
23324ae1 53 @library{wxcore}
8024723d 54 @category{cmndlg}
23324ae1 55*/
7c913512 56class wxBusyInfo
23324ae1
FM
57{
58public:
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