home *** CD-ROM | disk | FTP | other *** search
/ Using Visual Basic 5 (Platinum Edition) / vb5.iso / ACTIVEX / SRDVID / DATA.Z / chotspot.h < prev    next >
Encoding:
C/C++ Source or Header  |  1996-07-10  |  2.8 KB  |  86 lines

  1. /////////////////////////////////////////////////////////////////////////////
  2. //
  3. //    CHotspot.h : header file
  4. //
  5. /////////////////////////////////////////////////////////////////////////////
  6. //
  7. //  (C) Copyright Black Diamond Consulting, Inc 1996. All rights reserved.
  8. //
  9. //    You have a royalty-free right to use, modify, reproduce and 
  10. //    distribute the Sample Files (and/or any modified version) in 
  11. //    any way you find useful, provided that you agree that Black 
  12. //    Diamond Consulting has no warranty obligations or liability
  13. //    for any Sample Application Files which are modified. 
  14. //
  15. //    Revision History:
  16. //
  17. /////////////////////////////////////////////////////////////////////////////
  18.  
  19. #define __CHOTSPOT_H__
  20.  
  21. #include "Surround.h"
  22.  
  23. /////////////////////////////////////////////////////////////////////////////
  24. // CHotspot object
  25.  
  26. class CHotspot : public CObject
  27. {
  28.  
  29. public:
  30.     int                m_id;            // Hotspot ID
  31.     CString            m_name;            // Hotspot name
  32.     SPHERE_POINT    m_location;        // Location of hotspot
  33.     CSize            m_size;            // Size of hotspot
  34.     BOOL            m_bLocked;        // Locked flag
  35.  
  36. public:    // Accessors
  37.     CString &GetName()                { return m_name; }
  38.     SPHERE_POINT* Location()        { return &m_location; }
  39.     SIZE* Size()                    { return &m_size; }
  40.     void SetWidth( int width )        { m_size.cx = width; }
  41.     void SetHeight( int height )    { m_size.cy = height; }
  42.     int Width()                        { return m_size.cx; }
  43.     int Height()                    { return m_size.cy; }
  44.     BOOL IsLocked()                    { return m_bLocked; }
  45.     int GetID()                        { return m_id; }
  46.     
  47. public:
  48.     CHotspot( int id );
  49.     void Draw( CDC* pDC );
  50.     virtual ~CHotspot();
  51.     HRESULT Write( LPSTREAM pIStream );
  52.     HRESULT Read( LPSTREAM pIStream );
  53. };
  54.  
  55.  
  56. /////////////////////////////////////////////////////////////////////////////
  57. // CHotspotList object
  58. //
  59. //    This class is simply a list manager for hotspots
  60. // 
  61. class CHotspotList : public CObArray
  62. {
  63. private:
  64.     int m_nextID;                    // Next hotspot ID
  65.  
  66. public:
  67.     CHotspotList();
  68.     virtual ~CHotspotList();
  69.     virtual CHotspot* Create( int *id = NULL );            // Create a new hotspot
  70.     HRESULT Write( LPSTREAM pIStream );                    // Write all hotspots to a stream
  71.     HRESULT Read( LPSTREAM pIStream );                    // Read hotspots from a stream
  72.     void ResetContent( void );                            // Delete all hotspots in the list
  73.  
  74. public:    
  75.     void Draw( CDC* pDC );                                // Draw all hotspots
  76.     CHotspot* PtInHotspot( CPoint point );                 // Find Hotspot at point
  77.     BOOL IsValidEntry( CHotspot* pHotspot );
  78.     void Delete( int index );                            // Delete hotspot at given index
  79.     CHotspot* GetById( int id );                        // Get hotspot bv id
  80.     CHotspot* GetByIndex( int index );                    // Get hotspot by index
  81.     int GetIndexFromId( int id );                        // Get hotspot index from it's ID
  82.     int GetIdFromIndex( int index );                    // Get hotspot ID from it's index
  83. };
  84.  
  85.  
  86.