2008-03-08 08:52:38 -05:00
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
|
|
|
// Name: busyinfo.h
|
2008-03-10 11:24:38 -04:00
|
|
|
// Purpose: interface of wxBusyInfo
|
2008-03-08 08:52:38 -05:00
|
|
|
// Author: wxWidgets team
|
|
|
|
// RCS-ID: $Id$
|
|
|
|
// Licence: wxWindows license
|
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
|
|
|
/**
|
|
|
|
@class wxBusyInfo
|
|
|
|
@wxheader{busyinfo.h}
|
2008-03-08 09:43:31 -05:00
|
|
|
|
2008-03-08 08:52:38 -05:00
|
|
|
This class makes it easy to tell your user that the program is temporarily busy.
|
|
|
|
Just create a wxBusyInfo object on the stack, and within the current scope,
|
|
|
|
a message window will be shown.
|
2008-03-08 09:43:31 -05:00
|
|
|
|
2008-03-08 08:52:38 -05:00
|
|
|
For example:
|
2008-03-08 09:43:31 -05:00
|
|
|
|
2008-03-08 08:52:38 -05:00
|
|
|
@code
|
2008-03-16 20:47:38 -04:00
|
|
|
wxBusyInfo wait("Please wait, working...");
|
2008-03-08 09:43:31 -05:00
|
|
|
|
2008-03-16 20:47:38 -04:00
|
|
|
for (int i = 0; i < 100000; i++)
|
2008-03-08 08:52:38 -05:00
|
|
|
{
|
|
|
|
DoACalculation();
|
|
|
|
}
|
|
|
|
@endcode
|
2008-03-08 09:43:31 -05:00
|
|
|
|
2008-03-16 20:47:38 -04:00
|
|
|
It works by creating a window in the constructor, and deleting it
|
|
|
|
in the destructor.
|
2008-03-08 09:43:31 -05:00
|
|
|
|
2008-03-08 08:52:38 -05:00
|
|
|
You may also want to call wxTheApp-Yield() to refresh the window
|
|
|
|
periodically (in case it had been obscured by other windows, for
|
|
|
|
example) like this:
|
2008-03-08 09:43:31 -05:00
|
|
|
|
2008-03-08 08:52:38 -05:00
|
|
|
@code
|
2008-03-16 20:47:38 -04:00
|
|
|
wxWindowDisabler disableAll;
|
2008-03-08 09:43:31 -05:00
|
|
|
|
2008-03-08 08:52:38 -05:00
|
|
|
wxBusyInfo wait("Please wait, working...");
|
2008-03-08 09:43:31 -05:00
|
|
|
|
2008-03-16 20:47:38 -04:00
|
|
|
for (int i = 0; i < 100000; i++)
|
2008-03-08 08:52:38 -05:00
|
|
|
{
|
|
|
|
DoACalculation();
|
2008-03-08 09:43:31 -05:00
|
|
|
|
2008-03-08 08:52:38 -05:00
|
|
|
if ( !(i % 1000) )
|
|
|
|
wxTheApp-Yield();
|
|
|
|
}
|
|
|
|
@endcode
|
2008-03-08 09:43:31 -05:00
|
|
|
|
|
|
|
but take care to not cause undesirable reentrancies when doing it (see
|
2008-03-16 20:47:38 -04:00
|
|
|
wxApp::Yield for more details). The simplest way to do it is to use
|
|
|
|
wxWindowDisabler class as illustrated in the above example.
|
2008-03-08 09:43:31 -05:00
|
|
|
|
2008-03-08 08:52:38 -05:00
|
|
|
@library{wxcore}
|
2008-03-16 20:47:38 -04:00
|
|
|
@category{cmndlg}
|
2008-03-08 08:52:38 -05:00
|
|
|
*/
|
2008-03-08 09:43:31 -05:00
|
|
|
class wxBusyInfo
|
2008-03-08 08:52:38 -05:00
|
|
|
{
|
|
|
|
public:
|
|
|
|
/**
|
2008-03-16 20:47:38 -04:00
|
|
|
Constructs a busy info window as child of @a parent and displays @e msg in it.
|
|
|
|
|
|
|
|
@note If @a parent is not @NULL you must ensure that it is not
|
|
|
|
closed while the busy info is shown.
|
2008-03-08 08:52:38 -05:00
|
|
|
*/
|
2008-03-09 08:33:59 -04:00
|
|
|
wxBusyInfo(const wxString& msg, wxWindow* parent = NULL);
|
2008-03-08 08:52:38 -05:00
|
|
|
|
|
|
|
/**
|
|
|
|
Hides and closes the window containing the information text.
|
|
|
|
*/
|
2008-03-24 18:17:25 -04:00
|
|
|
virtual ~wxBusyInfo();
|
2008-03-08 08:52:38 -05:00
|
|
|
};
|
2008-03-10 11:24:38 -04:00
|
|
|
|