home *** CD-ROM | disk | FTP | other *** search
/ io Programmo 23 / IOPROG_23.ISO / SOFT / VFORM.ZIP / Source / vctl2.h < prev    next >
Encoding:
C/C++ Source or Header  |  1998-10-10  |  6.4 KB  |  159 lines

  1. // -------------------------------------------------------------------------
  2. // Copyright @ 1997 TCK Software, Incorporated
  3. // All Rights Reserved
  4. // -------------------------------------------------------------------------
  5. #ifndef __VCTL2_H__
  6. #define __VCTL2_H__
  7.  
  8. #ifdef VF_STATIC
  9.     #undef AFX_EXT_CLASS
  10.     #define AFX_EXT_CLASS
  11. #endif
  12.  
  13. #include "VCtl.h"
  14.  
  15. // -------------------------------------------------------------------------
  16. //    VForm Picture Control
  17. // -------------------------------------------------------------------------
  18. class AFX_EXT_CLASS VPicture : public VCtl
  19. {
  20. protected:
  21.     CImageList    m_imgList;        // Our own image list
  22.     int            m_nImageWidth;    // Width of one image (set by user)
  23.     CImageList*    m_pImgList;        // Pointer to the image list
  24.     int            m_nIdx;            // Index to picture
  25.     BOOL        m_bAnimate;        // Animate picture
  26.     int            m_nAnimIdx;        // Animation Index
  27.     int            m_nAnimStartIdx, m_nAnimEndIdx;
  28.     int            m_nAnimRuns, m_nAnimRunCnt;
  29.     
  30. public:
  31.     VPicture();
  32.     VPicture(VRow *pRow, int nId, CImageList* pImgList, int x, int y, int cx, int cy);
  33.     VPicture(VPicture &x) { *this = x; }                    // Copy Constructor
  34.     VPicture&    operator =(VPicture &x);                    // Assignment Operator
  35.  
  36.     // --------- Get Member Functions --------------
  37.     CImageList*    GetImageList()            { return m_pImgList; }
  38.     CImageList*    GetInternalImageList()    { return &m_imgList; }
  39.     int        Index()                { return m_nIdx; }
  40.     int        AnimIndex()            { return m_nAnimIdx; }
  41.     int        ImageWidth()        { return m_nImageWidth; }
  42.     
  43.     // --------- Set Member Functions --------------
  44.     void    Init(VRow *pRow, int nId, CImageList* pImgList, int x, int y, int cx, int cy);
  45.     void    SetImageList(CImageList* pImgList);
  46.     void    Index(int nIdx)        { m_nIdx = nIdx; }
  47.     void    AnimIndex(int nIdx)    { m_nAnimIdx = nIdx; }
  48.     void    AnimIndex(int nStart, int nEnd)        
  49.             { m_nAnimStartIdx = nStart; m_nAnimEndIdx = nEnd;}    
  50.     void    ImageWidth(int nWidth)    { m_nImageWidth = nWidth; }
  51.  
  52.     // --------- Implementation Functions --------------
  53.     void    Animate(int nTimes=1);                        // Starts Animation
  54.     void    UnAnimate();                                // Stops Animation
  55.     BOOL    LoadBitmap(LPCTSTR szBmpFile);                // Loads a BMP File
  56.     BOOL    LoadBitmapRes(LPCTSTR szBmpResource);        // Loads a BMP Resource
  57.     BOOL    LoadBitmapRes(UINT uID);                    // Loads a BMP Resource
  58.  
  59.     virtual int        IsA()            { return VCTL_PICTURE; }
  60.     virtual void    OnDraw(CDC *pDC, LPRECT pRect=0, BOOL bGridMode=0);
  61.     virtual BOOL    OnTimer();    
  62.     // virtual BOOL    OnLButtonDown(UINT nFlags, CPoint pt)    { return FALSE;    }    
  63. };
  64.  
  65.  
  66. // -------------------------------------------------------------------------
  67. //    VForm Picture Button Control
  68. // -------------------------------------------------------------------------
  69. class AFX_EXT_CLASS VPictButton : public VCtl
  70. {
  71. protected:
  72.     CImageList    m_imgList;        // Our own image list
  73.     int            m_nImageWidth;    // Width of one image (set by user)
  74.     BOOL        m_bDown;        // Is the Picture pushed down?
  75.     CImageList*    m_pImgList;        // Pointer to the image list
  76.     int            m_nUpIdx;        // Index to Up picture
  77.     int            m_nDownIdx;        // Index to Up picture
  78.     CSize        m_sizeImage;    // size of one image
  79.     
  80. public:
  81.     VPictButton();
  82.     VPictButton(VRow *pRow, int nId, CImageList* pImgList, int x, int y, int cx, int cy);
  83.     VPictButton(VPictButton &x) { *this = x; }                // Copy Constructor
  84.     VPictButton&    operator =(VPictButton &x);                // Assignment Operator
  85.  
  86.     // --------- Get Member Functions --------------
  87.     BOOL    Down()                { return m_bDown; }
  88.     int        UpIdx()                { return m_nUpIdx; }
  89.     int        DownIdx()            { return m_nDownIdx; }
  90.     int        ImageWidth()        { return m_nImageWidth; }
  91.     
  92.     // --------- Set Member Functions --------------
  93.     void    Init(VRow *pRow, int nId, CImageList* pImgList, int x, int y, int cx, int cy);
  94.     void    SetImageList(CImageList* pImgList);
  95.     void    Down(BOOL bFlag)        { m_bDown = bFlag; }
  96.     void    UpIdx(int nIdx)            { m_nUpIdx = nIdx; }
  97.     void    DownIdx(int nIdx)        { m_nDownIdx = nIdx; }
  98.     void    ImageWidth(int nWidth)    { m_nImageWidth = nWidth; }
  99.     
  100.     // --------- Implementation Functions --------------
  101.     BOOL    LoadBitmap(LPCTSTR szBmpFile);                // Loads a BMP File
  102.     BOOL    LoadBitmapRes(LPCTSTR szBmpResource);        // Loads a BMP Resource
  103.     BOOL    LoadBitmapRes(UINT uID);                    // Loads a BMP Resource
  104.  
  105.     virtual int  IsA()            { return VCTL_PICTBUTTON; }
  106.     virtual void OnDraw(CDC *pDC, LPRECT pRect=0, BOOL bGridMode=0);
  107.     virtual BOOL OnLButtonDown(UINT nFlags, CPoint pt);
  108.     virtual BOOL OnLButtonUp(UINT nFlags, CPoint pt, BOOL bSameCtl);
  109.     virtual BOOL OnEnterDown();
  110.     virtual BOOL OnEnterUp();
  111.     virtual BOOL OnKeyDown(UINT nChar, UINT nRepCnt, UINT nFlags);
  112.     virtual BOOL OnKeyUp(UINT nChar, UINT nRepCnt, UINT nFlags);
  113.     virtual BOOL OnKillFocus(VCtl *pNewCtl)    { m_bDown = FALSE; return TRUE; }
  114. };
  115.  
  116. // -------------------------------------------------------------------------
  117. //    VForm Picture Cycle Control
  118. // -------------------------------------------------------------------------
  119. class AFX_EXT_CLASS VPictCycle : public VCtl
  120. {
  121. protected:
  122.     CImageList    m_imgList;        // Our own image list
  123.     int            m_nImageWidth;    // Width of one image (set by user)
  124.     int            m_nPictCount;    // Total Pictures
  125.     int            m_nIdx;            // What is the index of the curent picture
  126.     CImageList*    m_pImgList;        // Pointer to the image list
  127.     CSize        m_sizeImage;    // size of one image
  128.     
  129. public:
  130.     VPictCycle();
  131.     VPictCycle(VRow *pRow, int nId, CImageList* pImgList, int x, int y, int cx, int cy);
  132.     VPictCycle(VPictCycle &x) { *this = x; }            // Copy Constructor
  133.     VPictCycle&    operator =(VPictCycle &x);                // Assignment Operator
  134.  
  135.     // --------- Get Member Functions --------------
  136.     int        PictCount()            { return m_nPictCount; }
  137.     int        Index()                { return m_nIdx; }
  138.     int        ImageWidth()        { return m_nImageWidth; }
  139.     
  140.     // --------- Set Member Functions --------------
  141.     void    Init(VRow *pRow, int nId, CImageList* pImgList, int x, int y, int cx, int cy);
  142.     void    SetImageList(CImageList* pImgList);
  143.     void    Index(int nIdx)        { m_nIdx = nIdx; }
  144.     void    PictCount(int nCnt)    { m_nPictCount = nCnt; }
  145.     void    ImageWidth(int nWidth)    { m_nImageWidth = nWidth; }
  146.     
  147.     // --------- Implementation Functions --------------
  148.     BOOL    LoadBitmap(LPCTSTR szBmpFile);                // Loads a BMP File
  149.     BOOL    LoadBitmapRes(LPCTSTR szBmpResource);        // Loads a BMP Resource
  150.     BOOL    LoadBitmapRes(UINT uID);                    // Loads a BMP Resource
  151.  
  152.     virtual int  IsA()            { return VCTL_PICTCYCLE; }
  153.     virtual void OnDraw(CDC *pDC, LPRECT pRect=0, BOOL bGridMode=0);
  154.     virtual BOOL OnLButtonDown(UINT nFlags, CPoint pt);                // Cycle picture
  155.     virtual BOOL OnKeyDown(UINT nChar, UINT nRepCnt, UINT nFlags);    // Cycle Picture
  156.     virtual BOOL OnEnterDown();
  157. };
  158.  
  159. #endif