| 1 | ///////////////////////////////////////////////////////////////////////////// |
| 2 | // Name: wx/gtk/app.h |
| 3 | // Purpose: |
| 4 | // Author: Robert Roebling |
| 5 | // Id: $Id$ |
| 6 | // Copyright: (c) 1998 Robert Roebling, Julian Smart |
| 7 | // Licence: wxWindows licence |
| 8 | ///////////////////////////////////////////////////////////////////////////// |
| 9 | |
| 10 | #ifndef _WX_GTK_APP_H_ |
| 11 | #define _WX_GTK_APP_H_ |
| 12 | |
| 13 | //----------------------------------------------------------------------------- |
| 14 | // classes |
| 15 | //----------------------------------------------------------------------------- |
| 16 | |
| 17 | #if wxUSE_THREADS |
| 18 | class WXDLLIMPEXP_FWD_BASE wxMutex; |
| 19 | #endif |
| 20 | |
| 21 | #if wxUSE_LIBHILDON |
| 22 | typedef struct _HildonProgram HildonProgram; |
| 23 | #endif // wxUSE_LIBHILDON |
| 24 | |
| 25 | //----------------------------------------------------------------------------- |
| 26 | // wxApp |
| 27 | //----------------------------------------------------------------------------- |
| 28 | |
| 29 | class WXDLLIMPEXP_CORE wxApp: public wxAppBase |
| 30 | { |
| 31 | public: |
| 32 | wxApp(); |
| 33 | virtual ~wxApp(); |
| 34 | |
| 35 | /* override for altering the way wxGTK intializes the GUI |
| 36 | * (palette/visual/colorcube). under wxMSW, OnInitGui() does nothing by |
| 37 | * default. when overriding this method, the code in it is likely to be |
| 38 | * platform dependent, otherwise use OnInit(). */ |
| 39 | virtual bool OnInitGui(); |
| 40 | |
| 41 | // override base class (pure) virtuals |
| 42 | virtual bool Yield(bool onlyIfNeeded = FALSE); |
| 43 | virtual void WakeUpIdle(); |
| 44 | |
| 45 | virtual bool Initialize(int& argc, wxChar **argv); |
| 46 | virtual void CleanUp(); |
| 47 | |
| 48 | #ifdef __WXDEBUG__ |
| 49 | virtual void OnAssertFailure(const wxChar *file, |
| 50 | int line, |
| 51 | const wxChar *func, |
| 52 | const wxChar *cond, |
| 53 | const wxChar *msg); |
| 54 | #endif // __WXDEBUG__ |
| 55 | |
| 56 | // GTK-specific methods |
| 57 | // ------------------- |
| 58 | |
| 59 | // this can be overridden to return a specific visual to be used for GTK+ |
| 60 | // instead of the default one (it's used by wxGLApp) |
| 61 | // |
| 62 | // must return XVisualInfo pointer (it is not freed by caller) |
| 63 | virtual void *GetXVisualInfo() { return NULL; } |
| 64 | |
| 65 | #if wxUSE_LIBHILDON |
| 66 | // Maemo-specific method: get the main program object |
| 67 | HildonProgram *GetHildonProgram() const { return m_hildonProgram; } |
| 68 | #endif // wxUSE_LIBHILDON |
| 69 | |
| 70 | // implementation only from now on |
| 71 | // ------------------------------- |
| 72 | |
| 73 | // This returns the current visual: either that used by wxRootWindow |
| 74 | // or the XVisualInfo* for SGI. |
| 75 | GdkVisual *GetGdkVisual(); |
| 76 | |
| 77 | // check for pending events, without interference from our idle source |
| 78 | bool EventsPending(); |
| 79 | bool DoIdle(); |
| 80 | |
| 81 | private: |
| 82 | // true if we're inside an assert modal dialog |
| 83 | #ifdef __WXDEBUG__ |
| 84 | bool m_isInAssert; |
| 85 | #endif // __WXDEBUG__ |
| 86 | #if wxUSE_THREADS |
| 87 | wxMutex* m_idleMutex; |
| 88 | #endif |
| 89 | guint m_idleSourceId; |
| 90 | |
| 91 | #if wxUSE_LIBHILDON |
| 92 | HildonProgram *m_hildonProgram; |
| 93 | #endif // wxUSE_LIBHILDON |
| 94 | |
| 95 | DECLARE_DYNAMIC_CLASS(wxApp) |
| 96 | }; |
| 97 | |
| 98 | #endif // _WX_GTK_APP_H_ |