1 /////////////////////////////////////////////////////////////////////////////
4 // Author: Robert Roebling
6 // Copyright: (c) 1998 Robert Roebling, Julian Smart
7 // Licence: wxWindows licence
8 /////////////////////////////////////////////////////////////////////////////
18 #include "wx/window.h"
22 //-----------------------------------------------------------------------------
24 //-----------------------------------------------------------------------------
29 //-----------------------------------------------------------------------------
31 //-----------------------------------------------------------------------------
33 extern wxApp
*wxTheApp
;
35 //-----------------------------------------------------------------------------
37 //-----------------------------------------------------------------------------
42 //-----------------------------------------------------------------------------
44 //-----------------------------------------------------------------------------
46 #define wxPRINT_WINDOWS 1
47 #define wxPRINT_POSTSCRIPT 2
49 //-----------------------------------------------------------------------------
51 //-----------------------------------------------------------------------------
53 class wxApp
: public wxEvtHandler
55 DECLARE_DYNAMIC_CLASS(wxApp
)
62 static void SetInitializerFunction(wxAppInitializerFunction fn
) { m_appInitFn
= fn
; }
63 static wxAppInitializerFunction
GetInitializerFunction() { return m_appInitFn
; }
65 /* override for altering the way wxGTK intializes the GUI (palette/visual/colorcube).
66 * under wxMSW, OnInitGui() does nothing by default. when overriding this method,
67 * the code in it is likely to be platform dependent, otherwise use OnInit(). */
68 virtual bool OnInitGui();
70 /* override to create top level frame, display splash screen etc. */
71 virtual bool OnInit() { return FALSE
; }
73 virtual int OnRun() { return MainLoop(); }
74 virtual int OnExit() { return 0; }
76 wxWindow
*GetTopWindow();
77 void SetTopWindow( wxWindow
*win
);
79 virtual int MainLoop();
82 virtual bool Pending();
83 virtual void Dispatch();
85 /** Returns the standard icons for the msg dialogs, implemented in
86 src/generic/msgdlgg.cpp and src/gtk/app.cpp. */
87 virtual wxIcon
GetStdIcon(int which
) const;
88 inline void SetWantDebugOutput( bool flag
) { m_wantDebugOutput
= flag
; }
89 inline bool GetWantDebugOutput() { return m_wantDebugOutput
; }
91 void OnIdle( wxIdleEvent
&event
);
92 bool SendIdleEvents();
93 bool SendIdleEvents( wxWindow
* win
);
95 inline wxString
GetAppName() const
96 { if (m_appName
!= "") return m_appName
; else return m_className
; }
97 inline void SetAppName( const wxString
& name
) { m_appName
= name
; }
99 inline wxString
GetClassName() const { return m_className
; }
100 inline void SetClassName( const wxString
& name
) { m_className
= name
; }
102 const wxString
& GetVendorName() const { return m_vendorName
; }
103 void SetVendorName( const wxString
& name
) { m_vendorName
= name
; }
105 inline void SetExitOnFrameDelete( bool flag
) { m_exitOnFrameDelete
= flag
; }
106 inline bool GetExitOnFrameDelete() const { return m_exitOnFrameDelete
; }
108 void SetPrintMode( int WXUNUSED(mode
) ) {}
109 int GetPrintMode() const { return wxPRINT_POSTSCRIPT
; }
112 /* override this function to create default log target of arbitrary
113 * user-defined classv (default implementation creates a wxLogGui object) */
114 virtual wxLog
*CreateLogTarget();
119 static bool Initialize();
120 static bool InitialzeVisual();
121 static void CleanUp();
125 void ProcessPendingEvents();
127 void DeletePendingObjects();
129 /// This can be used to suppress the generation of Idle events.
130 inline void SuppressIdleEvents(bool arg
= TRUE
) { m_suppressIdleEvents
= arg
; }
131 inline bool GetSuppressIdleEvents() const { return m_suppressIdleEvents
; }
134 bool m_exitOnFrameDelete
;
135 bool m_wantDebugOutput
;
136 wxWindow
*m_topWindow
;
140 gint m_wakeUpTimerTag
;
142 unsigned char *m_colorCube
;
147 wxString m_vendorName
;
149 wxString m_className
;
151 static wxAppInitializerFunction m_appInitFn
;
153 /// Set to TRUE while we are in wxYield().
154 bool m_suppressIdleEvents
;
155 DECLARE_EVENT_TABLE()
158 #endif // __GTKAPPH__