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 #if wxUSE_LIBHILDON || wxUSE_LIBHILDON2
17 typedef struct _HildonProgram HildonProgram;
18 #endif // wxUSE_LIBHILDON || wxUSE_LIBHILDON2
19 
20 //-----------------------------------------------------------------------------
21 // wxApp
22 //-----------------------------------------------------------------------------
23 
24 class WXDLLIMPEXP_CORE wxApp: public wxAppBase
25 {
26 public:
27     wxApp();
28     virtual ~wxApp();
29 
30     /* override for altering the way wxGTK initializes the GUI
31      * (palette/visual/colorcube). under wxMSW, OnInitGui() does nothing by
32      * default. when overriding this method, the code in it is likely to be
33      * platform dependent, otherwise use OnInit(). */
34     virtual bool SetNativeTheme(const wxString& theme);
35     virtual bool OnInitGui();
36 
37     // override base class (pure) virtuals
38     virtual void WakeUpIdle();
39 
40     virtual bool Initialize(int& argc, wxChar **argv);
41     virtual void CleanUp();
42 
43     virtual void OnAssertFailure(const wxChar *file,
44                                  int line,
45                                  const wxChar *func,
46                                  const wxChar *cond,
47                                  const wxChar *msg);
48 
49     // GTK-specific methods
50     // -------------------
51 
52     // this can be overridden to return a specific visual to be used for GTK+
53     // instead of the default one (it's used by wxGLApp)
54     //
55     // must return XVisualInfo pointer (it is not freed by caller)
GetXVisualInfo()56     virtual void *GetXVisualInfo() { return NULL; }
57 
58     // Check if we're using a global menu. Currently this is only true when
59     // running under Ubuntu Unity and global menu is not disabled.
60     //
61     // This is mostly used in the implementation in order to work around
62     // various bugs arising due to this.
63     static bool GTKIsUsingGlobalMenu();
64 
65 #if wxUSE_LIBHILDON || wxUSE_LIBHILDON2
66     // Maemo-specific method: get the main program object
67     HildonProgram *GetHildonProgram();
68 #endif // wxUSE_LIBHILDON || wxUSE_LIBHILDON2
69 
70     // implementation only from now on
71     // -------------------------------
72 
73     // check for pending events, without interference from our idle source
74     bool EventsPending();
75     bool DoIdle();
76 
77 private:
78     // true if we're inside an assert modal dialog
79     bool m_isInAssert;
80 
81 #if wxUSE_THREADS
82     wxMutex m_idleMutex;
83 #endif
84     unsigned m_idleSourceId;
85 
86 #if wxUSE_LIBHILDON || wxUSE_LIBHILDON2
87     HildonProgram *m_hildonProgram;
88 #endif // wxUSE_LIBHILDON || wxUSE_LIBHILDON2
89 
90     DECLARE_DYNAMIC_CLASS(wxApp)
91 };
92 
93 #endif // _WX_GTK_APP_H_
94