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
);
58 virtual bool ProcessIdle();
60 virtual bool OnInitGui();
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 // Processes an X event.
76 virtual bool ProcessXEvent(WXEvent
* event
);
79 virtual void OnAssert(const wxChar
*file
, int line
, const wxChar
* cond
, const wxChar
*msg
);
87 static bool Initialize();
88 static void CleanUp();
90 void DeletePendingObjects();
92 WXWindow
GetTopLevelWidget() const { return m_topLevelWidget
; }
93 WXColormap
GetMainColormap(WXDisplay
* display
);
94 long GetMaxRequestSize() const { return m_maxRequestSize
; }
96 // This handler is called when a property change event occurs
97 virtual bool HandlePropertyChange(WXEvent
*event
);
99 // Values that can be passed on the command line.
100 // Returns -1, -1 if none specified.
101 const wxSize
& GetInitialSize() const { return m_initialSize
; }
102 bool GetShowIconic() const { return m_showIconic
; }
105 // Global context for Pango layout. Either use X11
106 // or use Xft rendering according to GDK_USE_XFT
107 // environment variable
108 PangoContext
* GetPangoContext();
111 // We need this before creating the app
112 static WXDisplay
* GetDisplay() { return ms_display
; }
113 static WXDisplay
* ms_display
;
116 static long sm_lastMessageTime
;
118 wxSize m_initialSize
;
121 // Someone find a better place for these
122 int m_visualType
; // TrueColor, DirectColor etc.
124 int m_visualColormapSize
;
125 void *m_visualColormap
;
127 unsigned long m_visualRedMask
;
128 unsigned long m_visualGreenMask
;
129 unsigned long m_visualBlueMask
;
130 int m_visualRedShift
;
131 int m_visualGreenShift
;
132 int m_visualBlueShift
;
134 int m_visualGreenPrec
;
135 int m_visualBluePrec
;
137 unsigned char *m_colorCube
;
143 WXWindow m_topLevelWidget
;
144 WXColormap m_mainColormap
;
145 long m_maxRequestSize
;
146 wxEventLoop
* m_mainLoop
;
148 DECLARE_EVENT_TABLE()
151 int WXDLLEXPORT
wxEntry( int argc
, char *argv
[] );