home *** CD-ROM | disk | FTP | other *** search
- // -------------------------------------------------------------------------
- // Copyright @ 1997 TCK Software, Incorporated
- // All Rights Reserved
- // -------------------------------------------------------------------------
- #ifndef __VCTL_H__
- #define __VCTL_H__
-
- #include "VCtlBase.h"
-
- // -------------------------------------------------------------------------
- // VForm Button
- // -------------------------------------------------------------------------
- class AFX_EXT_CLASS VButton : public VCtl
- {
- protected:
- BOOL m_bDown; // Is the button pushed down?
- // int m_nPictureId; // picture on button
-
- public:
- VButton();
- VButton(VRow *pRow, int nId, LPCTSTR szText, int x, int y, int cx, int cy);
- VButton(VButton &x) { *this = x; } // Copy Constructor
- VButton& operator =(VButton &x); // Assignment Operator
-
- // --------- Get Member Functions --------------
- BOOL Down() { return m_bDown; }
-
- // --------- Set Member Functions --------------
- void Init(VRow *pRow, int nId, LPCTSTR szText, int x, int y, int cx, int cy);
- void Down(BOOL x) { m_bDown = x; }
-
- // --------- Implementation Functions --------------
- virtual int IsA() { return VCTL_BUTTON; }
- // virtual void OnDraw(CDC *pDC); // Draw itself
- 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 Check Box
- // -------------------------------------------------------------------------
- class AFX_EXT_CLASS VCheckBox : public VCtl
- {
- protected:
- BOOL m_bChecked; // State of checkbox
- BOOL m_bPushed; // Is button pushed
- BOOL m_bRadioLook; // Draw as a Radio Button
- int m_nBoxSize; // Size of Box
-
- public:
- VCheckBox();
- VCheckBox(VRow *pRow, int nId, LPCTSTR szText,
- int x, int y, int cx, int cy);
- VCheckBox(VCheckBox &x) { *this = x; } // Copy Constructor
- VCheckBox& operator =(VCheckBox &x); // Assignment Operator
-
- // --------- Get Member Functions --------------
- BOOL Checked() { return m_bChecked; }
- BOOL RadioLook() { return m_bRadioLook; }
- int BoxSize() { return m_nBoxSize; }
-
- // --------- Set Member Functions --------------
- void Init(VRow *pRow, int nId, LPCTSTR szText,
- int x, int y, int cx, int cy);
- void Checked(BOOL bFlag) { m_bChecked = bFlag; }
- void Toggle() { m_bChecked = !m_bChecked; }
- void RadioLook(BOOL bFlag) { m_bRadioLook = bFlag; }
- void BoxSize(int nBoxSize) { m_nBoxSize = nBoxSize; }
-
- // --------- Implementation Functions --------------
- virtual int IsA() { return VCTL_CHECKBOX; }
- virtual void OnDraw(CDC *pDC, LPRECT pRect=0, BOOL bGridMode=0);
- virtual BOOL OnLButtonDown(UINT nFlags, CPoint pt); // Toggle Box
- virtual BOOL OnLButtonUp(UINT nFlags, CPoint pt, BOOL bSameCtl);
- virtual BOOL OnKeyDown(UINT nChar, UINT nRepCnt, UINT nFlags);
- virtual BOOL OnKeyUp(UINT nChar, UINT nRepCnt, UINT nFlags);
- virtual BOOL OnKillFocus(VCtl *pNewCtl) { m_bPushed = FALSE; return TRUE; }
- };
-
- // -------------------------------------------------------------------------
- // VForm RadioList
- // -------------------------------------------------------------------------
- class AFX_EXT_CLASS VRadioList : public VCtl
- {
- protected:
- CStringArray m_data; // Array of strings
- int m_nItem; // Index of current item
- int m_nSelItem; // Index of selected item
- BOOL m_bPushed; // Is button pushed
- BOOL m_bVertical; // Vertical or Horizontal
- int m_nBoxSize; // Size of Box
- int m_nTextHeight;
-
- public:
- VRadioList();
- VRadioList(VRow *pRow, int nId, LPCTSTR szText,
- int x, int y, int cx, int cy);
- VRadioList(VRadioList &x) { *this = x; } // Copy Constructor
- VRadioList& operator =(VRadioList &x); // Assignment Operator
-
- // --------- Get Member Functions --------------
- int SelItem() { return m_nSelItem; }
- int BoxSize() { return m_nBoxSize; }
- BOOL Vertical() { return m_bVertical; }
-
- // --------- Set Member Functions --------------
- void Init(VRow *pRow, int nId, LPCTSTR szText,
- int x, int y, int cx, int cy);
- void SelItem(int nSelItem) { m_nSelItem = nSelItem; }
- void BoxSize(int nBoxSize) { m_nBoxSize = nBoxSize; }
- void Vertical(BOOL bFlag) { m_bVertical = bFlag; }
-
- int AddString(LPCTSTR szText) { return m_data.Add(szText); }
- void ResetContent() { m_data.RemoveAll(); }
- long GetCount() { return m_data.GetSize(); }
- CString GetSelString() { return GetString(m_nSelItem); }
- CString GetString(int nItem);
- int GetItemByPoint(CPoint pt);
-
-
- // --------- Implementation Functions --------------
- virtual int IsA() { return VCTL_RADIOLIST; }
- virtual void OnDraw(CDC *pDC, LPRECT pRect=0, BOOL bGridMode=0);
- virtual BOOL OnLButtonDown(UINT nFlags, CPoint pt); // Toggle Box
- virtual BOOL OnLButtonUp(UINT nFlags, CPoint pt, BOOL bSameCtl);
- virtual BOOL OnKeyDown(UINT nChar, UINT nRepCnt, UINT nFlags);
- virtual BOOL OnKeyUp(UINT nChar, UINT nRepCnt, UINT nFlags);
- virtual BOOL OnKillFocus(VCtl *pNewCtl) { m_bPushed = FALSE; return TRUE; }
- };
-
-
-
- // -------------------------------------------------------------------------
- // VForm Static Text Control
- // -------------------------------------------------------------------------
- class AFX_EXT_CLASS VStatic : public VCtl
- {
- protected:
-
- public:
- VStatic();
- VStatic(VRow *pRow, int nId, LPCTSTR szText, int x, int y, int cx, int cy);
- VStatic(VStatic &x) { *this = x; } // Copy Constructor
- VStatic& operator =(VStatic &x); // Assignment Operator
-
- // --------- Get Member Functions --------------
-
- // --------- Set Member Functions --------------
- void Init(VRow *pRow, int nId, LPCTSTR szText, int x, int y, int cx, int cy);
-
- // --------- Implementation Functions --------------
- virtual int IsA() { return VCTL_STATIC; }
- virtual void OnDraw(CDC *pDC, LPRECT pRect=0, BOOL bGridMode=0);
- };
-
- // -------------------------------------------------------------------------
- // VForm Edit Control
- // -------------------------------------------------------------------------
- class AFX_EXT_CLASS VSmallEdit : public VCtl
- {
- protected:
- UINT m_nFlags; // VSmallEdit Flags
- UINT m_nLimitText; // Maximum Chars
- BYTE m_nLeftMargin; // Left Margin
-
- public:
- VSmallEdit();
- VSmallEdit(VRow *pRow, int nId, LPCTSTR szText, int x, int y, int cx, int cy);
- VSmallEdit(VSmallEdit &x) { *this = x; } // Copy Constructor
- VSmallEdit& operator =(VSmallEdit &x); // Assignment Operator
-
- // --------- Get Member Functions --------------
- BOOL MultiLine() { return (m_nFlags & VEDIT_MULTILINE); }
- BOOL ReadOnly() { return (m_nFlags & VEDIT_READONLY); }
- BOOL Password() { return (m_nFlags & VEDIT_PASSWORD); }
- BOOL Numeric() { return (m_nFlags & VEDIT_NUMERIC); }
- BOOL LowerCase() { return (m_nFlags & VEDIT_LOWERCASE); }
- BOOL UpperCase() { return (m_nFlags & VEDIT_UPPERCASE); }
- UINT LimitText() { return m_nLimitText; }
- UINT LeftMargin() { return m_nLeftMargin; }
-
- // --------- Set Member Functions --------------
- void Init(VRow *pRow, int nId, LPCTSTR szText, int x, int y, int cx, int cy);
- void MultiLine(BOOL bFlag) { SetBitFlag(m_nFlags, VEDIT_MULTILINE, bFlag); }
- void ReadOnly(BOOL bFlag) { SetBitFlag(m_nFlags, VEDIT_READONLY, bFlag); }
- void Password(BOOL bFlag) { SetBitFlag(m_nFlags, VEDIT_PASSWORD, bFlag); }
- void Numeric(BOOL bFlag) { SetBitFlag(m_nFlags, VEDIT_NUMERIC, bFlag); }
- void LowerCase(BOOL bFlag) { SetBitFlag(m_nFlags, VEDIT_LOWERCASE, bFlag); }
- void UpperCase(BOOL bFlag) { SetBitFlag(m_nFlags, VEDIT_UPPERCASE, bFlag); }
- void LimitText(UINT nLimit) { m_nLimitText = nLimit; }
- void LeftMargin(UINT nPixels) { m_nLeftMargin = nPixels; }
-
- // --------- Implementation Functions --------------
- void DrawTextEx(CDC *pDC, CRect rect, BOOL bNoBkgrnd, BOOL bGridMode);
- virtual int IsA() { return VCTL_EDIT; }
- virtual void OnDraw(CDC *pDC, LPRECT pRect=0, BOOL bGridMode=0);
-
- // --------- Virtual Helper Functions --------------
- virtual VCtlHelper* CreateHelper(CWnd *pParent);
- virtual int HelperId();
- virtual CRect HelperRect(LPRECT pRect=0, BOOL bGridMode=FALSE);
- virtual BOOL IsHelperDirty(VCtlHelper* pHelper);
- virtual BOOL OnBeginHelper(VCtlHelper* pHelper);
- virtual BOOL OnEndHelper(VCtlHelper* pHelper);
- };
-
- // -------------------------------------------------------------------------
- // VDropDown Control
- // -------------------------------------------------------------------------
- class AFX_EXT_CLASS VDropDown : public VCtl
- {
- protected:
- CStringArray m_data; // Array of strings
- BOOL m_bButtonDown; // Is the button pushed down?
-
- public:
- VDropDown();
- VDropDown(VRow *pRow, int nId, LPCTSTR szText, int x, int y, int cx, int cy);
- VDropDown(VDropDown &x) { *this = x; } // Copy Constructor
- VDropDown& operator =(VDropDown &x); // Assignment Operator
-
- // --------- Get Member Functions --------------
- BOOL ButtonDown() { return m_bButtonDown; }
- CStringArray* GetStringArray() { return &m_data; }
-
- // --------- Set Member Functions --------------
- void Init(VRow *pRow, int nId, LPCTSTR szText, int x, int y, int cx, int cy);
- void ButtonDown(BOOL bFlag) { m_bButtonDown = bFlag; }
-
- // --------- Implementation Functions --------------
- int AddString(LPCTSTR szText) { return m_data.Add(szText); }
- void ResetContent() { m_data.RemoveAll(); }
- long GetCount() { return m_data.GetSize(); }
- CString GetString(int nItem);
-
- virtual int IsA() { return VCTL_DROPDOWN; }
- 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 OnBeginList(CListBox *pListBox);
- virtual BOOL OnEndList(CListBox *pListBox);
- };
-
-
- // -------------------------------------------------------------------------
- // VRectangle Control
- // -------------------------------------------------------------------------
- class AFX_EXT_CLASS VRectangle : public VCtl
- {
- protected:
-
- public:
- VRectangle();
- VRectangle(VRow *pRow, int nId, int x, int y, int cx, int cy);
- VRectangle(VRectangle &x) { *this = x; } // Copy Constructor
- VRectangle& operator =(VRectangle &x); // Assignment Operator
-
- // --------- Get Member Functions --------------
-
- // --------- Set Member Functions --------------
- void Init(VRow *pRow, int nId, int x, int y, int cx, int cy);
-
- // --------- Implementation Functions ------------
- virtual int IsA() { return VCTL_RECTANGLE; }
- virtual void OnDraw(CDC *pDC, LPRECT pRect=0, BOOL bGridMode=0);
- };
-
-
- // -------------------------------------------------------------------------
- // VLine Control
- // -------------------------------------------------------------------------
- class AFX_EXT_CLASS VLine : public VCtl
- {
- protected:
- BOOL m_bVertical; // Draw a Vertical Line
-
- public:
- VLine();
- VLine(VRow *pRow, int nId, int x, int y, int cx, int cy);
- VLine(VLine &x) { *this = x; } // Copy Constructor
- VLine& operator =(VLine &x); // Assignment Operator
-
- // --------- Get Member Functions --------------
- BOOL Vertical() { return m_bVertical; }
-
- // --------- Set Member Functions --------------
- void Init(VRow *pRow, int nId, int x, int y, int cx, int cy);
- void Vertical(BOOL bFlag) { m_bVertical = bFlag; }
-
- // --------- Implementation Functions ------------
- virtual int IsA() { return VCTL_LINE; }
- virtual void OnDraw(CDC *pDC, LPRECT pRect=0, BOOL bGridMode=0);
- };
-
- // -------------------------------------------------------------------------
- // VEllipse Control
- // -------------------------------------------------------------------------
- class AFX_EXT_CLASS VEllipse : public VCtl
- {
- protected:
-
- public:
- VEllipse();
- VEllipse(VRow *pRow, int nId, int x, int y, int cx, int cy);
- VEllipse(VEllipse &x) { *this = x; } // Copy Constructor
- VEllipse& operator =(VEllipse &x); // Assignment Operator
-
- // --------- Set Member Functions --------------
- void Init(VRow *pRow, int nId, int x, int y, int cx, int cy);
-
- // --------- Implementation Functions ------------
- virtual int IsA() { return VCTL_ELLIPSE;}
- virtual void OnDraw(CDC *pDC, LPRECT pRect=0, BOOL bGridMode=0);
- void DrawEtchedEllipse(CDC *pDC, CRect rect, BOOL bBumped=0);
- };
-
-
- #endif
-