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

  1. // -------------------------------------------------------------------------
  2. // Copyright @ 1997 TCK Software, Incorporated
  3. // All Rights Reserved
  4. // -------------------------------------------------------------------------
  5. #ifndef __VCTLOLE_H__
  6. #define __VCTLOLE_H__
  7.  
  8. #ifdef VF_STATIC
  9.     #undef AFX_EXT_CLASS
  10.     #define AFX_EXT_CLASS
  11. #endif
  12.  
  13. #include "VCtl.h"
  14. #include "VCtlHelp.h"
  15. #include "MSMask.h"
  16.  
  17. // -------------------------------------------------------------------------
  18. //  VMaskEdit helper control.
  19. // -------------------------------------------------------------------------
  20. class AFX_EXT_CLASS VMaskEditHelper : public VCtlHelper
  21. {
  22. protected:
  23.     CMSMask        m_ctlMask;                // Helper CMSMask class
  24.  
  25.     // -- Temp control only used with a Format - which is not working in the
  26.     // -- CMSMask class - therefore this is commented out
  27.     // CMSMask        m_ctlTmpMask;            // Temporary (Invisible) helper
  28.  
  29. public:
  30.     VMaskEditHelper(CWnd *pParent);
  31.     virtual ~VMaskEditHelper() {};
  32.  
  33.     virtual        int Id()        { return VHELPER_MASK; }    // Helper Id (index)
  34.     static        int HelperId()    { return VHELPER_MASK; }    // Helper Id (index)
  35.     virtual        void Hide();
  36.     virtual        void Show(CRect rect);
  37.     CMSMask*    GetControl()    { return &m_ctlMask; }        // The control
  38.     // CMSMask*    GetTmpControl()    { return &m_ctlTmpMask; }    // The temporary control
  39.     CWnd*        GetCWnd()        { return &m_ctlMask; }        // The control
  40. };
  41.  
  42.  
  43. // -------------------------------------------------------------------------
  44. //    VForm Masked Edit Control
  45. // -------------------------------------------------------------------------
  46. class AFX_EXT_CLASS VMaskEdit : public VCtl 
  47. {
  48. protected:
  49.     BOOL    m_bNoInactiveBorder;
  50.     BOOL    m_bPromptInclude;        // TRUE to include prompt characters
  51.     BOOL    m_bAutoTab;                // TRUE to automatically tab when full
  52.     UINT    m_nLimitText;            // Maximum Chars
  53.     BYTE    m_nLeftMargin;            // Left Margin
  54.     CString    m_mask;                    // Mask String
  55.     // CString    m_format;                // Format String
  56.  
  57. public:
  58.     VMaskEdit();
  59.     VMaskEdit(VRow *pRow, int nId, LPCTSTR szText, int x, int y, int cx, int cy);
  60.     VMaskEdit(VMaskEdit &x) { *this = x; }                // Copy Constructor
  61.     VMaskEdit&    operator =(VMaskEdit &x);                // Assignment Operator
  62.  
  63.     // --------- Get Member Functions --------------
  64.     UINT    LimitText()                { return m_nLimitText; }
  65.     BOOL    NoInactiveBorder()        { return m_bNoInactiveBorder; }
  66.     BOOL    PromptInclude()            { return m_bPromptInclude; }
  67.     BOOL    AutoTab()                { return m_bAutoTab; }
  68.     UINT    LeftMargin()            { return m_nLeftMargin; }
  69.     CString& Mask()                    { return m_mask; }
  70.     // CString& Format()                { return m_format; }
  71.  
  72.     // --------- Set Member Functions --------------
  73.     void    Init(VRow *pRow, int nId, LPCTSTR szText, int x, int y, int cx, int cy);
  74.     void    LimitText(UINT nLimit)            { m_nLimitText = nLimit < 1 ? 64 : nLimit; }
  75.     void    NoInactiveBorder(BOOL bFlag)    { m_bNoInactiveBorder = bFlag; }
  76.     void    PromptInclude(BOOL bFlag)        { m_bPromptInclude = bFlag; }
  77.     void    AutoTab(BOOL bFlag)                { m_bAutoTab = bFlag; }
  78.     void    LeftMargin(UINT nPixels)        { m_nLeftMargin = nPixels; }
  79.     void    Mask(LPCTSTR szMask)                { m_mask = szMask; }
  80.     // void    Format(LPCTSTR szFormat)            { m_format = szFormat; }
  81.  
  82.     // --------- Implementation Functions --------------
  83.     void    DrawTextEx(CDC *pDC, CRect rect, BOOL bNoBkgrnd=FALSE);
  84.     virtual int        IsA()                { return VCTL_EDIT; }
  85.     virtual void    OnDraw(CDC *pDC, LPRECT pRect=0, BOOL bGridMode=0);
  86.  
  87.     virtual VCtlHelper*    CreateHelper(CWnd *pParent);
  88.     virtual int        HelperId();
  89.     virtual CRect    HelperRect(LPRECT pRect=0, BOOL bGridMode=FALSE);
  90.     virtual BOOL    IsHelperDirty(VCtlHelper* pHelper);
  91.     virtual BOOL    OnBeginHelper(VCtlHelper* pHelper);    
  92.     virtual BOOL    OnEndHelper(VCtlHelper* pHelper);
  93.  
  94. protected:
  95.     CString ApplyMaskToText(LPCTSTR szText);
  96. };
  97.  
  98. #endif