Headers/UserTermination.h

/*
    File:       UserTermination.h
 
    Contains:   TUserTermination is a command dot tracking class, used for finding out if the end user wants to stop
                an action. Most of the code is based on earlier snippet by Dave Radcliffe/DTS.
                TUserTermination.h contains the header file information for the TUserTermination class.
 
    Written by: Kent Sandvik    
 
    Copyright:  Copyright © 1992-1999 by Apple Computer, Inc., All Rights Reserved.
 
                You may incorporate this Apple sample source code into your program(s) without
                restriction. This Apple sample source code has been provided "AS IS" and the
                responsibility for its operation is yours. You are not permitted to redistribute
                this Apple sample source code as "Apple sample source code" after having made
                changes. If you're going to re-distribute the source, we require that you make
                it clear in the source that the code was descended from Apple sample source
                code, but that you've made changes.
 
    Change History (most recent first):
                8/18/1999   Karl Groethe    Updated for Metrowerks Codewarror Pro 2.1
                
 
*/
// Declare label for this header file
#ifndef _USERTERMINATION_
#define _USERTERMINATION_
 
#ifndef _DTSCPLUSLIBRARY_
#include "DTSCPlusLibrary.h"
#endif
 
#ifndef __SCRIPT__
#include <Script.h>
#endif
 
#ifndef __EVENTS__
#include <Events.h>
#endif
 
#ifndef __RESOURCES__
#include <Resources.h>
#endif
 
#ifndef __OSEVENTS__
#include <OSEvents.h>
#endif
 
#ifndef __GESTALTEQU__
#include <GestaltEqu.h>
#endif
 
 
 
 
 
// _________________________________________________________________________________________________________ //
//  Class Interface
 
class TUserTermination
// TUserTermination is a simple event checking class, that tries to find out when the end user
// has pressed a '.' and a command key, or another combination reminding of a termination
// (such as command-q, even if command-. is the official Apple User Interface way of doing things.
{
public:
    //  ENUMS AND TYPEDEFS
    enum EConstant
    {
        kAUXFindEvent = 8, ktAscii2Mask = 0x000000FF, ktAscii1Mask = 0x00FF0000
    };
 
    //  CONSTRUCTORS AND DESTRUCTORS
    TUserTermination(char ASCIIValue = '.');    // Note dot ('.') as the default ascii char
    virtual~ TUserTermination();
 
    //  INITIALIZATION ROUTINES 
    virtual void Initialize();
 
    //  MAIN INTERFACE
    virtual Boolean Abort();                    // main function
 
protected:
    char fChar;                                 // our initial key value
    char fKeyCode;                              // the key value translated to a virtual code char
    Boolean fAUX;                               // do we run under A/UX or not (different event handling)
};
 
#endif
 
// _________________________________________________________________________________________________________ //
 
 
/*  Change History (most recent last):
  No        Init.   Date        Comment
  1         khs     9/26/92     New file
*/