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();
61 virtual bool Yield(bool onlyIfNeeded
= FALSE
);
62 virtual bool ProcessIdle();
63 virtual void WakeUpIdle();
65 virtual bool OnInitGui();
67 // implementation from now on
68 // --------------------------
70 void OnIdle(wxIdleEvent
& event
);
72 // Send idle event to all top-level windows.
73 // Returns TRUE if more idle time is requested.
74 bool SendIdleEvents();
76 // Send idle event to window and all subwindows
77 // Returns TRUE if more idle time is requested.
78 bool SendIdleEvents(wxWindow
* win
);
80 // Processes an X event.
81 virtual bool ProcessXEvent(WXEvent
* event
);
84 virtual void OnAssert(const wxChar
*file
, int line
, const wxChar
* cond
, const wxChar
*msg
);
92 static bool Initialize();
93 static void CleanUp();
95 void DeletePendingObjects();
97 WXWindow
GetTopLevelWidget() const { return m_topLevelWidget
; }
98 WXColormap
GetMainColormap(WXDisplay
* display
);
99 long GetMaxRequestSize() const { return m_maxRequestSize
; }
101 // This handler is called when a property change event occurs
102 virtual bool HandlePropertyChange(WXEvent
*event
);
104 // Values that can be passed on the command line.
105 // Returns -1, -1 if none specified.
106 const wxSize
& GetInitialSize() const { return m_initialSize
; }
107 bool GetShowIconic() const { return m_showIconic
; }
110 // Global context for Pango layout. Either use X11
111 // or use Xft rendering according to GDK_USE_XFT
112 // environment variable
113 PangoContext
* GetPangoContext();
116 wxXVisualInfo
* GetVisualInfo(WXDisplay
* display
)
118 // this should be implemented correctly for wxBitmap to work
119 // with multiple display
123 // We need this before creating the app
124 static WXDisplay
* GetDisplay() { return ms_display
; }
125 static WXDisplay
* ms_display
;
128 static long sm_lastMessageTime
;
130 wxSize m_initialSize
;
133 wxXVisualInfo
* m_visualInfo
;
139 WXWindow m_topLevelWidget
;
140 WXColormap m_mainColormap
;
141 long m_maxRequestSize
;
142 wxEventLoop
* m_mainLoop
;
144 DECLARE_EVENT_TABLE()
147 int WXDLLEXPORT
wxEntry( int argc
, char *argv
[] );