dialogcount.h 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. ///////////////////////////////////////////////////////////////////////////////
  2. // Name: wx/gtk/private/dialogcount.h
  3. // Purpose: Helper for temporarily changing wxOpenModalDialogsCount global.
  4. // Author: Vadim Zeitlin
  5. // Created: 2013-03-21
  6. // Copyright: (c) 2013 Vadim Zeitlin <vadim@wxwidgets.org>
  7. // Licence: wxWindows licence
  8. ///////////////////////////////////////////////////////////////////////////////
  9. #ifndef _WX_GTK_PRIVATE_DIALOGCOUNT_H_
  10. #define _WX_GTK_PRIVATE_DIALOGCOUNT_H_
  11. #include "wx/defs.h"
  12. // This global variable contains the number of currently opened modal dialogs.
  13. // When it is non null, the global menu used in Ubuntu Unity needs to be
  14. // explicitly disabled as this doesn't currently happen on its own due to a bug
  15. // in Unity, see https://bugs.launchpad.net/indicator-appmenu/+bug/674605
  16. //
  17. // For this to work, all modal dialogs must use wxOpenModalDialogLocker class
  18. // below to increment this variable while they are indeed being modally shown.
  19. //
  20. // This variable is defined in src/gtk/toplevel.cpp
  21. extern int wxOpenModalDialogsCount;
  22. // ----------------------------------------------------------------------------
  23. // wxOpenModalDialogLocker: Create an object of this class to increment
  24. // wxOpenModalDialogsCount during its lifetime.
  25. // ----------------------------------------------------------------------------
  26. class wxOpenModalDialogLocker
  27. {
  28. public:
  29. wxOpenModalDialogLocker()
  30. {
  31. wxOpenModalDialogsCount++;
  32. }
  33. ~wxOpenModalDialogLocker()
  34. {
  35. wxOpenModalDialogsCount--;
  36. }
  37. private:
  38. wxDECLARE_NO_COPY_CLASS(wxOpenModalDialogLocker);
  39. };
  40. #endif // _WX_GTK_PRIVATE_DIALOGCOUNT_H_