<?xml version="1.0" encoding="utf-8" ?>
<!DOCTYPE erlref SYSTEM "erlref.dtd">

<!-- THIS FILE IS GENERATED DO NOT EDIT -->


<erlref>
<header>
  <copyright>
    <year>2020</year>
    <holder>Ericsson AB. All Rights Reserved.</holder></copyright>
  <legalnotice>
      Licensed under the Apache License, Version 2.0 (the "License");
      you may not use this file except in compliance with the License.
      You may obtain a copy of the License at

          http://www.apache.org/licenses/LICENSE-2.0

      Unless required by applicable law or agreed to in writing, software
      distributed under the License is distributed on an "AS IS" BASIS,
      WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
      See the License for the specific language governing permissions and
      limitations under the License.

  </legalnotice>
  <title>wxCloseEvent</title>
</header>
<module>wxCloseEvent</module>
<modulesummary>Functions for wxCloseEvent class</modulesummary>
<description><p>This event class contains information about window and session close events.
      </p><p>The handler function for EVT_CLOSE is called when the user has tried to close a a frame 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 <seemfa marker="wxWindow#close/2"><c>wxWindow:close/2</c></seemfa> function.
      </p><p>You should check whether the application is forcing the deletion of the window using <seemfa marker="#canVeto/1"><c>canVeto/1</c></seemfa>. If this is false, you <c>must</c> destroy the window using <seemfa marker="wxWindow#'Destroy'/1"><c>wxWindow:'Destroy'/1</c></seemfa>.
      </p><p>If the return value is true, it is up to you whether you respond by destroying the window.
      </p><p>If you don't destroy the window, you should call <seemfa marker="#veto/2"><c>veto/2</c></seemfa> to let the calling code know that you did not destroy the window. This allows the <seemfa marker="wxWindow#close/2"><c>wxWindow:close/2</c></seemfa> function to return true or false depending on whether the close instruction was honoured or not.
      </p><p>Example of a <seeerl marker="wxCloseEvent"><c>wxCloseEvent</c></seeerl> handler:
      </p><p>The EVT_END_SESSION event is slightly different as it is sent by the system when the user session is ending (e.g. because of log out or shutdown) and so all windows are being forcefully closed. At least under MSW, after the handler for this event is executed the program is simply killed by the system. Because of this, the default handler for this event provided by wxWidgets calls all the usual cleanup code (including <c>wxApp::OnExit()</c> (not implemented in wx)) so that it could still be executed and exit()s the process itself, without waiting for being killed. If this behaviour is for some reason undesirable, make sure that you define a handler for this event in your wxApp-derived class and do not call <c>event.Skip()</c> in it (but be aware that the system will still kill your application).
      </p><p>See: <seemfa marker="wxWindow#close/2"><c>wxWindow:close/2</c></seemfa>, <url href="https://docs.wxwidgets.org/3.1/overview_windowdeletion.html#overview_windowdeletion">Overview windowdeletion</url>
      </p>
  <p>This class is derived (and can use functions) from: 
    <seeerl marker="wxEvent"><c>wxEvent</c></seeerl></p>
  
  <p>wxWidgets docs: <url href="https://docs.wxwidgets.org/3.1/classwx_close_event.html">wxCloseEvent</url></p>
  </description><section><title>Events</title><p>Use <seemfa marker="wxEvtHandler#connect/3"><c>wxEvtHandler:connect/3</c></seemfa> with <seetype marker="#wxCloseEventType"><c>wxCloseEventType</c></seetype> to subscribe to events of this type.</p></section>
<datatypes>
    <datatype><name name="wxCloseEvent"/></datatype>
    <datatype><name name="wxClose"/></datatype>
    <datatype><name name="wxCloseEventType"/></datatype></datatypes>

<funcs>
  <func>
    <name name="canVeto" arity="1" clause_i="1" since=""/>
    <fsummary>Returns true if you can veto a system shutdown or a window close event. </fsummary>
    <desc><p>Returns true if you can veto a system shutdown or a window close event. 
      </p><p>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. 
      </p></desc>
  </func>
  
  <func>
    <name name="getLoggingOff" arity="1" clause_i="1" since=""/>
    <fsummary>Returns true if the user is just logging off or false if the system is shutting down. </fsummary>
    <desc><p>Returns true if the user is just logging off or false if the system is shutting down. 
      </p><p>This method can only be called for end session and query end session events, it doesn't make sense for close window event. 
      </p></desc>
  </func>
  
  <func>
    <name name="setCanVeto" arity="2" clause_i="1" since=""/>
    <fsummary>Sets the 'can veto' flag. </fsummary>
    <desc><p>Sets the 'can veto' flag. 
      </p></desc>
  </func>
  
  <func>
    <name name="setLoggingOff" arity="2" clause_i="1" since=""/>
    <fsummary>Sets the 'logging off' flag. </fsummary>
    <desc><p>Sets the 'logging off' flag. 
      </p></desc>
  </func>
  
  <func>
    <name name="veto" arity="1" clause_i="1" since=""/>
    <fsummary>See: <c>veto/2</c></fsummary>
  </func>
  
  <func>
    <name name="veto" arity="2" clause_i="1" since=""/>
    <fsummary>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. </fsummary>
    <desc><p>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. 
      </p><p>You can only veto a shutdown if <seemfa marker="#canVeto/1"><c>canVeto/1</c></seemfa> returns true. 
      </p></desc>
  </func>
  </funcs>
</erlref>
