]> git.saurik.com Git - wxWidgets.git/blame_incremental - docs/latex/wx/closeevt.tex
Apply Mart R.'s patch for improved font width
[wxWidgets.git] / docs / latex / wx / closeevt.tex
... / ...
CommitLineData
1\section{\class{wxCloseEvent}}\label{wxcloseevent}
2
3This event class contains information about window and session close events.
4
5The handler function for EVT\_CLOSE is called when the user has tried to close a a frame
6or dialog box using the window manager (X) or system menu (Windows). It can
7also be invoked by the application itself programmatically, for example by
8calling the \helpref{wxWindow::Close}{wxwindowclose} function.
9
10You should check whether the application is forcing the deletion of the window
11using \helpref{wxCloseEvent::CanVeto}{wxcloseeventcanveto}. If this is {\tt false},
12you {\it must} destroy the window using \helpref{wxWindow::Destroy}{wxwindowdestroy}.
13If the return value is true, it is up to you whether you respond by destroying the window.
14
15If you don't destroy the window, you should call \helpref{wxCloseEvent::Veto}{wxcloseeventveto} to
16let the calling code know that you did not destroy the window. This allows the \helpref{wxWindow::Close}{wxwindowclose} function
17to return {\tt true} or {\tt false} depending on whether the close instruction was honoured or not.
18
19\wxheading{Derived from}
20
21\helpref{wxEvent}{wxevent}
22
23\wxheading{Include files}
24
25<wx/event.h>
26
27\wxheading{Event table macros}
28
29To process a close event, use these event handler macros to direct input to member
30functions that take a wxCloseEvent argument.
31
32\twocolwidtha{7cm}
33\begin{twocollist}\itemsep=0pt
34\twocolitem{{\bf EVT\_CLOSE(func)}}{Process a close event, supplying the member function. This
35event applies to wxFrame and wxDialog classes.}
36\twocolitem{{\bf EVT\_QUERY\_END\_SESSION(func)}}{Process a query end session event, supplying the member function.
37This event applies to wxApp only.}
38\twocolitem{{\bf EVT\_END\_SESSION(func)}}{Process an end session event, supplying the member function.
39This event applies to wxApp only.}
40\end{twocollist}%
41
42\wxheading{See also}
43
44\helpref{wxWindow::Close}{wxwindowclose},\rtfsp
45%% GD: OnXXX functions are not documented
46%%\helpref{wxApp::OnEndSession}{wxapponendsession},\rtfsp
47\helpref{Window deletion overview}{windowdeletionoverview}
48
49\latexignore{\rtfignore{\wxheading{Members}}}
50
51\membersection{wxCloseEvent::wxCloseEvent}\label{wxcloseeventctor}
52
53\func{}{wxCloseEvent}{\param{WXTYPE}{ commandEventType = 0}, \param{int}{ id = 0}}
54
55Constructor.
56
57\membersection{wxCloseEvent::CanVeto}\label{wxcloseeventcanveto}
58
59\func{bool}{CanVeto}{\void}
60
61Returns true if you can veto a system shutdown or a window close event.
62Vetoing a window close event is not possible if the calling code wishes to
63force the application to exit, and so this function must be called to check this.
64
65\membersection{wxCloseEvent::GetLoggingOff}\label{wxcloseeventgetloggingoff}
66
67\constfunc{bool}{GetLoggingOff}{\void}
68
69Returns true if the user is logging off.
70
71\membersection{wxCloseEvent::GetForce}\label{wxcloseeventgetforce}
72
73\constfunc{bool}{GetForce}{\void}
74
75Returns true if the application wishes to force the window to close.
76This will shortly be obsolete, replaced by CanVeto.
77
78\membersection{wxCloseEvent::SetCanVeto}\label{wxcloseeventsetcanveto}
79
80\func{void}{SetCanVeto}{\param{bool}{ canVeto}}
81
82Sets the 'can veto' flag.
83
84\membersection{wxCloseEvent::SetForce}\label{wxcloseeventsetforce}
85
86\constfunc{void}{SetForce}{\param{bool}{ force}}
87
88Sets the 'force' flag.
89
90\membersection{wxCloseEvent::SetLoggingOff}\label{wxcloseeventsetloggingoff}
91
92\constfunc{void}{SetLoggingOff}{\param{bool}{ loggingOff}}
93
94Sets the 'logging off' flag.
95
96\membersection{wxCloseEvent::Veto}\label{wxcloseeventveto}
97
98\func{void}{Veto}{\param{bool}{ veto = true}}
99
100Call this from your event handler to veto a system shutdown or to signal
101to the calling application that a window close did not happen.
102
103You can only veto a shutdown if \helpref{wxCloseEvent::CanVeto}{wxcloseeventcanveto} returns
104true.
105
106