home *** CD-ROM | disk | FTP | other *** search
- ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
- //
- // ASVBDO12.H
- // COPYRIGHT «Denis CHEVRON, 1993, 1994, All rights reserved
- // (You can use this file as you want)
- //
- //
- // To use this file, put #include VBXSTD12.H in at the end of your STDAFX.H.
- //
- ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
- //
- // CVBControl extensions for MFC.
- // This file describe following classes:
- //
- // CVBProp ( base class for VBX properties )
- // CInt ( Class for int properties )
- // CBool ( Class for BOOL properties )
- // CLong ( Class for long properties )
- // CFloat ( class for float properties )
- // CPicture ( class for HPIC properties )
- // CHsz ( class for string properties )
- //
- // These classes are used by VBXSTD12.H, see this file for informations.
- //
- ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
- //
- // This file also defines EVENT macros ( described int the MFC Note 27, Events routines )
- //
- // #define AFX_NUM_EVENTPARAM(type, lpParams)
- // #define AFX_NUM_EVENTPARAMINDEX(type, lpParams, index)
- // #define AFX_HLSTR_EVENTPARAM(lpParams) (HLSTR FAR&)
- // #define AFX_HLSTR_EVENTPARAMINDEX(lpParams, index)
- //
- // and useful functions:
- //
- // LPSTR VBAPI _AfxVBDerefHlstr(HLSTR);
- // USHORT VBAPI _AfxVBGetHlstrLen(HLSTR hlstr);
- //
- // See VBSTD12.H for more informations.
- //
- ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
-
- #ifndef __cplusplus
- #error ASVBDO12 Classes require C++ compilation (use a .cpp suffix)
- #endif
-
- #ifndef __AFXEXT_H__
- #error You must include AFXWIN.H and AFXEXT.H before ASVBDO12.H
- #endif
-
-
- #ifndef _ASVBDO12_H
- #define _ASVBDO12_H
-
-
-
- /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
- // AfxVbAPI
- #ifndef AFXVBAPI_H
- #define AFXVBAPI_H
-
- typedef LPVOID HLSTR;
- #ifndef VBAPI
- #define VBAPI FAR PASCAL
- #endif
- typedef unsigned short USHORT;
-
- #define AFX_NUM_EVENTPARAM(type, lpParams) (type FAR&)(**(type FAR* FAR*)lpParams)
- #define AFX_NUM_EVENTPARAMINDEX(type, lpParams, index) (short FAR&)(**((type FAR* FAR*)(lpParams) + index))
- #define AFX_HLSTR_EVENTPARAM(lpParams) (HLSTR FAR&)(*(HLSTR FAR*)lpParams)
- #define AFX_HLSTR_EVENTPARAMINDEX(lpParams, index) (HLSTR FAR&)(*((HLSTR FAR*)(lpParams) + index))
-
- extern LPSTR VBAPI _AfxVBDerefHlstr(HLSTR);
- extern USHORT VBAPI _AfxVBGetHlstrLen(HLSTR hlstr);
-
- #endif // AfxVbAPI
-
-
-
- /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
- // CVBProp
- // Base class for all VBX properties
- //
- class CVBProp : public CObject
- {
- public:
- CVBControl *m_pVBX;
- int m_nPropIndex;
- CVBProp(CVBControl *pVBX, int nPropIndex)
- {
- m_pVBX = pVBX;
- m_nPropIndex = nPropIndex;
- };
- CVBProp(CVBProp &rVBX)
- {
- m_pVBX = rVBX.m_pVBX;
- m_nPropIndex = rVBX.m_nPropIndex;
- }
- };
-
- /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
- // CInt
- // int Class for VBX
- //
- class CInt : public CVBProp
- {
- public:
- CInt( CVBControl *pVBX, int nPropIndex) : CVBProp( pVBX, nPropIndex ) {};
- operator int() { return (int)(m_pVBX->GetNumProperty(m_nPropIndex)); };
- void operator = (int Value) { m_pVBX->SetNumProperty(m_nPropIndex, Value); };
- void operator += (int Value) { m_pVBX->SetNumProperty(m_nPropIndex, m_pVBX->GetNumProperty(m_nPropIndex) + Value); };
- void operator -= (int Value) { m_pVBX->SetNumProperty(m_nPropIndex, m_pVBX->GetNumProperty(m_nPropIndex) - Value); };
- void operator *= (int Value) { m_pVBX->SetNumProperty(m_nPropIndex, m_pVBX->GetNumProperty(m_nPropIndex) * Value); };
- void operator /= (int Value) { m_pVBX->SetNumProperty(m_nPropIndex, m_pVBX->GetNumProperty(m_nPropIndex) / Value); };
- void operator %= (int Value) { m_pVBX->SetNumProperty(m_nPropIndex, m_pVBX->GetNumProperty(m_nPropIndex) % Value); };
- void operator ^= (int Value) { m_pVBX->SetNumProperty(m_nPropIndex, m_pVBX->GetNumProperty(m_nPropIndex) ^ Value); };
- void operator &= (int Value) { m_pVBX->SetNumProperty(m_nPropIndex, m_pVBX->GetNumProperty(m_nPropIndex) & Value); };
- void operator |= (int Value) { m_pVBX->SetNumProperty(m_nPropIndex, m_pVBX->GetNumProperty(m_nPropIndex) | Value); };
- int operator ++ ()
- {
- int Value = (int)( m_pVBX->GetNumProperty(m_nPropIndex) + 1 );
- m_pVBX->SetNumProperty(m_nPropIndex, Value);
- return Value;
- };
- int operator -- ()
- {
- int Value = (int)( m_pVBX->GetNumProperty(m_nPropIndex) - 1 );
- m_pVBX->SetNumProperty(m_nPropIndex, Value);
- return Value;
- };
- };
-
- /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
- // CBool
- // BOOL Class for VBX
- //
- class CBool: public CInt
- {
- public:
- CBool(CVBControl *pVBX, int nPropIndex) : CInt( pVBX, nPropIndex) {};
- void operator = (int Value) { m_pVBX->SetNumProperty(m_nPropIndex, Value); };
- };
-
-
- /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
- // CLong
- // long Class for VBX
- //
- class CLong : public CVBProp
- {
- public:
- CLong(CVBControl *pVBX, int nPropIndex) : CVBProp( pVBX, nPropIndex) {};
- operator long() { return m_pVBX->GetNumProperty(m_nPropIndex);};
- void operator = (long Value) { m_pVBX->SetNumProperty(m_nPropIndex, Value); };
- void operator += (long Value) { m_pVBX->SetNumProperty(m_nPropIndex, m_pVBX->GetNumProperty(m_nPropIndex) + Value); };
- void operator -= (long Value) { m_pVBX->SetNumProperty(m_nPropIndex, m_pVBX->GetNumProperty(m_nPropIndex) - Value); };
- void operator *= (long Value) { m_pVBX->SetNumProperty(m_nPropIndex, m_pVBX->GetNumProperty(m_nPropIndex) * Value); };
- void operator /= (long Value) { m_pVBX->SetNumProperty(m_nPropIndex, m_pVBX->GetNumProperty(m_nPropIndex) / Value); };
- void operator %= (long Value) { m_pVBX->SetNumProperty(m_nPropIndex, m_pVBX->GetNumProperty(m_nPropIndex) % Value); };
- void operator ^= (long Value) { m_pVBX->SetNumProperty(m_nPropIndex, m_pVBX->GetNumProperty(m_nPropIndex) ^ Value); };
- void operator &= (long Value) { m_pVBX->SetNumProperty(m_nPropIndex, m_pVBX->GetNumProperty(m_nPropIndex) & Value); };
- void operator |= (long Value) { m_pVBX->SetNumProperty(m_nPropIndex, m_pVBX->GetNumProperty(m_nPropIndex) | Value); };
- long operator ++ ()
- {
- long Value = m_pVBX->GetNumProperty(m_nPropIndex) + 1;
- m_pVBX->SetNumProperty(m_nPropIndex, Value);
- return Value;
- };
- long operator -- ()
- {
- long Value = m_pVBX->GetNumProperty(m_nPropIndex) - 1;
- m_pVBX->SetNumProperty(m_nPropIndex, Value);
- return Value;
- };
- };
-
-
- /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
- // CFloat
- // float Class for VBX
- //
- class CFloat : public CVBProp
- {
- public:
- CFloat(CVBControl *pVBX, int nPropIndex) : CVBProp( pVBX, nPropIndex) {};
- operator float() { return m_pVBX->GetFloatProperty(m_nPropIndex);};
- void operator = (float Value) { m_pVBX->SetFloatProperty(m_nPropIndex, Value); };
- void operator += (float Value) { m_pVBX->SetFloatProperty(m_nPropIndex, m_pVBX->GetFloatProperty(m_nPropIndex) + Value); };
- void operator -= (float Value) { m_pVBX->SetFloatProperty(m_nPropIndex, m_pVBX->GetFloatProperty(m_nPropIndex) - Value); };
- void operator *= (float Value) { m_pVBX->SetFloatProperty(m_nPropIndex, m_pVBX->GetFloatProperty(m_nPropIndex) * Value); };
- void operator /= (float Value) { m_pVBX->SetFloatProperty(m_nPropIndex, m_pVBX->GetFloatProperty(m_nPropIndex) / Value); };
- float operator ++ ()
- {
- float Value = m_pVBX->GetFloatProperty(m_nPropIndex) + 1;
- m_pVBX->SetFloatProperty(m_nPropIndex, Value);
- return Value;
- };
- float operator -- ()
- {
- float Value = m_pVBX->GetFloatProperty(m_nPropIndex) - 1;
- m_pVBX->SetFloatProperty(m_nPropIndex, Value);
- return Value;
- };
- };
-
-
- /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
- // CPicture
- // Picture (HPIC) Class for VBX
- //
- class CPicture : public CVBProp
- {
- public:
- CPicture(CVBControl *pVBX, int nPropIndex) : CVBProp(pVBX, nPropIndex) {};
- operator HPIC() { return m_pVBX->GetPictureProperty(m_nPropIndex); };
- void operator = (HPIC hPic) {m_pVBX->SetPictureProperty(m_nPropIndex, hPic); };
- };
-
-
-
- /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
- // CHsz
- // String ( HSZ ) Class for VBX
- //
- class CHsz : public CVBProp
- {
- public:
- CHsz( CVBControl *pVBX, int nPropIndex) : CVBProp(pVBX, nPropIndex) {};
- void operator =(LPCSTR Value) { m_pVBX->SetStrProperty(m_nPropIndex, Value);};
- operator CString() { return m_pVBX->GetStrProperty(m_nPropIndex); };
- };
-
-
-
- #endif
-
-
-