1 /////////////////////////////////////////////////////////////////////////////
2 // Name:        wx/gtk/app.h
3 // Purpose:     wxApp definition for wxGTK
4 // Author:      Robert Roebling
5 // Copyright:   (c) 1998 Robert Roebling, Julian Smart
6 // Licence:     wxWindows licence
7 /////////////////////////////////////////////////////////////////////////////
8 
9 #ifndef _WX_GTK_APP_H_
10 #define _WX_GTK_APP_H_
11 
12 //-----------------------------------------------------------------------------
13 // classes
14 //-----------------------------------------------------------------------------
15 
16 //-----------------------------------------------------------------------------
17 // wxApp
18 //-----------------------------------------------------------------------------
19 
20 class WXDLLIMPEXP_CORE wxApp: public wxAppBase
21 {
22 public:
23     wxApp();
24     virtual ~wxApp();
25 
26     /* override for altering the way wxGTK initializes the GUI
27      * (palette/visual/colorcube). under wxMSW, OnInitGui() does nothing by
28      * default. when overriding this method, the code in it is likely to be
29      * platform dependent, otherwise use OnInit(). */
30     virtual bool SetNativeTheme(const wxString& theme) wxOVERRIDE;
31     virtual bool OnInitGui() wxOVERRIDE;
32 
33     // override base class (pure) virtuals
34     virtual void WakeUpIdle() wxOVERRIDE;
35 
36     virtual bool Initialize(int& argc, wxChar **argv) wxOVERRIDE;
37     virtual void CleanUp() wxOVERRIDE;
38 
39     virtual void OnAssertFailure(const wxChar *file,
40                                  int line,
41                                  const wxChar *func,
42                                  const wxChar *cond,
43                                  const wxChar *msg) wxOVERRIDE;
44 
45     // GTK-specific methods
46     // -------------------
47 
48     // this can be overridden to return a specific visual to be used for GTK+
49     // instead of the default one (it's used by wxGLApp)
50     //
51     // must return XVisualInfo pointer (it is not freed by caller)
GetXVisualInfo()52     virtual void *GetXVisualInfo() { return NULL; }
53 
54     // Check if we're using a global menu. Currently this is only true when
55     // running under Ubuntu Unity and global menu is not disabled.
56     //
57     // This is mostly used in the implementation in order to work around
58     // various bugs arising due to this.
59     static bool GTKIsUsingGlobalMenu();
60 
61     // implementation only from now on
62     // -------------------------------
63 
64     // check for pending events, without interference from our idle source
65     bool EventsPending();
66     bool DoIdle();
67 
68 private:
69     // true if we're inside an assert modal dialog
70     bool m_isInAssert;
71 
72 #if wxUSE_THREADS
73     wxMutex m_idleMutex;
74 #endif
75     unsigned m_idleSourceId;
76 
77     wxDECLARE_DYNAMIC_CLASS(wxApp);
78 };
79 
80 #endif // _WX_GTK_APP_H_
81