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
;
35 class WXDLLEXPORT wxEventLoop
;
37 // ----------------------------------------------------------------------------
38 // the wxApp class for wxX11 - see wxAppBase for more details
39 // ----------------------------------------------------------------------------
41 class WXDLLEXPORT wxApp
: public wxAppBase
43 DECLARE_DYNAMIC_CLASS(wxApp
)
49 // override base class (pure) virtuals
50 // -----------------------------------
52 virtual int MainLoop();
53 virtual void ExitMainLoop();
54 virtual bool Initialized();
55 virtual bool Pending();
56 virtual void Dispatch();
57 virtual bool Yield(bool onlyIfNeeded
= FALSE
);
59 virtual bool OnInitGui();
61 // implementation from now on
62 // --------------------------
64 void OnIdle(wxIdleEvent
& event
);
66 // Send idle event to all top-level windows.
67 // Returns TRUE if more idle time is requested.
68 bool SendIdleEvents();
70 // Send idle event to window and all subwindows
71 // Returns TRUE if more idle time is requested.
72 bool SendIdleEvents(wxWindow
* win
);
74 // Processes an X event.
75 virtual bool ProcessXEvent(WXEvent
* event
);
77 virtual void OnAssert(const wxChar
*file
, int line
, const wxChar
*msg
);
84 static bool Initialize();
85 static void CleanUp();
87 void DeletePendingObjects();
90 WXWindow
GetTopLevelWidget() const { return m_topLevelWidget
; }
91 WXColormap
GetMainColormap(WXDisplay
* display
);
92 long GetMaxRequestSize() const { return m_maxRequestSize
; }
94 // This handler is called when a property change event occurs
95 virtual bool HandlePropertyChange(WXEvent
*event
);
97 // Values that can be passed on the command line.
98 // Returns -1, -1 if none specified.
99 const wxSize
& GetInitialSize() const { return m_initialSize
; }
100 bool GetShowIconic() const { return m_showIconic
; }
102 // We need this before creating the app
103 static WXDisplay
* GetDisplay() { return ms_display
; }
104 static WXDisplay
* ms_display
;
107 static long sm_lastMessageTime
;
109 wxSize m_initialSize
;
112 // Someone find a better place for these
113 int m_visualType
; // TrueColor, DirectColor etc.
115 int m_visualColormapSize
;
116 void *m_visualColormap
;
118 unsigned long m_visualRedMask
;
119 unsigned long m_visualGreenMask
;
120 unsigned long m_visualBlueMask
;
121 int m_visualRedShift
;
122 int m_visualGreenShift
;
123 int m_visualBlueShift
;
125 int m_visualGreenPrec
;
126 int m_visualBluePrec
;
128 unsigned char *m_colorCube
;
134 WXWindow m_topLevelWidget
;
135 WXColormap m_mainColormap
;
136 long m_maxRequestSize
;
137 wxEventLoop
* m_mainLoop
;
139 DECLARE_EVENT_TABLE()
142 int WXDLLEXPORT
wxEntry( int argc
, char *argv
[] );