|
|
1.1 ! root 1: /*** ! 2: *cpoly.h ! 3: * ! 4: * Copyright (C) 1992, Microsoft Corporation. All Rights Reserved. ! 5: * Information Contained Herein Is Proprietary and Confidential. ! 6: * ! 7: *Purpose: ! 8: * Definition of the CPoly class. ! 9: * ! 10: * The CPoly class defines a number of methods and exposes them for ! 11: * external programmability via IDispatch, ! 12: * ! 13: * methods: ! 14: * DRAW - draw the polygon ! 15: * RESET - delete all points from the polygon ! 16: * ! 17: * ADDPOINT(X, Y) - add a point with coordinates (x,y) to the polygon ! 18: * ! 19: * ENUMPOINTS - return a collection of the polygon's points ! 20: * ! 21: * GETXORIGIN - get and set the X origin of the polygon ! 22: * SETXORIGIN ! 23: * ! 24: * GETYORIGIN - get and set the Y origin of the polygon ! 25: * SETYORIGIN ! 26: * ! 27: * GETWIDTH - get and set the line width of the polygon ! 28: * SETWIDTH ! 29: * ! 30: * UNDONE: update description ! 31: * ! 32: *Implementation Notes: ! 33: * ! 34: *****************************************************************************/ ! 35: ! 36: ! 37: #ifndef CLASS ! 38: # ifdef __TURBOC__ ! 39: # define CLASS class huge ! 40: # else ! 41: # define CLASS class FAR ! 42: # endif ! 43: #endif ! 44: ! 45: class CPoint; ! 46: ! 47: CLASS CPoly : public IDispatch ! 48: { ! 49: public: ! 50: static CPoly FAR* Create(); ! 51: ! 52: /* IUnknown methods */ ! 53: STDMETHOD(QueryInterface)(REFIID riid, void FAR* FAR* ppvObj); ! 54: STDMETHOD_(unsigned long, AddRef)(void); ! 55: STDMETHOD_(unsigned long, Release)(void); ! 56: ! 57: /* IDispatch methods */ ! 58: STDMETHOD(GetTypeInfoCount)(unsigned int FAR* pcTypeInfo); ! 59: ! 60: STDMETHOD(GetTypeInfo)( ! 61: unsigned int iTypeInfo, ! 62: LCID lcid, ! 63: ITypeInfo FAR* FAR* ppTypeInfo); ! 64: ! 65: STDMETHOD(GetIDsOfNames)( ! 66: REFIID riid, ! 67: char FAR* FAR* rgszNames, ! 68: unsigned int cNames, ! 69: LCID lcid, ! 70: DISPID FAR* rgdispid); ! 71: ! 72: STDMETHOD(Invoke)( ! 73: DISPID dispidMember, ! 74: REFIID riid, ! 75: LCID lcid, ! 76: unsigned short wFlags, ! 77: DISPPARAMS FAR* pdispparams, ! 78: VARIANT FAR* pvarResult, ! 79: EXCEPINFO FAR* pexcepinfo, ! 80: unsigned int FAR* puArgErr); ! 81: ! 82: /* Introduced methods */ ! 83: ! 84: virtual void PASCAL Draw(void); ! 85: virtual void PASCAL Reset(void); ! 86: ! 87: // add a point with the given 'x' and 'y' coordinates ! 88: virtual HRESULT PASCAL AddPoint(short x, short y); ! 89: ! 90: // return a collection of the polygon's points ! 91: virtual HRESULT PASCAL EnumPoints(IEnumVARIANT FAR* FAR* ppenum); ! 92: ! 93: // get/set the polygon's X origin property ! 94: virtual short PASCAL GetXOrigin(void); ! 95: virtual void PASCAL SetXOrigin(short x); ! 96: ! 97: // get/set the polygon's Y origin property ! 98: virtual short PASCAL GetYOrigin(void); ! 99: virtual void PASCAL SetYOrigin(short y); ! 100: ! 101: virtual short PASCAL GetWidth(void); ! 102: virtual void PASCAL SetWidth(short width); ! 103: ! 104: virtual short PASCAL get_red(void); ! 105: virtual void PASCAL set_red(short red); ! 106: ! 107: virtual short PASCAL get_green(void); ! 108: virtual void PASCAL set_green(short green); ! 109: ! 110: virtual short PASCAL get_blue(void); ! 111: virtual void PASCAL set_blue(short blue); ! 112: ! 113: // Debug method ! 114: virtual void PASCAL Dump(void); ! 115: ! 116: public: ! 117: ! 118: // Draw all polygons. ! 119: static void PolyDraw(void); ! 120: ! 121: // Release all polygons. ! 122: static void PolyTerm(void); ! 123: ! 124: // Dump all polygons to dbwin. ! 125: static void PolyDump(void); ! 126: ! 127: ! 128: private: ! 129: CPoly(); ! 130: ! 131: short m_xorg; ! 132: short m_yorg; ! 133: short m_width; ! 134: ! 135: short m_red; ! 136: short m_green; ! 137: short m_blue; ! 138: ! 139: unsigned long m_refs; ! 140: unsigned int m_cPoints; ! 141: ! 142: POINTLINK FAR* m_ppointlink; ! 143: POINTLINK FAR* m_ppointlinkLast; ! 144: }; ! 145: ! 146: // DISPIDs for the members and properties available via IDispatch. ! 147: // ! 148: enum IDMEMBER_CPOLY { ! 149: IDMEMBER_CPOLY_DRAW = 1, ! 150: IDMEMBER_CPOLY_RESET, ! 151: IDMEMBER_CPOLY_ADDPOINT, ! 152: IDMEMBER_CPOLY_ENUMPOINTS, ! 153: IDMEMBER_CPOLY_GETXORIGIN, ! 154: IDMEMBER_CPOLY_SETXORIGIN, ! 155: IDMEMBER_CPOLY_GETYORIGIN, ! 156: IDMEMBER_CPOLY_SETYORIGIN, ! 157: IDMEMBER_CPOLY_GETWIDTH, ! 158: IDMEMBER_CPOLY_SETWIDTH, ! 159: IDMEMBER_CPOLY_GETRED, ! 160: IDMEMBER_CPOLY_SETRED, ! 161: IDMEMBER_CPOLY_GETGREEN, ! 162: IDMEMBER_CPOLY_SETGREEN, ! 163: IDMEMBER_CPOLY_GETBLUE, ! 164: IDMEMBER_CPOLY_SETBLUE, ! 165: IDMEMBER_CPOLY_DUMP, ! 166: IDMEMBER_CPOLY_MAX ! 167: }; ! 168: ! 169: // structure used to link together polygons ! 170: // ! 171: struct POLYLINK { ! 172: POLYLINK FAR* next; ! 173: CPoly FAR* ppoly; ! 174: }; ! 175: ! 176: ! 177: // The CPoly class factory ! 178: // ! 179: CLASS CPolyCF : public IClassFactory ! 180: { ! 181: public: ! 182: static IClassFactory FAR* Create(); ! 183: ! 184: /* IUnknown methods */ ! 185: STDMETHOD(QueryInterface)(REFIID riid, void FAR* FAR* ppv); ! 186: STDMETHOD_(unsigned long, AddRef)(void); ! 187: STDMETHOD_(unsigned long, Release)(void); ! 188: ! 189: /* IClassFactory methods */ ! 190: STDMETHOD(CreateInstance)( ! 191: IUnknown FAR* pUnkOuter, REFIID riid, void FAR* FAR* ppv); ! 192: #ifdef _MAC ! 193: STDMETHOD(LockServer)(unsigned long fLock); ! 194: #else ! 195: STDMETHOD(LockServer)(BOOL fLock); ! 196: #endif ! 197: ! 198: private: ! 199: CPolyCF(); ! 200: ! 201: unsigned long m_refs; ! 202: }; ! 203:
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.