2008-03-08 13:52:38 +00:00
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
|
|
|
// Name: busyinfo.h
|
2008-03-10 15:24:38 +00:00
|
|
|
// Purpose: interface of wxBusyInfo
|
2008-03-08 13:52:38 +00:00
|
|
|
// Author: wxWidgets team
|
|
|
|
// RCS-ID: $Id$
|
2010-07-13 13:29:13 +00:00
|
|
|
// Licence: wxWindows licence
|
2008-03-08 13:52:38 +00:00
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
|
|
|
/**
|
|
|
|
@class wxBusyInfo
|
2008-03-08 14:43:31 +00:00
|
|
|
|
2008-03-08 13:52:38 +00: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 14:43:31 +00:00
|
|
|
|
2008-03-08 13:52:38 +00:00
|
|
|
For example:
|
2008-03-08 14:43:31 +00:00
|
|
|
|
2008-03-08 13:52:38 +00:00
|
|
|
@code
|
2008-03-17 00:47:38 +00:00
|
|
|
wxBusyInfo wait("Please wait, working...");
|
2008-03-08 14:43:31 +00:00
|
|
|
|
2008-03-17 00:47:38 +00:00
|
|
|
for (int i = 0; i < 100000; i++)
|
2008-03-08 13:52:38 +00:00
|
|
|
{
|
|
|
|
DoACalculation();
|
|
|
|
}
|
|
|
|
@endcode
|
2008-03-08 14:43:31 +00:00
|
|
|
|
2008-03-17 00:47:38 +00:00
|
|
|
It works by creating a window in the constructor, and deleting it
|
|
|
|
in the destructor.
|
2008-03-08 14:43:31 +00:00
|
|
|
|
2009-01-29 23:52:47 +00:00
|
|
|
You may also want to call wxTheApp->Yield() to refresh the window
|
2008-03-08 13:52:38 +00:00
|
|
|
periodically (in case it had been obscured by other windows, for
|
|
|
|
example) like this:
|
2008-03-08 14:43:31 +00:00
|
|
|
|
2008-03-08 13:52:38 +00:00
|
|
|
@code
|
2008-03-17 00:47:38 +00:00
|
|
|
wxWindowDisabler disableAll;
|
2008-03-08 13:52:38 +00:00
|
|
|
wxBusyInfo wait("Please wait, working...");
|
2008-03-08 14:43:31 +00:00
|
|
|
|
2008-03-17 00:47:38 +00:00
|
|
|
for (int i = 0; i < 100000; i++)
|
2008-03-08 13:52:38 +00:00
|
|
|
{
|
|
|
|
DoACalculation();
|
2008-03-08 14:43:31 +00:00
|
|
|
|
2008-03-08 13:52:38 +00:00
|
|
|
if ( !(i % 1000) )
|
2008-12-12 15:41:22 +00:00
|
|
|
wxTheApp->Yield();
|
2008-03-08 13:52:38 +00:00
|
|
|
}
|
|
|
|
@endcode
|
2008-03-08 14:43:31 +00:00
|
|
|
|
|
|
|
but take care to not cause undesirable reentrancies when doing it (see
|
2008-03-17 00:47:38 +00: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 14:43:31 +00:00
|
|
|
|
2009-02-05 17:46:00 +00:00
|
|
|
Note that a wxBusyInfo is always built with the @c wxSTAY_ON_TOP window style
|
|
|
|
(see wxFrame window styles for more info).
|
|
|
|
|
2008-03-08 13:52:38 +00:00
|
|
|
@library{wxcore}
|
2008-03-17 00:47:38 +00:00
|
|
|
@category{cmndlg}
|
2008-03-08 13:52:38 +00:00
|
|
|
*/
|
2008-03-08 14:43:31 +00:00
|
|
|
class wxBusyInfo
|
2008-03-08 13:52:38 +00:00
|
|
|
{
|
|
|
|
public:
|
|
|
|
/**
|
2008-03-17 00:47:38 +00: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 13:52:38 +00:00
|
|
|
*/
|
2008-03-09 12:33:59 +00:00
|
|
|
wxBusyInfo(const wxString& msg, wxWindow* parent = NULL);
|
2008-03-08 13:52:38 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
Hides and closes the window containing the information text.
|
|
|
|
*/
|
2008-03-24 22:17:25 +00:00
|
|
|
virtual ~wxBusyInfo();
|
2008-03-08 13:52:38 +00:00
|
|
|
};
|
2008-03-10 15:24:38 +00:00
|
|
|
|