wupdlock.h 1.1 KB

123456789101112131415161718192021222324252627282930313233343536
  1. ///////////////////////////////////////////////////////////////////////////////
  2. // Name: wx/wupdlock.h
  3. // Purpose: wxWindowUpdateLocker prevents window redrawing
  4. // Author: Vadim Zeitlin
  5. // Created: 2006-03-06
  6. // Copyright: (c) 2006 Vadim Zeitlin <vadim@wxwindows.org>
  7. // Licence: wxWindows licence
  8. ///////////////////////////////////////////////////////////////////////////////
  9. #ifndef _WX_WUPDLOCK_H_
  10. #define _WX_WUPDLOCK_H_
  11. #include "wx/window.h"
  12. // ----------------------------------------------------------------------------
  13. // wxWindowUpdateLocker prevents updates to the window during its lifetime
  14. // ----------------------------------------------------------------------------
  15. class wxWindowUpdateLocker
  16. {
  17. public:
  18. // create an object preventing updates of the given window (which must have
  19. // a lifetime at least as great as ours)
  20. wxWindowUpdateLocker(wxWindow *win) : m_win(win) { win->Freeze(); }
  21. // dtor thaws the window to permit updates again
  22. ~wxWindowUpdateLocker() { m_win->Thaw(); }
  23. private:
  24. wxWindow *m_win;
  25. wxDECLARE_NO_COPY_CLASS(wxWindowUpdateLocker);
  26. };
  27. #endif // _WX_WUPDLOCK_H_