busyinfo.h 2.0 KB

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