1 /////////////////////////////////////////////////////////////////////////////
4 // Author: Robert Roebling
6 // Copyright: (c) 1998 Robert Roebling, Julian Smart
7 // Licence: wxWindows licence
8 /////////////////////////////////////////////////////////////////////////////
18 #include "wx/window.h"
21 //-----------------------------------------------------------------------------
23 //-----------------------------------------------------------------------------
28 //-----------------------------------------------------------------------------
30 //-----------------------------------------------------------------------------
32 extern wxApp
*wxTheApp
;
34 //-----------------------------------------------------------------------------
36 //-----------------------------------------------------------------------------
41 //-----------------------------------------------------------------------------
43 //-----------------------------------------------------------------------------
45 #define wxPRINT_WINDOWS 1
46 #define wxPRINT_POSTSCRIPT 2
48 //-----------------------------------------------------------------------------
50 //-----------------------------------------------------------------------------
52 class wxApp
: public wxEvtHandler
54 DECLARE_DYNAMIC_CLASS(wxApp
)
61 static void SetInitializerFunction(wxAppInitializerFunction fn
) { m_appInitFn
= fn
; }
62 static wxAppInitializerFunction
GetInitializerFunction() { return m_appInitFn
; }
64 /* override for altering the way wxGTK intializes the GUI (palette/visual/colorcube).
65 * under wxMSW, OnInitGui() does nothing by default. when overriding this method,
66 * the code in it is likely to be platform dependent, otherwise use OnInit(). */
67 virtual bool OnInitGui();
69 /* override to create top level frame, display splash screen etc. */
70 virtual bool OnInit() { return FALSE
; }
72 virtual int OnRun() { return MainLoop(); }
73 virtual int OnExit() { return 0; }
75 wxWindow
*GetTopWindow();
76 void SetTopWindow( wxWindow
*win
);
78 virtual int MainLoop();
81 virtual bool Pending();
82 virtual void Dispatch();
84 inline void SetWantDebugOutput( bool flag
) { m_wantDebugOutput
= flag
; }
85 inline bool GetWantDebugOutput() { return m_wantDebugOutput
; }
87 void OnIdle( wxIdleEvent
&event
);
88 bool SendIdleEvents();
89 bool SendIdleEvents( wxWindow
* win
);
91 inline wxString
GetAppName() const
92 { if (m_appName
!= "") return m_appName
; else return m_className
; }
93 inline void SetAppName( const wxString
& name
) { m_appName
= name
; }
95 inline wxString
GetClassName() const { return m_className
; }
96 inline void SetClassName( const wxString
& name
) { m_className
= name
; }
98 const wxString
& GetVendorName() const { return m_vendorName
; }
99 void SetVendorName( const wxString
& name
) { m_vendorName
= name
; }
101 inline void SetExitOnFrameDelete( bool flag
) { m_exitOnFrameDelete
= flag
; }
102 inline bool GetExitOnFrameDelete() const { return m_exitOnFrameDelete
; }
104 void SetPrintMode( int WXUNUSED(mode
) ) {}
105 int GetPrintMode() const { return wxPRINT_POSTSCRIPT
; }
108 /* override this function to create default log target of arbitrary
109 * user-defined classv (default implementation creates a wxLogGui object) */
110 virtual wxLog
*CreateLogTarget();
115 static bool Initialize();
116 static bool InitialzeVisual();
117 static void CleanUp();
121 void ProcessPendingEvents();
123 void DeletePendingObjects();
125 /// This can be used to suppress the generation of Idle events.
126 inline void SuppressIdleEvents(bool arg
= TRUE
) { m_suppressIdleEvents
= arg
; }
127 inline bool GetSuppressIdleEvents() const { return m_suppressIdleEvents
; }
130 bool m_exitOnFrameDelete
;
131 bool m_wantDebugOutput
;
132 wxWindow
*m_topWindow
;
136 gint m_wakeUpTimerTag
;
138 unsigned char *m_colorCube
;
143 wxString m_vendorName
;
145 wxString m_className
;
147 static wxAppInitializerFunction m_appInitFn
;
149 /// Set to TRUE while we are in wxYield().
150 bool m_suppressIdleEvents
;
151 DECLARE_EVENT_TABLE()
154 #endif // __GTKAPPH__