1998-05-20 10:25:30 -04:00
|
|
|
\section{\class{wxCloseEvent}}\label{wxcloseevent}
|
|
|
|
|
|
|
|
This event class contains information about window and session close events.
|
|
|
|
|
2002-04-08 12:46:27 -04:00
|
|
|
The handler function for EVT\_CLOSE is called when the user has tried to close a a frame
|
2003-01-17 06:58:40 -05:00
|
|
|
or dialog box using the window manager (X) or system menu (Windows). It can
|
|
|
|
also be invoked by the application itself programmatically, for example by
|
|
|
|
calling the \helpref{wxWindow::Close}{wxwindowclose} function.
|
2002-04-08 12:46:27 -04:00
|
|
|
|
|
|
|
You should check whether the application is forcing the deletion of the window
|
2003-01-17 19:16:34 -05:00
|
|
|
using \helpref{wxCloseEvent::CanVeto}{wxcloseeventcanveto}. If this is {\tt false},
|
2002-04-08 12:46:27 -04:00
|
|
|
you {\it must} destroy the window using \helpref{wxWindow::Destroy}{wxwindowdestroy}.
|
2003-01-17 19:16:34 -05:00
|
|
|
If the return value is true, it is up to you whether you respond by destroying the window.
|
2002-04-08 12:46:27 -04:00
|
|
|
|
|
|
|
If you don't destroy the window, you should call \helpref{wxCloseEvent::Veto}{wxcloseeventveto} to
|
|
|
|
let the calling code know that you did not destroy the window. This allows the \helpref{wxWindow::Close}{wxwindowclose} function
|
2003-01-17 19:16:34 -05:00
|
|
|
to return {\tt true} or {\tt false} depending on whether the close instruction was honoured or not.
|
2002-04-08 12:46:27 -04:00
|
|
|
|
1998-05-20 10:25:30 -04:00
|
|
|
\wxheading{Derived from}
|
|
|
|
|
|
|
|
\helpref{wxEvent}{wxevent}
|
|
|
|
|
1999-02-15 15:41:29 -05:00
|
|
|
\wxheading{Include files}
|
|
|
|
|
|
|
|
<wx/event.h>
|
|
|
|
|
1998-05-20 10:25:30 -04:00
|
|
|
\wxheading{Event table macros}
|
|
|
|
|
|
|
|
To process a close event, use these event handler macros to direct input to member
|
|
|
|
functions that take a wxCloseEvent argument.
|
|
|
|
|
|
|
|
\twocolwidtha{7cm}
|
|
|
|
\begin{twocollist}\itemsep=0pt
|
1998-10-12 15:45:24 -04:00
|
|
|
\twocolitem{{\bf EVT\_CLOSE(func)}}{Process a close event, supplying the member function. This
|
|
|
|
event applies to wxFrame and wxDialog classes.}
|
|
|
|
\twocolitem{{\bf EVT\_QUERY\_END\_SESSION(func)}}{Process a query end session event, supplying the member function.
|
|
|
|
This event applies to wxApp only.}
|
1999-01-07 03:43:47 -05:00
|
|
|
\twocolitem{{\bf EVT\_END\_SESSION(func)}}{Process an end session event, supplying the member function.
|
1998-10-12 15:45:24 -04:00
|
|
|
This event applies to wxApp only.}
|
1998-05-20 10:25:30 -04:00
|
|
|
\end{twocollist}%
|
|
|
|
|
|
|
|
\wxheading{See also}
|
|
|
|
|
|
|
|
\helpref{wxWindow::Close}{wxwindowclose},\rtfsp
|
2001-08-29 15:39:14 -04:00
|
|
|
%% GD: OnXXX functions are not documented
|
|
|
|
%%\helpref{wxApp::OnEndSession}{wxapponendsession},\rtfsp
|
1998-05-20 10:25:30 -04:00
|
|
|
\helpref{Window deletion overview}{windowdeletionoverview}
|
|
|
|
|
|
|
|
\latexignore{\rtfignore{\wxheading{Members}}}
|
|
|
|
|
2005-05-22 07:21:21 -04:00
|
|
|
|
2004-10-04 11:13:52 -04:00
|
|
|
\membersection{wxCloseEvent::wxCloseEvent}\label{wxcloseeventctor}
|
1998-05-20 10:25:30 -04:00
|
|
|
|
|
|
|
\func{}{wxCloseEvent}{\param{WXTYPE}{ commandEventType = 0}, \param{int}{ id = 0}}
|
|
|
|
|
|
|
|
Constructor.
|
|
|
|
|
2005-05-22 07:21:21 -04:00
|
|
|
|
1998-10-12 15:45:24 -04:00
|
|
|
\membersection{wxCloseEvent::CanVeto}\label{wxcloseeventcanveto}
|
|
|
|
|
|
|
|
\func{bool}{CanVeto}{\void}
|
|
|
|
|
2003-01-17 19:16:34 -05:00
|
|
|
Returns true if you can veto a system shutdown or a window close event.
|
1998-10-12 15:45:24 -04:00
|
|
|
Vetoing a window close event is not possible if the calling code wishes to
|
|
|
|
force the application to exit, and so this function must be called to check this.
|
|
|
|
|
2005-05-22 07:21:21 -04:00
|
|
|
|
1998-05-20 10:25:30 -04:00
|
|
|
\membersection{wxCloseEvent::GetLoggingOff}\label{wxcloseeventgetloggingoff}
|
|
|
|
|
|
|
|
\constfunc{bool}{GetLoggingOff}{\void}
|
|
|
|
|
2005-05-22 07:21:21 -04:00
|
|
|
Returns true if the user is just logging off or false if the system is
|
|
|
|
shutting down. This method can only be called for end session and query end
|
|
|
|
session events, it doesn't make sense for close window event.
|
|
|
|
|
1998-05-20 10:25:30 -04:00
|
|
|
|
1998-10-12 15:45:24 -04:00
|
|
|
\membersection{wxCloseEvent::SetCanVeto}\label{wxcloseeventsetcanveto}
|
|
|
|
|
|
|
|
\func{void}{SetCanVeto}{\param{bool}{ canVeto}}
|
|
|
|
|
|
|
|
Sets the 'can veto' flag.
|
|
|
|
|
2005-05-22 07:21:21 -04:00
|
|
|
|
1998-10-12 15:45:24 -04:00
|
|
|
\membersection{wxCloseEvent::SetForce}\label{wxcloseeventsetforce}
|
|
|
|
|
|
|
|
\constfunc{void}{SetForce}{\param{bool}{ force}}
|
|
|
|
|
|
|
|
Sets the 'force' flag.
|
|
|
|
|
2005-05-22 07:21:21 -04:00
|
|
|
|
1998-10-12 15:45:24 -04:00
|
|
|
\membersection{wxCloseEvent::SetLoggingOff}\label{wxcloseeventsetloggingoff}
|
|
|
|
|
|
|
|
\constfunc{void}{SetLoggingOff}{\param{bool}{ loggingOff}}
|
|
|
|
|
|
|
|
Sets the 'logging off' flag.
|
1998-05-20 10:25:30 -04:00
|
|
|
|
2005-05-22 07:21:21 -04:00
|
|
|
|
1998-05-20 10:25:30 -04:00
|
|
|
\membersection{wxCloseEvent::Veto}\label{wxcloseeventveto}
|
|
|
|
|
2003-01-17 19:16:34 -05:00
|
|
|
\func{void}{Veto}{\param{bool}{ veto = true}}
|
1998-10-12 15:45:24 -04:00
|
|
|
|
|
|
|
Call this from your event handler to veto a system shutdown or to signal
|
|
|
|
to the calling application that a window close did not happen.
|
1998-05-20 10:25:30 -04:00
|
|
|
|
1998-10-12 15:45:24 -04:00
|
|
|
You can only veto a shutdown if \helpref{wxCloseEvent::CanVeto}{wxcloseeventcanveto} returns
|
2003-01-17 19:16:34 -05:00
|
|
|
true.
|
1998-05-20 10:25:30 -04:00
|
|
|
|
|
|
|
|