1 /////////////////////////////////////////////////////////////////////////////
3 // Purpose: wxApp class
4 // Author: Julian Smart
8 // Copyright: (c) Julian Smart
9 // Licence: wxWindows licence
10 /////////////////////////////////////////////////////////////////////////////
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
;
36 // ----------------------------------------------------------------------------
37 // the wxApp class for Motif - see wxAppBase for more details
38 // ----------------------------------------------------------------------------
40 class WXDLLEXPORT wxApp
: public wxAppBase
42 DECLARE_DYNAMIC_CLASS(wxApp
)
48 // override base class (pure) virtuals
49 // -----------------------------------
51 virtual int MainLoop();
52 virtual void ExitMainLoop();
53 virtual bool Initialized();
54 virtual bool Pending();
55 virtual void Dispatch();
56 virtual bool Yield(bool onlyIfNeeded
= FALSE
);
58 virtual bool OnInitGui();
60 virtual wxIcon
GetStdIcon(int which
) const;
62 // implementation from now on
63 // --------------------------
65 void OnIdle(wxIdleEvent
& event
);
67 // Send idle event to all top-level windows.
68 // Returns TRUE if more idle time is requested.
69 bool SendIdleEvents();
71 // Send idle event to window and all subwindows
72 // Returns TRUE if more idle time is requested.
73 bool SendIdleEvents(wxWindow
* win
);
75 // Motif implementation.
77 // Processes an X event.
78 virtual void ProcessXEvent(WXEvent
* event
);
80 // Returns TRUE if an accelerator has been processed
81 virtual bool CheckForAccelerator(WXEvent
* event
);
83 // Returns TRUE if a key down event has been processed
84 virtual bool CheckForKeyDown(WXEvent
* event
);
86 // Returns TRUE if a key up event has been processed
87 virtual bool CheckForKeyUp(WXEvent
* event
);
94 static bool Initialize();
95 static void CleanUp();
97 void DeletePendingObjects();
101 WXAppContext
GetAppContext() const { return m_appContext
; }
102 WXWidget
GetTopLevelWidget() const { return m_topLevelWidget
; }
103 WXColormap
GetMainColormap(WXDisplay
* display
);
104 WXDisplay
* GetInitialDisplay() const { return m_initialDisplay
; }
105 long GetMaxRequestSize() const { return m_maxRequestSize
; }
107 // This handler is called when a property change event occurs
108 virtual void HandlePropertyChange(WXEvent
*event
);
111 static long sm_lastMessageTime
;
118 WXAppContext m_appContext
;
119 WXWidget m_topLevelWidget
;
120 WXColormap m_mainColormap
;
121 WXDisplay
* m_initialDisplay
;
122 long m_maxRequestSize
;
124 DECLARE_EVENT_TABLE()
127 int WXDLLEXPORT
wxEntry( int argc
, char *argv
[] );