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