## wxCloseEvent

This event class contains information about window and session close events.

Derived from

wxEvent

Include files

<wx/event.h>

Event table macros

To process a close event, use these event handler macros to direct input to member functions that take a wxCloseEvent argument.

EVT_CLOSE(func) | Process a close event, supplying the member function. This event applies to wxFrame and wxDialog classes.
EVT_QUERY_END_SESSION(func) | Process a query end session event, supplying the member function. This event applies to wxApp only.
EVT_END_SESSION(func) | Process an end session event, supplying the member function. This event applies to wxApp only.

See also

wxWindow::OnCloseWindow, wxWindow::Close, wxApp::OnQueryEndSession, wxApp::OnEndSession, Window deletion overview

Members

wxCloseEvent::wxCloseEvent
wxCloseEvent::CanVeto
wxCloseEvent::GetLoggingOff
wxCloseEvent::GetSessionEnding
wxCloseEvent::GetForce
wxCloseEvent::SetCanVeto
wxCloseEvent::SetForce
wxCloseEvent::SetLoggingOff
wxCloseEvent::Veto

### wxCloseEvent::wxCloseEvent

wxCloseEvent(WXTYPE commandEventType = 0, int id = 0)

Constructor.

### wxCloseEvent::CanVeto

bool CanVeto()

Returns TRUE if you can veto a system shutdown or a window close event. 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.

### wxCloseEvent::GetLoggingOff

bool GetLoggingOff() const

Returns TRUE if the user is logging off.

### wxCloseEvent::GetSessionEnding

bool GetSessionEnding() const

Returns TRUE if the session is ending.

### wxCloseEvent::GetForce

bool GetForce() const

Returns TRUE if the application wishes to force the window to close. This will shortly be obsolete, replaced by CanVeto.

### wxCloseEvent::SetCanVeto

void SetCanVeto(bool canVeto)

Sets the 'can veto' flag.

### wxCloseEvent::SetForce

void SetForce(bool force) const

Sets the 'force' flag.

### wxCloseEvent::SetLoggingOff

void SetLoggingOff(bool loggingOff) const

Sets the 'logging off' flag.

### wxCloseEvent::Veto

void Veto(bool veto = TRUE)

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.

You can only veto a shutdown if wxCloseEvent::CanVeto returns TRUE.