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

  1. /////////////////////////////////////////////////////////////////////////////
  2. //
  3. //  CSurView.h : Interface of the CSurroundView class
  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 __CSURVIEW_H__
  20.  
  21. #include "Surround.h"
  22. #include "dib.h"
  23.  
  24. class CSurroundView : public CView
  25. {                  
  26.  
  27. private: // Data members
  28.     HPALETTE         m_hPalette;            // palette handle for the view
  29.     HBITMAP         m_hOffscreenBitmap;    // bitmap for the current SV
  30.     void*            m_pOffscreenBits;    // bits for the current SV
  31.     CPoint            m_anchorPoint;        // Anchor point
  32.     UINT            m_cursorID;
  33.         
  34.     struct 
  35.     {        
  36.         BITMAPINFOHEADER header;
  37.         RGBQUAD    colors[256];
  38.     } m_offscreenInfo;                    // bitmap for the view
  39.     
  40.     struct 
  41.     {
  42.         short    version;
  43.         short    numberOfEntries;
  44.         PALETTEENTRY entries[256];
  45.     } m_logicalPalette;                    // Palette entries
  46.  
  47. protected: // Data members
  48.     ISurroundView*    m_pSV;                // the surround view pointer
  49.     SPHERE_RECT        m_viewExtents;        // view extents
  50.     SPHERE_POINT    m_location;            // Displayed image coordinates
  51.     CSize            m_size;                // Size of current view
  52.     UINT            m_zoomInKey;        // Key used for zooming in 
  53.     UINT            m_zoomOutKey;        // Key used for zooming out  
  54.     float            m_fZoom;            // Percentage of zoom
  55.  
  56. public: // Accessors
  57.     ISurroundView* GetView()            { return m_pSV; }
  58.     BOOL IsViewPresent()                { return m_pSV != NULL; }
  59.     LONG ViewWidth()                    { return m_size.cx; }
  60.     LONG ViewHeight()                    { return m_size.cy; }
  61.  
  62. protected:
  63.     CSurroundView();
  64.     DECLARE_DYNAMIC( CSurroundView )
  65.     void Reset();
  66.     virtual ISurround* GetISurround() = 0;    // Pure virtual function
  67.     void UpdateOffscreenBitmap();
  68.     BOOL UpdateSurroundView();
  69.     HPALETTE CreateIdentityPalette( int nColors );
  70.     void ScrollImage( CPoint &anchorPoint, BOOL bLeftButton = TRUE );
  71.     void SetZoomKeys( int zoomInKey, int zoomOutKey );
  72.     HGLOBAL GetImage( LPSPHERE_POINT pLocation, LPSIZE pSize );
  73.     BOOL PutImage( PDIB pDib, LPSPHERE_POINT pLocation, LPSIZE pSize );
  74.     BOOL CopyImage( LPSPHERE_POINT pLocation, LPSIZE pSize );
  75.  
  76.     HRESULT SphereToView( LPSPHERE_POINT pLocation, LPPOINT pPoint );
  77.     HRESULT SphereToView( LPSPHERE_POINT pLocation, LPSIZE pSize, LPRECT pRect );
  78.     HRESULT ViewToSphere( LPPOINT pPoint, LPSPHERE_POINT pLocation );
  79.     HRESULT ViewToSphere( LPRECT pRect, LPSPHERE_POINT pLocation, LPSIZE pSize );
  80.  
  81.     //{{AFX_MSG(CSurroundView)
  82.     afx_msg BOOL OnEraseBkgnd( CDC* pDC );
  83.     afx_msg void OnSize( UINT nType, int cx, int cy );
  84.     afx_msg BOOL OnSetCursor( CWnd* pWnd, UINT nHitTest, UINT message );
  85.     afx_msg void OnLButtonDown( UINT nFlags, CPoint point );
  86.     afx_msg void OnKeyDown( UINT nChar, UINT nRepCnt, UINT nFlags );
  87.     //}}AFX_MSG
  88.     DECLARE_MESSAGE_MAP()
  89.  
  90. public:
  91.     virtual ~CSurroundView();
  92.     void GetMaxViewSize( SIZE *pSize );
  93.  
  94.     // ClassWizard generated virtual function overrides
  95.     //{{AFX_VIRTUAL(CSurroundView)
  96.     public:
  97.     virtual void OnDraw( CDC* pDC );  // overridden to draw this view
  98.     virtual void OnInitialUpdate();
  99.     protected:
  100.     //}}AFX_VIRTUAL
  101. };
  102.  
  103.  
  104. /////////////////////////////////////////////////////////////////////////////
  105.