1 /////////////////////////////////////////////////////////////////////////////
3 // Purpose: wxApp class
4 // Author: Julian Smart
8 // Copyright: (c) Julian Smart
9 // Licence: wxWindows licence
10 /////////////////////////////////////////////////////////////////////////////
15 #if defined(__GNUG__) && !defined(__APPLE__)
16 #pragma interface "app.h"
19 // ----------------------------------------------------------------------------
21 // ----------------------------------------------------------------------------
23 #include "wx/gdicmn.h"
26 // ----------------------------------------------------------------------------
27 // forward declarations
28 // ----------------------------------------------------------------------------
30 class WXDLLEXPORT wxFrame
;
31 class WXDLLEXPORT wxWindow
;
32 class WXDLLEXPORT wxApp
;
33 class WXDLLEXPORT wxKeyEvent
;
34 class WXDLLEXPORT wxLog
;
35 class WXDLLEXPORT wxEventLoop
;
36 class WXDLLEXPORT wxXVisualInfo
;
38 // ----------------------------------------------------------------------------
39 // the wxApp class for wxX11 - see wxAppBase for more details
40 // ----------------------------------------------------------------------------
42 class WXDLLEXPORT wxApp
: public wxAppBase
44 DECLARE_DYNAMIC_CLASS(wxApp
)
50 // override base class (pure) virtuals
51 // -----------------------------------
53 virtual int MainLoop();
54 virtual void ExitMainLoop();
55 virtual bool Initialized();
56 virtual bool Pending();
57 virtual void Dispatch();
58 virtual bool Yield(bool onlyIfNeeded
= FALSE
);
59 virtual bool ProcessIdle();
61 virtual bool OnInitGui();
63 // implementation from now on
64 // --------------------------
66 void OnIdle(wxIdleEvent
& event
);
68 // Send idle event to all top-level windows.
69 // Returns TRUE if more idle time is requested.
70 bool SendIdleEvents();
72 // Send idle event to window and all subwindows
73 // Returns TRUE if more idle time is requested.
74 bool SendIdleEvents(wxWindow
* win
);
76 // Processes an X event.
77 virtual bool ProcessXEvent(WXEvent
* event
);
80 virtual void OnAssert(const wxChar
*file
, int line
, const wxChar
* cond
, const wxChar
*msg
);
88 static bool Initialize();
89 static void CleanUp();
91 void DeletePendingObjects();
93 WXWindow
GetTopLevelWidget() const { return m_topLevelWidget
; }
94 WXColormap
GetMainColormap(WXDisplay
* display
);
95 long GetMaxRequestSize() const { return m_maxRequestSize
; }
97 // This handler is called when a property change event occurs
98 virtual bool HandlePropertyChange(WXEvent
*event
);
100 // Values that can be passed on the command line.
101 // Returns -1, -1 if none specified.
102 const wxSize
& GetInitialSize() const { return m_initialSize
; }
103 bool GetShowIconic() const { return m_showIconic
; }
106 // Global context for Pango layout. Either use X11
107 // or use Xft rendering according to GDK_USE_XFT
108 // environment variable
109 PangoContext
* GetPangoContext();
112 wxXVisualInfo
* GetVisualInfo(WXDisplay
* display
)
114 // this should be implemented correctly for wxBitmap to work
115 // with multiple display
119 // We need this before creating the app
120 static WXDisplay
* GetDisplay() { return ms_display
; }
121 static WXDisplay
* ms_display
;
124 static long sm_lastMessageTime
;
126 wxSize m_initialSize
;
129 wxXVisualInfo
* m_visualInfo
;
135 WXWindow m_topLevelWidget
;
136 WXColormap m_mainColormap
;
137 long m_maxRequestSize
;
138 wxEventLoop
* m_mainLoop
;
140 DECLARE_EVENT_TABLE()
143 int WXDLLEXPORT
wxEntry( int argc
, char *argv
[] );