| 1 | ///////////////////////////////////////////////////////////////////////////// |
| 2 | // Name: app.h |
| 3 | // Purpose: wxApp class |
| 4 | // Author: Julian Smart |
| 5 | // Modified by: |
| 6 | // Created: 17/09/98 |
| 7 | // RCS-ID: $Id$ |
| 8 | // Copyright: (c) Julian Smart |
| 9 | // Licence: wxWindows licence |
| 10 | ///////////////////////////////////////////////////////////////////////////// |
| 11 | |
| 12 | #ifndef _WX_APP_H_ |
| 13 | #define _WX_APP_H_ |
| 14 | |
| 15 | #if defined(__GNUG__) && !defined(NO_GCC_PRAGMA) |
| 16 | #pragma interface "app.h" |
| 17 | #endif |
| 18 | |
| 19 | // ---------------------------------------------------------------------------- |
| 20 | // headers |
| 21 | // ---------------------------------------------------------------------------- |
| 22 | |
| 23 | #include "wx/gdicmn.h" |
| 24 | #include "wx/event.h" |
| 25 | |
| 26 | // ---------------------------------------------------------------------------- |
| 27 | // forward declarations |
| 28 | // ---------------------------------------------------------------------------- |
| 29 | |
| 30 | class WXDLLEXPORT wxFrame; |
| 31 | class WXDLLEXPORT wxWindow; |
| 32 | class WXDLLEXPORT wxApp; |
| 33 | class WXDLLEXPORT wxKeyEvent; |
| 34 | class WXDLLEXPORT wxLog; |
| 35 | class WXDLLEXPORT wxXVisualInfo; |
| 36 | |
| 37 | // ---------------------------------------------------------------------------- |
| 38 | // the wxApp class for wxX11 - see wxAppBase for more details |
| 39 | // ---------------------------------------------------------------------------- |
| 40 | |
| 41 | class WXDLLEXPORT wxApp : public wxAppBase |
| 42 | { |
| 43 | DECLARE_DYNAMIC_CLASS(wxApp) |
| 44 | |
| 45 | public: |
| 46 | wxApp(); |
| 47 | ~wxApp(); |
| 48 | |
| 49 | // override base class (pure) virtuals |
| 50 | // ----------------------------------- |
| 51 | |
| 52 | virtual void Exit(); |
| 53 | |
| 54 | virtual bool Yield(bool onlyIfNeeded = FALSE); |
| 55 | virtual void WakeUpIdle(); |
| 56 | |
| 57 | virtual bool OnInitGui(); |
| 58 | |
| 59 | // implementation from now on |
| 60 | // -------------------------- |
| 61 | |
| 62 | // Processes an X event. |
| 63 | virtual bool ProcessXEvent(WXEvent* event); |
| 64 | |
| 65 | #ifdef __WXDEBUG__ |
| 66 | virtual void OnAssert(const wxChar *file, int line, const wxChar* cond, const wxChar *msg); |
| 67 | #endif // __WXDEBUG__ |
| 68 | |
| 69 | protected: |
| 70 | bool m_showOnInit; |
| 71 | |
| 72 | public: |
| 73 | // Implementation |
| 74 | virtual bool Initialize(int& argc, wxChar **argv); |
| 75 | virtual void CleanUp(); |
| 76 | |
| 77 | WXWindow GetTopLevelWidget() const { return m_topLevelWidget; } |
| 78 | WXColormap GetMainColormap(WXDisplay* display); |
| 79 | long GetMaxRequestSize() const { return m_maxRequestSize; } |
| 80 | |
| 81 | // This handler is called when a property change event occurs |
| 82 | virtual bool HandlePropertyChange(WXEvent *event); |
| 83 | |
| 84 | // Values that can be passed on the command line. |
| 85 | // Returns -1, -1 if none specified. |
| 86 | const wxSize& GetInitialSize() const { return m_initialSize; } |
| 87 | bool GetShowIconic() const { return m_showIconic; } |
| 88 | |
| 89 | #if wxUSE_UNICODE |
| 90 | // Global context for Pango layout. Either use X11 |
| 91 | // or use Xft rendering according to GDK_USE_XFT |
| 92 | // environment variable |
| 93 | PangoContext* GetPangoContext(); |
| 94 | #endif |
| 95 | |
| 96 | wxXVisualInfo* GetVisualInfo(WXDisplay* display) |
| 97 | { |
| 98 | // this should be implemented correctly for wxBitmap to work |
| 99 | // with multiple display |
| 100 | return m_visualInfo; |
| 101 | } |
| 102 | |
| 103 | // We need this before creating the app |
| 104 | static WXDisplay* GetDisplay() { return ms_display; } |
| 105 | static WXDisplay* ms_display; |
| 106 | |
| 107 | public: |
| 108 | static long sm_lastMessageTime; |
| 109 | bool m_showIconic; |
| 110 | wxSize m_initialSize; |
| 111 | |
| 112 | #if !wxUSE_NANOX |
| 113 | wxXVisualInfo* m_visualInfo; |
| 114 | #endif |
| 115 | |
| 116 | protected: |
| 117 | bool m_keepGoing; |
| 118 | |
| 119 | WXWindow m_topLevelWidget; |
| 120 | WXColormap m_mainColormap; |
| 121 | long m_maxRequestSize; |
| 122 | |
| 123 | DECLARE_EVENT_TABLE() |
| 124 | }; |
| 125 | |
| 126 | #endif // _WX_APP_H_ |
| 127 | |