home *** CD-ROM | disk | FTP | other *** search
/ MacFormat 1996 January / macformat-033.iso / mac / Shareware City / Developers / ABox.v1.8 / Header Files / ABTopic.h < prev    next >
Encoding:
C/C++ Source or Header  |  1995-05-23  |  6.4 KB  |  214 lines  |  [TEXT/MMCC]

  1. /*    
  2.     Copyright © 1991-1995 by TopSoft Inc.  All rights reserved.
  3.  
  4.     You may distribute this file under the terms of the TopSoft
  5.     Artistic License, accompanying this package.
  6.     
  7.     This file was developed by George (ty) Tempel in connection with TopSoft, Inc..
  8.     See the Modification History for more details.
  9.  
  10. Product
  11.     About Box
  12.  
  13. FILE
  14.     ABTopic.h
  15.  
  16. NAME
  17.     ABTopic.h, part of the ABox project source code,
  18.     responsible for handling the AboutBox topic class stuff.
  19.  
  20. DESCRIPTION
  21.     This file contains defines for the about box modules.
  22.     
  23. DEVELOPED BY
  24.     George (ty) Tempel                netromancr@aol.com
  25.     All code in this file, and its associated header file was
  26.     Created by George (ty) Tempel in connection with the TopSoft, Inc.
  27.     "FilterTop" application development, except where noted.
  28.  
  29. CARETAKER - George (ty) Tempel <netromancr@aol.com>
  30.      Please consult this person for any changes or suggestions to this file.
  31.  
  32. MODIFICATION HISTORY
  33.  
  34.     dd mmm yy    -    xxx    -    patchxx: description of patch
  35.     9 June 94    -    ty    -    Initial Version Created
  36.     20-july-94    -    ty    -    initial version released
  37.     28-july-94    -    ty    -    1.0.6---removed the cursor stuff to the
  38.                                 mix-in class ABUCursor
  39.     23-may-95    -    ty    -    changes for compatibility with the CodeWarrior CW6
  40.                             release and the associated Universal Headers from Apple:
  41.                             most methods that returned references now have "Ref" at
  42.                             the end of their methods names to prevent possible collisions
  43.                             with datatypes and classes of the same name (older versions
  44.                             of the compiler didn't have a problem with this).
  45.  
  46. */
  47.  
  48. /*===========================================================================*/
  49.  
  50. /*========== Exclusion Macros ============*/
  51.  
  52. #pragma    once
  53.  
  54. #ifndef    _ABTopic_
  55. #define    _ABTopic_
  56.  
  57.  
  58. /*============ Header Files ==============*/
  59.  
  60. #include    "ABLinkedList.h"
  61. #include    "ABObject.h"
  62. #include    "ABSlide.h"
  63.  
  64. /*=========== External Linkage ===========*/
  65.  
  66. /*================ Macros ================*/
  67.  
  68. /*============== Constants ===============*/
  69.  
  70. //    kABTopicSlideResource is the topic/slide resource, found in every file 
  71. //    that should appear in the about box topic list (including the application
  72. //    if you wish to have default or primary slides).
  73. //
  74. #define    kABTopicSlideResource        'TSAb'
  75.  
  76.  
  77. /*================ Enums =================*/
  78.  
  79. enum ETopicType { ETopicType_OtherTopic, ETopicType_Topic, ETopicType_MovieTopic };
  80.  
  81. //    these are properties...
  82.  
  83. #define    kABTopicIndex                'Tidx'
  84. #define    kABTopicIndexSize            (sizeof(ABIndex))
  85.  
  86. #define    kABTopicNumberOfSlides        'Tnsl'
  87. #define    kABTopicNumberOfSlidesSize    (sizeof(ABListCount))
  88.  
  89. #define    kABTopicFSSpec                'Tfss'
  90. #define    kABTopicFSSpecSize            (sizeof(FSSpec))
  91.  
  92. #define    kABTopicName                'Tnam'
  93. #define    kABTopicNameSize            (sizeof(Str255))
  94.  
  95. #define    kABTopicDepth                'Tdep'
  96. #define    kABTopicDepthSize            (sizeof(long))
  97.  
  98. #define    kABTopicType                'Ttyp'
  99. #define    kABTopicTypeSize            (sizeof(ETopicType))
  100.  
  101. #define    kABBadTopicFileRefNum        ((short)-1)
  102.  
  103. /*=============== Structs ================*/
  104.  
  105. /*=============== Typedefs ===============*/
  106.  
  107. /*=========== Class Definitions ==========*/
  108.  
  109. #define    kABTopicSuperProperties    ABObject
  110. class    ABTopic : public ABLink, public ABObject
  111. {
  112.     friend class ABTopicList;
  113.     
  114.     public:
  115.                                 ABTopic(void);
  116.                                 ABTopic(const FSSpec& inTopicFSSpec);
  117.         virtual                    ~ABTopic(void);
  118.  
  119.         virtual    OSErr            GetProperty (ABProperty prop, 
  120.                                             void *ptr, 
  121.                                             long *ptrSize);
  122.         virtual    OSErr            SetProperty (ABProperty prop, 
  123.                                             void *ptr, 
  124.                                             long ptrSize);
  125.         
  126.         virtual    OSErr            Draw(WindowPtr window);
  127.         virtual    OSErr            Update(WindowPtr window);
  128.         virtual    Boolean            Event(EventRecord *event);
  129.         virtual    OSErr            Stop(void);
  130.         
  131.         virtual    OSErr            NextSlide(void);
  132.         virtual    OSErr            PreviousSlide(void);
  133.         virtual    ABSlide*        CurrentSlide(void);
  134.         virtual    OSErr            GotoSlide(long number);
  135.         
  136.         virtual    OSErr            Resize (Rect const *field);
  137.         
  138.                 OSErr            ResizeAndDraw(Rect& inItemRect, WindowPtr inWindow); 
  139.                 
  140.                 Boolean            HasNameRef(void) const { return this->NameRef() != NULL; }
  141.                 Boolean            DoesntHaveNameRef(void) const { return ! this->HasNameRef(); }
  142.                 StringPtr        GetNameRef(void) const { return this->NameRef(); }
  143.                 
  144.                 Boolean            HasSlides(void) const { return this->SlidesRef() != NULL; }
  145.                 Boolean            DoesntHaveSlidesRef(void) const { return ! this->HasSlides(); }
  146.                 
  147.                 Boolean            HasFSSpecPointer(void) const { return this->FSSpecPointerRef() != NULL; }
  148.                 Boolean            DoesntHaveFSSpecPointer(void) const { return ! this->HasFSSpecPointer(); }
  149.                 
  150.                 Boolean            HasValidFileRefNum(void) const { return this->FileRefNumRef() != kABBadTopicFileRefNum; }
  151.                 Boolean            HasInvalidFileRefNum(void) const { return !this->HasValidFileRefNum(); }
  152.                 Boolean            DoesntHaveValidFileRefNum(void) const { return this->HasInvalidFileRefNum(); }
  153.  
  154.                 Boolean            HasFileRefNum(void) const { return this->FileRefNumRef() != kABBadTopicFileRefNum && this->FileRefNumRef() > 0; }
  155.                 Boolean            DoesntHaveFileRefNum(void) const { return ! this->HasFileRefNum(); }
  156.                 
  157.                 long            GetDepth(void) const { return this->Depth(); }
  158.                 long            SetDepth(long inDepth) { return this->Depth() = inDepth; }
  159.                 
  160.     protected:
  161.                 void            ResetFileInfo(void);
  162.                 void            ResetFileRefNum(void);
  163.                 void            ResetFSSpecPointer(void);
  164.                 void            ResetSlideInfo(void);
  165.                 
  166.                 OSErr            Load (void);
  167.                 OSErr            Load (short inFileRefNumber);
  168.         
  169.         //    every subclass of ABTopic overrides the DoLoad and DoCheckSlides methods
  170.         //    to provide their own functionality.
  171.         virtual    OSErr            DoLoad (void);
  172.         virtual    short            DoCheckSlides (void);
  173.  
  174.         virtual    OSErr            CheckAndCopyFSSpec (const FSSpec& file);
  175.     
  176.                 short            UseTopicResFile(void) const;
  177.  
  178.         virtual    OSErr            OpenTopic (void);
  179.         virtual    OSErr            CloseTopic (void);
  180.                 OSErr            CloseTopicFile (void);
  181.                 OSErr            CloseTopicFile (OSErr inError);
  182.         
  183.                 StringPtr        mName;
  184.                 ABLinkedList*    mSlides;
  185.                 FSSpecPtr        mFSSpecPtr;
  186.                 long            mDepth;
  187.                 short            mFileRefNum;
  188.                 ETopicType        mTopicType;
  189.                 
  190.                 StringPtr&        NameRef(void) const { return this->mName; }
  191.                 ABLinkedList*&    SlidesRef(void) const { return this->mSlides; }
  192.                 FSSpecPtr&        FSSpecPointerRef(void) const { return this->mFSSpecPtr; }
  193.                 long&            Depth(void) const { return this->mDepth; }
  194.                 short&            FileRefNumRef(void) const { return this->mFileRefNum; }
  195.                 short            GetFileRefNum(void) const { return this->FileRefNumRef(); }
  196.                 ETopicType&        TopicType(void) const { return this->mTopicType; }
  197.  
  198.     private:
  199.                 void            InitializeTopic(void);
  200. };
  201.  
  202.  
  203.  
  204.  
  205.  
  206.  
  207. /*========== Function Prototypes =========*/
  208.  
  209.  
  210.  
  211.  
  212. #endif    // _ABTopic_
  213.  
  214.