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