]> git.saurik.com Git - wxWidgets.git/blame - docs/latex/wx/closeevt.tex
Added wxRect::Intersect() documentation (patch 1868322 from Laurent Humbertclaude).
[wxWidgets.git] / docs / latex / wx / closeevt.tex
CommitLineData
a660d684
KB
1\section{\class{wxCloseEvent}}\label{wxcloseevent}
2
3This event class contains information about window and session close events.
4
f4fcc291 5The handler function for EVT\_CLOSE is called when the user has tried to close a a frame
649a48a2
VZ
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.
f4fcc291
JS
9
10You should check whether the application is forcing the deletion of the window
cc81d32f 11using \helpref{wxCloseEvent::CanVeto}{wxcloseeventcanveto}. If this is {\tt false},
f4fcc291 12you {\it must} destroy the window using \helpref{wxWindow::Destroy}{wxwindowdestroy}.
cc81d32f 13If the return value is true, it is up to you whether you respond by destroying the window.
f4fcc291
JS
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
cc81d32f 17to return {\tt true} or {\tt false} depending on whether the close instruction was honoured or not.
f4fcc291 18
a660d684
KB
19\wxheading{Derived from}
20
7376079d
VZ
21\helpref{wxEvent}{wxevent}\\
22\helpref{wxObject}{wxobject}
a660d684 23
954b8ae6
JS
24\wxheading{Include files}
25
26<wx/event.h>
27
a7af285d
VZ
28\wxheading{Library}
29
30\helpref{wxCore}{librarieslist}
31
a660d684
KB
32\wxheading{Event table macros}
33
34To process a close event, use these event handler macros to direct input to member
35functions that take a wxCloseEvent argument.
36
37\twocolwidtha{7cm}
38\begin{twocollist}\itemsep=0pt
387a3b02
JS
39\twocolitem{{\bf EVT\_CLOSE(func)}}{Process a close event, supplying the member function. This
40event applies to wxFrame and wxDialog classes.}
41\twocolitem{{\bf EVT\_QUERY\_END\_SESSION(func)}}{Process a query end session event, supplying the member function.
42This event applies to wxApp only.}
2432b92d 43\twocolitem{{\bf EVT\_END\_SESSION(func)}}{Process an end session event, supplying the member function.
387a3b02 44This event applies to wxApp only.}
a660d684
KB
45\end{twocollist}%
46
47\wxheading{See also}
48
a660d684 49\helpref{wxWindow::Close}{wxwindowclose},\rtfsp
4d5a0f67
GD
50%% GD: OnXXX functions are not documented
51%%\helpref{wxApp::OnEndSession}{wxapponendsession},\rtfsp
a660d684
KB
52\helpref{Window deletion overview}{windowdeletionoverview}
53
54\latexignore{\rtfignore{\wxheading{Members}}}
55
4bcfcdef 56
f510b7b2 57\membersection{wxCloseEvent::wxCloseEvent}\label{wxcloseeventctor}
a660d684
KB
58
59\func{}{wxCloseEvent}{\param{WXTYPE}{ commandEventType = 0}, \param{int}{ id = 0}}
60
61Constructor.
62
4bcfcdef 63
387a3b02
JS
64\membersection{wxCloseEvent::CanVeto}\label{wxcloseeventcanveto}
65
66\func{bool}{CanVeto}{\void}
67
cc81d32f 68Returns true if you can veto a system shutdown or a window close event.
387a3b02
JS
69Vetoing a window close event is not possible if the calling code wishes to
70force the application to exit, and so this function must be called to check this.
71
4bcfcdef 72
a660d684
KB
73\membersection{wxCloseEvent::GetLoggingOff}\label{wxcloseeventgetloggingoff}
74
75\constfunc{bool}{GetLoggingOff}{\void}
76
4bcfcdef
VZ
77Returns true if the user is just logging off or false if the system is
78shutting down. This method can only be called for end session and query end
79session events, it doesn't make sense for close window event.
80
a660d684 81
387a3b02
JS
82\membersection{wxCloseEvent::SetCanVeto}\label{wxcloseeventsetcanveto}
83
84\func{void}{SetCanVeto}{\param{bool}{ canVeto}}
85
86Sets the 'can veto' flag.
87
4bcfcdef 88
387a3b02
JS
89\membersection{wxCloseEvent::SetForce}\label{wxcloseeventsetforce}
90
91\constfunc{void}{SetForce}{\param{bool}{ force}}
92
93Sets the 'force' flag.
94
4bcfcdef 95
387a3b02
JS
96\membersection{wxCloseEvent::SetLoggingOff}\label{wxcloseeventsetloggingoff}
97
98\constfunc{void}{SetLoggingOff}{\param{bool}{ loggingOff}}
99
100Sets the 'logging off' flag.
a660d684 101
4bcfcdef 102
a660d684
KB
103\membersection{wxCloseEvent::Veto}\label{wxcloseeventveto}
104
cc81d32f 105\func{void}{Veto}{\param{bool}{ veto = true}}
387a3b02
JS
106
107Call this from your event handler to veto a system shutdown or to signal
108to the calling application that a window close did not happen.
a660d684 109
387a3b02 110You can only veto a shutdown if \helpref{wxCloseEvent::CanVeto}{wxcloseeventcanveto} returns
cc81d32f 111true.
a660d684
KB
112
113