wupdlock.h 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. /////////////////////////////////////////////////////////////////////////////
  2. // Name: wupdlock.h
  3. // Purpose: interface of wxWindowUpdateLocker
  4. // Author: wxWidgets team
  5. // Licence: wxWindows licence
  6. /////////////////////////////////////////////////////////////////////////////
  7. /**
  8. @class wxWindowUpdateLocker
  9. This tiny class prevents redrawing of a wxWindow during its lifetime by using
  10. wxWindow::Freeze() and wxWindow::Thaw() methods.
  11. It is typically used for creating automatic objects to temporarily suppress
  12. window updates before a batch of operations is performed:
  13. @code
  14. void MyFrame::Foo()
  15. {
  16. m_text = new wxTextCtrl(this, ...);
  17. wxWindowUpdateLocker noUpdates(m_text);
  18. m_text-AppendText();
  19. ... many other operations with m_text...
  20. m_text-WriteText();
  21. }
  22. @endcode
  23. Using this class is easier and safer than calling wxWindow::Freeze() and
  24. wxWindow::Thaw() because you don't risk to forget calling the latter.
  25. @library{wxbase}
  26. @category{misc}
  27. */
  28. class wxWindowUpdateLocker
  29. {
  30. public:
  31. /**
  32. Creates an object preventing the updates of the specified @e win.
  33. The parameter must be non-@NULL and the window must exist for longer than
  34. wxWindowUpdateLocker object itself.
  35. */
  36. wxWindowUpdateLocker(wxWindow* win);
  37. /**
  38. Destructor reenables updates for the window this object is associated with.
  39. */
  40. ~wxWindowUpdateLocker();
  41. };