home *** CD-ROM | disk | FTP | other *** search
- // -------------------------------------------------------------------------
- // Copyright @ 1997 TCK Software, Incorporated
- // All Rights Reserved
- // -------------------------------------------------------------------------
- #ifndef __VCTLOLE_H__
- #define __VCTLOLE_H__
-
- #ifdef VF_STATIC
- #undef AFX_EXT_CLASS
- #define AFX_EXT_CLASS
- #endif
-
- #include "VCtl.h"
- #include "VCtlHelp.h"
- #include "MSMask.h"
-
- // -------------------------------------------------------------------------
- // VMaskEdit helper control.
- // -------------------------------------------------------------------------
- class AFX_EXT_CLASS VMaskEditHelper : public VCtlHelper
- {
- protected:
- CMSMask m_ctlMask; // Helper CMSMask class
-
- // -- Temp control only used with a Format - which is not working in the
- // -- CMSMask class - therefore this is commented out
- // CMSMask m_ctlTmpMask; // Temporary (Invisible) helper
-
- public:
- VMaskEditHelper(CWnd *pParent);
- virtual ~VMaskEditHelper() {};
-
- virtual int Id() { return VHELPER_MASK; } // Helper Id (index)
- static int HelperId() { return VHELPER_MASK; } // Helper Id (index)
- virtual void Hide();
- virtual void Show(CRect rect);
- CMSMask* GetControl() { return &m_ctlMask; } // The control
- // CMSMask* GetTmpControl() { return &m_ctlTmpMask; } // The temporary control
- CWnd* GetCWnd() { return &m_ctlMask; } // The control
- };
-
-
- // -------------------------------------------------------------------------
- // VForm Masked Edit Control
- // -------------------------------------------------------------------------
- class AFX_EXT_CLASS VMaskEdit : public VCtl
- {
- protected:
- BOOL m_bNoInactiveBorder;
- BOOL m_bPromptInclude; // TRUE to include prompt characters
- BOOL m_bAutoTab; // TRUE to automatically tab when full
- UINT m_nLimitText; // Maximum Chars
- BYTE m_nLeftMargin; // Left Margin
- CString m_mask; // Mask String
- // CString m_format; // Format String
-
- public:
- VMaskEdit();
- VMaskEdit(VRow *pRow, int nId, LPCTSTR szText, int x, int y, int cx, int cy);
- VMaskEdit(VMaskEdit &x) { *this = x; } // Copy Constructor
- VMaskEdit& operator =(VMaskEdit &x); // Assignment Operator
-
- // --------- Get Member Functions --------------
- UINT LimitText() { return m_nLimitText; }
- BOOL NoInactiveBorder() { return m_bNoInactiveBorder; }
- BOOL PromptInclude() { return m_bPromptInclude; }
- BOOL AutoTab() { return m_bAutoTab; }
- UINT LeftMargin() { return m_nLeftMargin; }
- CString& Mask() { return m_mask; }
- // CString& Format() { return m_format; }
-
- // --------- Set Member Functions --------------
- void Init(VRow *pRow, int nId, LPCTSTR szText, int x, int y, int cx, int cy);
- void LimitText(UINT nLimit) { m_nLimitText = nLimit < 1 ? 64 : nLimit; }
- void NoInactiveBorder(BOOL bFlag) { m_bNoInactiveBorder = bFlag; }
- void PromptInclude(BOOL bFlag) { m_bPromptInclude = bFlag; }
- void AutoTab(BOOL bFlag) { m_bAutoTab = bFlag; }
- void LeftMargin(UINT nPixels) { m_nLeftMargin = nPixels; }
- void Mask(LPCTSTR szMask) { m_mask = szMask; }
- // void Format(LPCTSTR szFormat) { m_format = szFormat; }
-
- // --------- Implementation Functions --------------
- void DrawTextEx(CDC *pDC, CRect rect, BOOL bNoBkgrnd=FALSE);
- virtual int IsA() { return VCTL_EDIT; }
- virtual void OnDraw(CDC *pDC, LPRECT pRect=0, BOOL bGridMode=0);
-
- 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);
-
- protected:
- CString ApplyMaskToText(LPCTSTR szText);
- };
-
- #endif