home *** CD-ROM | disk | FTP | other *** search
- /*
- Copyright © 1991-1995 by TopSoft Inc. All rights reserved.
-
- You may distribute this file under the terms of the TopSoft
- Artistic License, accompanying this package.
-
- This file was developed by George (ty) Tempel in connection with TopSoft, Inc..
- See the Modification History for more details.
-
- Product
- About Box
-
- FILE
- ABUEnv.c
-
- NAME
- ABUEnv.c, part of the ABox project source code,
- responsible for mix-in handling the AboutBox environment stuff.
-
- DESCRIPTION
- This file contains defines for the about box modules.
-
- DEVELOPED BY
- George (ty) Tempel netromancr@aol.com
- All code in this file, and its associated header file was
- Created by George (ty) Tempel in connection with the TopSoft, Inc.
- "FilterTop" application development, except where noted.
-
- CARETAKER - George (ty) Tempel <netromancr@aol.com>
- Please consult this person for any changes or suggestions to this file.
-
- MODIFICATION HISTORY
-
- dd mmm yy - xxx - patchxx: description of patch
- 10 June 94 - ty - Initial Version Created
- 20-july-94 - ty - initial version released
- 23-may-95 - ty - changes for compatibility with the CodeWarrior CW6
- release and the associated Universal Headers from Apple:
- most methods that returned references now have "Ref" at
- the end of their methods names to prevent possible collisions
- with datatypes and classes of the same name (older versions
- of the compiler didn't have a problem with this).
-
- */
-
- /*===========================================================================*/
-
- /*======= Segmentation directives ========*/
-
- #ifdef USE_MANUAL_SEGMENTATION
- #pragma segment ty
- #endif
-
- /*============ Header files ==============*/
-
- #include "ABUEnv.h"
-
- /*=============== Globals ================*/
-
- /*================ CODE ==================*/
-
-
- /*=============================== ABUEnv::ABUEnv ================================*/
- ABUEnv::ABUEnv(void)
- {
- mCheckedRef = false;
- mIndicator = false;
- mResult = 0;
- } // end ABUEnv
-
-
- /*=============================== ABUEnv::~ABUEnv ================================*/
- ABUEnv::~ABUEnv(void)
- {
- // Close();
- } // end ~ABUEnv
-
-
-
- /*=============================== ABUEnv::CheckGestalt ================================*/
- OSErr
- ABUEnv::CheckGestalt(OSType inGestaltSelector)
- {
- OSErr anError = noErr;
-
- if (this->WasntCheckedRef())
- {
- long theResult = 0;
- this->CheckedRef() = true;
- if (this->GestaltAvailable())
- {
- anError = ::Gestalt(inGestaltSelector, &theResult);
- this->SetResult(theResult);
- } else {
- anError = paramErr;
- }
- } // end if block
- return anError;
- } // end CheckGestalt
-
-
-
- /*=============================== ABUEnv::IsPresent ================================*/
- Boolean ABUEnv::IsPresent(void)
- {
- // OVERRIDE THIS FUNCTION!
- return false;
- } // end IsPresent
-
-
-
- /*=============================== ABUEnv::Feature ================================*/
- Boolean ABUEnv::Feature(long mask)
- {
- Boolean theAnswer = this->GetResult() & mask;
- return theAnswer;
- } // end Feature
-
-
- /*=============================== ABUEnv::Attribute ================================*/
- Boolean ABUEnv::Attribute(short inBitToTest)
- {
- return (((this->GetResult() >> inBitToTest) & 1) != 0);
-
- } // end Attribute
-
-
- /*=============================== ABUEnv::Initialize ================================*/
- OSErr ABUEnv::Initialize(void)
- {
- // OVERRIDE THIS FUNCTION!
- return noErr;
-
- } // end Initialize
-
-
-
- /*=============================== ABUEnv::Close ================================*/
- OSErr ABUEnv::Close(void)
- {
- // OVERRIDE THIS FUNCTION!
- //CleanUp();
- //
- // generally, you should shut down any environment stuff here
- return noErr;
-
- } // end Close
-
-
- /*=============================== ABUEnv::CleanUp ================================*/
- void ABUEnv::CleanUp(void)
- {
- // OVERRIDE THIS FUNCTION!
- //
- // generally, you should release memory here
- return;
-
- } // end CleanUp
-
-
-
- /*=============================== ABUEnv::Begin ================================*/
- OSErr ABUEnv::Begin(void)
- {
- // OVERRIDE THIS FUNCTION!
- return noErr;
-
- } // end Begin
-
-
-
- /*=============================== ABUEnv::End ================================*/
- OSErr ABUEnv::End(void)
- {
- // OVERRIDE THIS FUNCTION!
- return noErr;
-
- } // end End
-
-
-
- /*=============================== Gestalt Stuff ================================*/
- //
- // These routines, from Inside Macintosh sample code, determine whether
- // the Gestalt function is available on the current system.
-
-
- /*=============================== ABUEnv::GestaltAvailable ================================*/
- Boolean ABUEnv::GestaltAvailable(void)
- {
- const gestaltTrap = 0xA1AD;
- return ABUEnv::TrapAvailable(gestaltTrap);
- } // end ABUEnv::GestaltAvailable
-
-
-
- /*=============================== ABUEnv::TrapAvailable ================================*/
- Boolean ABUEnv::TrapAvailable(short theTrap)
- {
- TrapType tType;
- Boolean result;
-
- tType = ABUEnv::GetTrapType(theTrap);
- if(tType == ToolTrap)
- {
- theTrap = ::BitAnd(theTrap, 0x07FF);
- if(theTrap >= NumToolboxTraps())
- theTrap = _Unimplemented;
- }
- result = (::NGetTrapAddress(theTrap, tType) !=
- ::NGetTrapAddress(_Unimplemented, ToolTrap));
- return result;
- } // end TrapAvailable
-
-
-
- /*=============================== ABUEnv::NumToolboxTraps ================================*/
- short ABUEnv::NumToolboxTraps(void)
- {
- if(::NGetTrapAddress(_InitGraf, ToolTrap) == ::NGetTrapAddress(0xAA6E, ToolTrap))
- return 0x0200;
- else
- return 0x0400;
- } // end NumToolboxTraps
-
-
-
- /*=============================== ABUEnv::GetTrapType ================================*/
- TrapType ABUEnv::GetTrapType(short theTrap)
- {
- const trapMask = 0x0800;
-
- if(::BitAnd(theTrap, trapMask) > 0)
- return ToolTrap;
- else
- return OSTrap;
- } // end GetTrapType
-
-
-
-
-