home *** CD-ROM | disk | FTP | other *** search
/ Strictly Windows / STRICTLY.ISO / programs / vbxstud / asvbdo12.h next >
Encoding:
C/C++ Source or Header  |  1994-08-23  |  10.1 KB  |  238 lines

  1. ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
  2. //
  3. //    ASVBDO12.H
  4. //    COPYRIGHT «Denis CHEVRON, 1993, 1994, All rights reserved
  5. //     (You can use this file as you want)
  6. //        
  7. //
  8. //    To use this file, put #include VBXSTD12.H in at the end of your STDAFX.H.
  9. //
  10. ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
  11. //
  12. //    CVBControl extensions for MFC.
  13. //    This file describe following classes:
  14. //
  15. //      CVBProp  ( base class for VBX properties )
  16. //        CInt   ( Class for int properties )
  17. //        CBool  ( Class for BOOL properties )
  18. //        CLong  ( Class for long properties )
  19. //        CFloat ( class for float properties )
  20. //        CPicture ( class for HPIC properties )
  21. //        CHsz   ( class for string properties )
  22. //
  23. //    These classes are used by VBXSTD12.H, see this file for informations.
  24. //
  25. ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
  26. //    
  27. //    This file also defines EVENT macros ( described int the MFC Note 27, Events routines )
  28. //
  29. //        #define AFX_NUM_EVENTPARAM(type, lpParams)
  30. //        #define AFX_NUM_EVENTPARAMINDEX(type, lpParams, index)
  31. //        #define AFX_HLSTR_EVENTPARAM(lpParams) (HLSTR FAR&)
  32. //        #define AFX_HLSTR_EVENTPARAMINDEX(lpParams, index)
  33. //
  34. //    and useful functions:
  35. //    
  36. //        LPSTR   VBAPI _AfxVBDerefHlstr(HLSTR); 
  37. //        USHORT  VBAPI _AfxVBGetHlstrLen(HLSTR hlstr);
  38. //
  39. //    See VBSTD12.H for more informations.
  40. //
  41. ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
  42.  
  43. #ifndef __cplusplus
  44. #error ASVBDO12 Classes require C++ compilation (use a .cpp suffix)
  45. #endif
  46.  
  47. #ifndef __AFXEXT_H__
  48. #error You must include AFXWIN.H and AFXEXT.H before ASVBDO12.H
  49. #endif
  50.  
  51.  
  52. #ifndef _ASVBDO12_H
  53. #define _ASVBDO12_H
  54.  
  55.  
  56.  
  57.             /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
  58.             //    AfxVbAPI
  59.             #ifndef AFXVBAPI_H
  60.             #define AFXVBAPI_H
  61.             
  62.             typedef LPVOID  HLSTR;
  63.             #ifndef VBAPI
  64.             #define VBAPI   FAR PASCAL
  65.             #endif
  66.             typedef unsigned short  USHORT;     
  67.  
  68.             #define AFX_NUM_EVENTPARAM(type, lpParams)   (type FAR&)(**(type FAR* FAR*)lpParams)
  69.             #define AFX_NUM_EVENTPARAMINDEX(type, lpParams, index) (short FAR&)(**((type FAR* FAR*)(lpParams) + index))
  70.             #define AFX_HLSTR_EVENTPARAM(lpParams) (HLSTR FAR&)(*(HLSTR FAR*)lpParams)
  71.             #define AFX_HLSTR_EVENTPARAMINDEX(lpParams, index) (HLSTR FAR&)(*((HLSTR FAR*)(lpParams) + index))
  72.             
  73.             extern LPSTR   VBAPI _AfxVBDerefHlstr(HLSTR); 
  74.             extern USHORT  VBAPI _AfxVBGetHlstrLen(HLSTR hlstr);
  75.             
  76.             #endif //    AfxVbAPI
  77.  
  78.  
  79.  
  80.             /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
  81.             //    CVBProp
  82.             //    Base class for all VBX properties
  83.             //
  84.             class CVBProp : public CObject
  85.                 {
  86.                 public:
  87.                 CVBControl *m_pVBX;
  88.                 int m_nPropIndex;
  89.                 CVBProp(CVBControl *pVBX, int nPropIndex)
  90.                     {
  91.                     m_pVBX = pVBX;
  92.                     m_nPropIndex = nPropIndex;
  93.                     };
  94.                 CVBProp(CVBProp &rVBX)
  95.                     {
  96.                     m_pVBX = rVBX.m_pVBX;
  97.                     m_nPropIndex = rVBX.m_nPropIndex;
  98.                     }
  99.                 };
  100.             
  101.             /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
  102.             //    CInt
  103.             //    int Class for VBX
  104.             //
  105.             class CInt : public CVBProp
  106.                 {
  107.                 public:
  108.                 CInt( CVBControl *pVBX, int nPropIndex) : CVBProp( pVBX, nPropIndex )  {};
  109.                 operator int()    { return (int)(m_pVBX->GetNumProperty(m_nPropIndex)); };
  110.                 void operator = (int Value)    { m_pVBX->SetNumProperty(m_nPropIndex, Value);    };
  111.                 void operator += (int Value) {    m_pVBX->SetNumProperty(m_nPropIndex,  m_pVBX->GetNumProperty(m_nPropIndex) + Value); };
  112.                 void operator -= (int Value) {    m_pVBX->SetNumProperty(m_nPropIndex,  m_pVBX->GetNumProperty(m_nPropIndex) - Value); };
  113.                 void operator *= (int Value) {    m_pVBX->SetNumProperty(m_nPropIndex,  m_pVBX->GetNumProperty(m_nPropIndex) * Value); };
  114.                 void operator /= (int Value) {    m_pVBX->SetNumProperty(m_nPropIndex,  m_pVBX->GetNumProperty(m_nPropIndex) / Value); };
  115.                 void operator %= (int Value) { m_pVBX->SetNumProperty(m_nPropIndex,  m_pVBX->GetNumProperty(m_nPropIndex) % Value); };
  116.                 void operator ^= (int Value) { m_pVBX->SetNumProperty(m_nPropIndex,  m_pVBX->GetNumProperty(m_nPropIndex) ^ Value);    };
  117.                 void operator &= (int Value) { m_pVBX->SetNumProperty(m_nPropIndex,  m_pVBX->GetNumProperty(m_nPropIndex) & Value);    };
  118.                 void operator |= (int Value) { m_pVBX->SetNumProperty(m_nPropIndex,  m_pVBX->GetNumProperty(m_nPropIndex) | Value);    };
  119.                 int operator ++ ()
  120.                     {
  121.                     int Value = (int)( m_pVBX->GetNumProperty(m_nPropIndex) + 1 );
  122.                     m_pVBX->SetNumProperty(m_nPropIndex, Value);
  123.                     return Value;
  124.                     };
  125.                 int operator -- ()
  126.                     {
  127.                     int Value = (int)( m_pVBX->GetNumProperty(m_nPropIndex) - 1 );
  128.                     m_pVBX->SetNumProperty(m_nPropIndex, Value);
  129.                     return Value;
  130.                     };
  131.                 };
  132.             
  133.             /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
  134.             //    CBool
  135.             //    BOOL Class for VBX
  136.             //
  137.             class CBool: public CInt
  138.                 {
  139.                 public:
  140.                 CBool(CVBControl *pVBX, int nPropIndex) : CInt( pVBX, nPropIndex) {};
  141.                 void operator = (int Value)    {    m_pVBX->SetNumProperty(m_nPropIndex, Value);    };
  142.                 };
  143.                                  
  144.  
  145.             /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
  146.             //    CLong
  147.             //    long Class for VBX
  148.             //
  149.             class CLong : public CVBProp
  150.                 {
  151.                 public:
  152.                 CLong(CVBControl *pVBX, int nPropIndex) : CVBProp( pVBX, nPropIndex) {};
  153.                 operator long()    { return m_pVBX->GetNumProperty(m_nPropIndex);};
  154.                 void operator = (long Value) {    m_pVBX->SetNumProperty(m_nPropIndex, Value); };
  155.                 void operator += (long Value) {    m_pVBX->SetNumProperty(m_nPropIndex,  m_pVBX->GetNumProperty(m_nPropIndex) + Value); };
  156.                 void operator -= (long Value) { m_pVBX->SetNumProperty(m_nPropIndex,  m_pVBX->GetNumProperty(m_nPropIndex) - Value); };
  157.                 void operator *= (long Value) {    m_pVBX->SetNumProperty(m_nPropIndex, m_pVBX->GetNumProperty(m_nPropIndex) * Value); };
  158.                 void operator /= (long Value) {    m_pVBX->SetNumProperty(m_nPropIndex, m_pVBX->GetNumProperty(m_nPropIndex) / Value);    };
  159.                 void operator %= (long Value) { m_pVBX->SetNumProperty(m_nPropIndex, m_pVBX->GetNumProperty(m_nPropIndex) % Value);    };
  160.                 void operator ^= (long Value) {    m_pVBX->SetNumProperty(m_nPropIndex, m_pVBX->GetNumProperty(m_nPropIndex) ^ Value);    };
  161.                 void operator &= (long Value) {    m_pVBX->SetNumProperty(m_nPropIndex, m_pVBX->GetNumProperty(m_nPropIndex) & Value);    };
  162.                 void operator |= (long Value) {    m_pVBX->SetNumProperty(m_nPropIndex,  m_pVBX->GetNumProperty(m_nPropIndex) | Value); };
  163.                 long operator ++ ()
  164.                     {
  165.                     long Value = m_pVBX->GetNumProperty(m_nPropIndex) + 1;
  166.                     m_pVBX->SetNumProperty(m_nPropIndex, Value);
  167.                     return Value;
  168.                     };
  169.                 long operator -- ()
  170.                     {
  171.                     long Value = m_pVBX->GetNumProperty(m_nPropIndex) - 1;
  172.                     m_pVBX->SetNumProperty(m_nPropIndex, Value);
  173.                     return Value;
  174.                     };
  175.                 };
  176.             
  177.             
  178.             /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
  179.             //    CFloat
  180.             //    float Class for VBX
  181.             //
  182.             class CFloat : public CVBProp
  183.                 {
  184.                 public:
  185.                 CFloat(CVBControl *pVBX, int nPropIndex) : CVBProp( pVBX, nPropIndex) {};
  186.                 operator float()    { return m_pVBX->GetFloatProperty(m_nPropIndex);};
  187.                 void operator = (float Value) {    m_pVBX->SetFloatProperty(m_nPropIndex, Value); };
  188.                 void operator += (float Value) {    m_pVBX->SetFloatProperty(m_nPropIndex,  m_pVBX->GetFloatProperty(m_nPropIndex) + Value); };
  189.                 void operator -= (float Value) { m_pVBX->SetFloatProperty(m_nPropIndex,  m_pVBX->GetFloatProperty(m_nPropIndex) - Value); };
  190.                 void operator *= (float Value) {    m_pVBX->SetFloatProperty(m_nPropIndex, m_pVBX->GetFloatProperty(m_nPropIndex) * Value); };
  191.                 void operator /= (float Value) {    m_pVBX->SetFloatProperty(m_nPropIndex, m_pVBX->GetFloatProperty(m_nPropIndex) / Value);    };
  192.                 float operator ++ ()
  193.                     {
  194.                     float Value = m_pVBX->GetFloatProperty(m_nPropIndex) + 1;
  195.                     m_pVBX->SetFloatProperty(m_nPropIndex, Value);
  196.                     return Value;
  197.                     };
  198.                 float operator -- ()
  199.                     {
  200.                     float Value = m_pVBX->GetFloatProperty(m_nPropIndex) - 1;
  201.                     m_pVBX->SetFloatProperty(m_nPropIndex, Value);
  202.                     return Value;
  203.                     };
  204.                 };
  205.  
  206.  
  207.              /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
  208.             //    CPicture
  209.             //    Picture (HPIC) Class for VBX
  210.             //
  211.             class CPicture : public CVBProp
  212.             {
  213.             public:
  214.             CPicture(CVBControl *pVBX, int nPropIndex) : CVBProp(pVBX, nPropIndex) {};
  215.             operator HPIC() { return m_pVBX->GetPictureProperty(m_nPropIndex);    };
  216.             void operator = (HPIC hPic)    {m_pVBX->SetPictureProperty(m_nPropIndex, hPic); };
  217.             };
  218.             
  219.  
  220.  
  221.             /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
  222.             //    CHsz
  223.             //    String ( HSZ ) Class for VBX
  224.             //
  225.             class CHsz : public CVBProp
  226.                 {
  227.                 public:
  228.                 CHsz( CVBControl *pVBX, int nPropIndex) : CVBProp(pVBX, nPropIndex) {};
  229.                 void operator =(LPCSTR Value) {    m_pVBX->SetStrProperty(m_nPropIndex, Value);};
  230.                 operator CString() { return m_pVBX->GetStrProperty(m_nPropIndex); };
  231.                 };
  232.  
  233.  
  234.             
  235. #endif
  236.                      
  237.  
  238.