\helpref{wxEvtHandler}{wxevthandler}\\
\helpref{wxObject}{wxobject}
+\wxheading{Include files}
+
+<wx/app.h>
+
\wxheading{See also}
\helpref{wxApp overview}{wxappoverview}
\membersection{wxApp::wxApp}
-\func{void}{wxApp}{\param{int}{ language = wxLANGUAGE\_ENGLISH}}
+\func{void}{wxApp}{\void}
Constructor. Called implicitly with a definition of a wxApp object.
The argument is a language identifier; this is an experimental
feature and will be expanded and documented in future versions.
-TODO: completely rewrite the language stuff.
-
\membersection{wxApp::\destruct{wxApp}}
\func{void}{\destruct{wxApp}}{\void}
\helpref{wxApp::SetExitOnDelete}{wxappsetexitondelete}
-\membersection{wxApp::GetPrintMode}\label{wxappgetprintmode}
-
-\constfunc{bool}{GetPrintMode}{\void}
-
-Returns the print mode: see \helpref{wxApp::SetPrintMode}{wxappsetprintmode}.
-
\membersection{wxApp::GetTopWindow}\label{wxappgettopwindow}
\constfunc{wxWindow *}{GetTopWindow}{\void}
Returns a pointer to the top window.
+\wxheading{Remarks}
+
+If the top window hasn't been set using \helpref{wxApp::SetTopWindow}{wxappsettopwindow}, this
+function will find the first top-level window (frame or dialog) and return that.
+
\wxheading{See also}
\helpref{wxApp::SetTopWindow}{wxappsettopwindow}
sends an OnIdle event to each application window, allowing windows to do idle processing such as updating
their appearance. If either wxApp::OnIdle or a window OnIdle function requested more time, by
caling \helpref{wxIdleEvent::ReqestMore}{wxidleeventrequestmore}, wxWindows will send another OnIdle
-event to the application event. This will occur in a loop until either a user event is found to be
+event to the application object. This will occur in a loop until either a user event is found to be
pending, or OnIdle requests no more time. Then all pending user events are processed until the system
goes idle again, when OnIdle is called, and so on.
\helpref{wxWindow::OnIdle}{wxwindowonidle}, \helpref{wxIdleEvent}{wxidleevent},\rtfsp
\helpref{wxWindow::SendIdleEvents}{wxappsendidleevents}
+\membersection{wxApp::OnEndSession}\label{wxapponendsession}
+
+\func{void}{OnEndSession}{\param{wxCloseEvent\& }{event}}
+
+This is an event handler function called when the operating system or GUI session is
+about to close down. The application has a chance to silently save information,
+and can optionally close itself.
+
+Use the EVT\_END\_SESSION event table macro to handle query end session events.
+
+The default handler calls \helpref{wxWindow::Close}{wxwindowclose} with a TRUE argument
+(forcing the application to close itself silently).
+
+\wxheading{Remarks}
+
+Under X, OnEndSession is called in response to the 'die' event.
+
+Under Windows, OnEndSession is called in response to the WM\_ENDSESSION message.
+
+\wxheading{See also}
+
+\helpref{wxWindow::Close}{wxwindowclose},\rtfsp
+\helpref{wxWindow::OnCloseWindow}{wxwindowonclosewindow},\rtfsp
+\helpref{wxCloseEvent}{wxcloseevent},\rtfsp
+\helpref{wxApp::OnQueryEndSession}{wxapponqueryendsession}
+
\membersection{wxApp::OnInit}\label{wxapponinit}
\func{bool}{OnInit}{\void}
This must be provided by the application, and will usually create the
-application's main window, calling \helpref{wxApp::SetTopWindow}{wxappsettopwindow}.
+application's main window, optionally calling \helpref{wxApp::SetTopWindow}{wxappsettopwindow}.
Return TRUE to continue processing, FALSE to exit the application.
-\membersection{wxApp::Pending}\label{wxapppending}
+\membersection{wxApp::OnQueryEndSession}\label{wxapponqueryendsession}
-\func{bool}{Pending}{\void}
+\func{void}{OnQueryEndSession}{\param{wxCloseEvent\& }{event}}
-Returns TRUE if unprocessed events are in the window system event queue
-(MS Windows and Motif).
+This is an event handler function called when the operating system or GUI session is
+about to close down. Typically, an application will try to save unsaved documents
+at this point.
+
+If \helpref{wxCloseEvent::CanVeto}{wxcloseeventcanveto} returns TRUE, the application
+is allowed to veto the shutdown by calling \helpref{wxCloseEvent::Veto}{wxcloseeventveto}.
+The application might veto the shutdown after prompting for documents to be saved, and the
+user has cancelled the save.
+
+Use the EVT\_QUERY\_END\_SESSION event table macro to handle query end session events.
+
+You should check whether the application is forcing the deletion of the window
+using \helpref{wxCloseEvent::GetForce}{wxcloseeventgetforce}. If this is TRUE,
+destroy the window using \helpref{wxWindow::Destroy}{wxwindowdestroy}.
+If not, it is up to you whether you respond by destroying the window.
+
+The default handler calls \helpref{wxWindow::Close}{wxwindowclose} on the top-level window,
+and vetoes the shutdown if Close returns FALSE. This will be sufficient for many applications.
+
+\wxheading{Remarks}
+
+Under X, OnQueryEndSession is called in response to the 'save session' event.
+
+Under Windows, OnQueryEndSession is called in response to the WM\_QUERYENDSESSION message.
\wxheading{See also}
-\helpref{wxApp::Dispatch}{wxappdispatch}
+\helpref{wxWindow::Close}{wxwindowclose},\rtfsp
+\helpref{wxWindow::OnCloseWindow}{wxwindowonclosewindow},\rtfsp
+\helpref{wxCloseEvent}{wxcloseevent},\rtfsp
+\helpref{wxApp::OnEndSession}{wxapponendsession}
\membersection{wxApp::ProcessMessage}\label{wxappprocessmessage}
}
\end{verbatim}
+\membersection{wxApp::Pending}\label{wxapppending}
+
+\func{bool}{Pending}{\void}
+
+Returns TRUE if unprocessed events are in the window system event queue
+(MS Windows and Motif).
+
+\wxheading{See also}
+
+\helpref{wxApp::Dispatch}{wxappdispatch}
+
\membersection{wxApp::SendIdleEvents}\label{wxappsendidleevents}
\func{bool}{SendIdleEvents}{\void}
Currently, setting this to FALSE only has an effect under Windows.
-\membersection{wxApp::SetPrintMode}\label{wxappsetprintmode}
-
-\func{void}{SetPrintMode}{\param{int}{ mode}}
-
-Sets the print mode determining what printing facilities will be
-used by the printing framework.
-
-\wxheading{Parameters}
-
-\docparam{mode}{This can be one of:
-
-\begin{twocollist}\itemsep=0pt
-\twocolitem{{\bf wxPRINT\_WINDOWS}}{Under Windows, use Windows printing (wxPrinterDC). This is the
-default under Windows.}
-\twocolitem{{\bf wxPRINT\_POSTSCRIPT}}{Use PostScript printing (wxPostScriptDC). This is the
-default for non-Windows platforms.}
-\end{twocollist}
-}%
-
\membersection{wxApp::SetTopWindow}\label{wxappsettopwindow}
\func{void}{SetTopWindow}{\param{wxWindow* }{window}}
-Sets the `top' window. You should normally call this from within \helpref{wxApp::OnInit}{wxapponinit} to
-let wxWindows know which is the main window.
+Sets the `top' window. You can call this from within \helpref{wxApp::OnInit}{wxapponinit} to
+let wxWindows know which is the main window. You don't have to set the top window;
+it's only a convenience so that (for example) certain dialogs without parents can use a
+specific window as the top window. If no top window is specified by the application,
+wxWindows just uses the first frame or dialog in its top-level window list, when it
+needs to use the top window.
\wxheading{Parameters}