home *** CD-ROM | disk | FTP | other *** search
- // -------------------------------------------------------------------------
- // Copyright @ 1997 TCK Software, Incorporated
- // All Rights Reserved
- // -------------------------------------------------------------------------
- #ifndef __VCTL2_H__
- #define __VCTL2_H__
-
- #ifdef VF_STATIC
- #undef AFX_EXT_CLASS
- #define AFX_EXT_CLASS
- #endif
-
- #include "VCtl.h"
-
- // -------------------------------------------------------------------------
- // VForm Picture Control
- // -------------------------------------------------------------------------
- class AFX_EXT_CLASS VPicture : public VCtl
- {
- protected:
- CImageList m_imgList; // Our own image list
- int m_nImageWidth; // Width of one image (set by user)
- CImageList* m_pImgList; // Pointer to the image list
- int m_nIdx; // Index to picture
- BOOL m_bAnimate; // Animate picture
- int m_nAnimIdx; // Animation Index
- int m_nAnimStartIdx, m_nAnimEndIdx;
- int m_nAnimRuns, m_nAnimRunCnt;
-
- public:
- VPicture();
- VPicture(VRow *pRow, int nId, CImageList* pImgList, int x, int y, int cx, int cy);
- VPicture(VPicture &x) { *this = x; } // Copy Constructor
- VPicture& operator =(VPicture &x); // Assignment Operator
-
- // --------- Get Member Functions --------------
- CImageList* GetImageList() { return m_pImgList; }
- CImageList* GetInternalImageList() { return &m_imgList; }
- int Index() { return m_nIdx; }
- int AnimIndex() { return m_nAnimIdx; }
- int ImageWidth() { return m_nImageWidth; }
-
- // --------- Set Member Functions --------------
- void Init(VRow *pRow, int nId, CImageList* pImgList, int x, int y, int cx, int cy);
- void SetImageList(CImageList* pImgList);
- void Index(int nIdx) { m_nIdx = nIdx; }
- void AnimIndex(int nIdx) { m_nAnimIdx = nIdx; }
- void AnimIndex(int nStart, int nEnd)
- { m_nAnimStartIdx = nStart; m_nAnimEndIdx = nEnd;}
- void ImageWidth(int nWidth) { m_nImageWidth = nWidth; }
-
- // --------- Implementation Functions --------------
- void Animate(int nTimes=1); // Starts Animation
- void UnAnimate(); // Stops Animation
- BOOL LoadBitmap(LPCTSTR szBmpFile); // Loads a BMP File
- BOOL LoadBitmapRes(LPCTSTR szBmpResource); // Loads a BMP Resource
- BOOL LoadBitmapRes(UINT uID); // Loads a BMP Resource
-
- virtual int IsA() { return VCTL_PICTURE; }
- virtual void OnDraw(CDC *pDC, LPRECT pRect=0, BOOL bGridMode=0);
- virtual BOOL OnTimer();
- // virtual BOOL OnLButtonDown(UINT nFlags, CPoint pt) { return FALSE; }
- };
-
-
- // -------------------------------------------------------------------------
- // VForm Picture Button Control
- // -------------------------------------------------------------------------
- class AFX_EXT_CLASS VPictButton : public VCtl
- {
- protected:
- CImageList m_imgList; // Our own image list
- int m_nImageWidth; // Width of one image (set by user)
- BOOL m_bDown; // Is the Picture pushed down?
- CImageList* m_pImgList; // Pointer to the image list
- int m_nUpIdx; // Index to Up picture
- int m_nDownIdx; // Index to Up picture
- CSize m_sizeImage; // size of one image
-
- public:
- VPictButton();
- VPictButton(VRow *pRow, int nId, CImageList* pImgList, int x, int y, int cx, int cy);
- VPictButton(VPictButton &x) { *this = x; } // Copy Constructor
- VPictButton& operator =(VPictButton &x); // Assignment Operator
-
- // --------- Get Member Functions --------------
- BOOL Down() { return m_bDown; }
- int UpIdx() { return m_nUpIdx; }
- int DownIdx() { return m_nDownIdx; }
- int ImageWidth() { return m_nImageWidth; }
-
- // --------- Set Member Functions --------------
- void Init(VRow *pRow, int nId, CImageList* pImgList, int x, int y, int cx, int cy);
- void SetImageList(CImageList* pImgList);
- void Down(BOOL bFlag) { m_bDown = bFlag; }
- void UpIdx(int nIdx) { m_nUpIdx = nIdx; }
- void DownIdx(int nIdx) { m_nDownIdx = nIdx; }
- void ImageWidth(int nWidth) { m_nImageWidth = nWidth; }
-
- // --------- Implementation Functions --------------
- BOOL LoadBitmap(LPCTSTR szBmpFile); // Loads a BMP File
- BOOL LoadBitmapRes(LPCTSTR szBmpResource); // Loads a BMP Resource
- BOOL LoadBitmapRes(UINT uID); // Loads a BMP Resource
-
- virtual int IsA() { return VCTL_PICTBUTTON; }
- virtual void OnDraw(CDC *pDC, LPRECT pRect=0, BOOL bGridMode=0);
- virtual BOOL OnLButtonDown(UINT nFlags, CPoint pt);
- virtual BOOL OnLButtonUp(UINT nFlags, CPoint pt, BOOL bSameCtl);
- virtual BOOL OnEnterDown();
- virtual BOOL OnEnterUp();
- virtual BOOL OnKeyDown(UINT nChar, UINT nRepCnt, UINT nFlags);
- virtual BOOL OnKeyUp(UINT nChar, UINT nRepCnt, UINT nFlags);
- virtual BOOL OnKillFocus(VCtl *pNewCtl) { m_bDown = FALSE; return TRUE; }
- };
-
- // -------------------------------------------------------------------------
- // VForm Picture Cycle Control
- // -------------------------------------------------------------------------
- class AFX_EXT_CLASS VPictCycle : public VCtl
- {
- protected:
- CImageList m_imgList; // Our own image list
- int m_nImageWidth; // Width of one image (set by user)
- int m_nPictCount; // Total Pictures
- int m_nIdx; // What is the index of the curent picture
- CImageList* m_pImgList; // Pointer to the image list
- CSize m_sizeImage; // size of one image
-
- public:
- VPictCycle();
- VPictCycle(VRow *pRow, int nId, CImageList* pImgList, int x, int y, int cx, int cy);
- VPictCycle(VPictCycle &x) { *this = x; } // Copy Constructor
- VPictCycle& operator =(VPictCycle &x); // Assignment Operator
-
- // --------- Get Member Functions --------------
- int PictCount() { return m_nPictCount; }
- int Index() { return m_nIdx; }
- int ImageWidth() { return m_nImageWidth; }
-
- // --------- Set Member Functions --------------
- void Init(VRow *pRow, int nId, CImageList* pImgList, int x, int y, int cx, int cy);
- void SetImageList(CImageList* pImgList);
- void Index(int nIdx) { m_nIdx = nIdx; }
- void PictCount(int nCnt) { m_nPictCount = nCnt; }
- void ImageWidth(int nWidth) { m_nImageWidth = nWidth; }
-
- // --------- Implementation Functions --------------
- BOOL LoadBitmap(LPCTSTR szBmpFile); // Loads a BMP File
- BOOL LoadBitmapRes(LPCTSTR szBmpResource); // Loads a BMP Resource
- BOOL LoadBitmapRes(UINT uID); // Loads a BMP Resource
-
- virtual int IsA() { return VCTL_PICTCYCLE; }
- virtual void OnDraw(CDC *pDC, LPRECT pRect=0, BOOL bGridMode=0);
- virtual BOOL OnLButtonDown(UINT nFlags, CPoint pt); // Cycle picture
- virtual BOOL OnKeyDown(UINT nChar, UINT nRepCnt, UINT nFlags); // Cycle Picture
- virtual BOOL OnEnterDown();
- };
-
- #endif