|
|
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: #ifndef CLASS
37: # ifdef __TURBOC__
38: # define CLASS class huge
39: # else
40: # define CLASS class FAR
41: # endif
42: #endif
43:
44: class CPoint;
45:
46: CLASS CPoly : public IDispatch
47: {
48: public:
49: static CPoly FAR* Create();
50:
51: /* IUnknown methods */
52: STDMETHOD(QueryInterface)(REFIID riid, void FAR* FAR* ppvObj);
53: STDMETHOD_(ULONG, AddRef)(void);
54: STDMETHOD_(ULONG, Release)(void);
55:
56: /* IDispatch methods */
57: STDMETHOD(GetTypeInfoCount)(UINT FAR* pcTypeInfo);
58:
59: STDMETHOD(GetTypeInfo)(
60: UINT iTypeInfo,
61: LCID lcid,
62: ITypeInfo FAR* FAR* ppTypeInfo);
63:
64: STDMETHOD(GetIDsOfNames)(
65: REFIID riid,
66: char FAR* FAR* rgszNames,
67: UINT cNames,
68: LCID lcid,
69: DISPID FAR* rgdispid);
70:
71: STDMETHOD(Invoke)(
72: DISPID dispidMember,
73: REFIID riid,
74: LCID lcid,
75: WORD wFlags,
76: DISPPARAMS FAR* pdispparams,
77: VARIANT FAR* pvarResult,
78: EXCEPINFO FAR* pexcepinfo,
79: UINT FAR* puArgErr);
80:
81: /* Introduced methods */
82:
83: virtual void METHODCALLTYPE EXPORT Draw(void);
84: virtual void METHODCALLTYPE EXPORT Reset(void);
85:
86: // add a point with the given 'x' and 'y' coordinates
87: virtual HRESULT METHODCALLTYPE EXPORT AddPoint(short x, short y);
88:
89: // return a collection of the polygon's points
90: virtual IUnknown FAR* METHODCALLTYPE EXPORT EnumPoints(void);
91:
92: // get/set the polygon's X origin property
93: virtual short METHODCALLTYPE EXPORT GetXOrigin(void);
94: virtual void METHODCALLTYPE EXPORT SetXOrigin(short x);
95:
96: // get/set the polygon's Y origin property
97: virtual short METHODCALLTYPE EXPORT GetYOrigin(void);
98: virtual void METHODCALLTYPE EXPORT SetYOrigin(short y);
99:
100: virtual short METHODCALLTYPE EXPORT GetWidth(void);
101: virtual void METHODCALLTYPE EXPORT SetWidth(short width);
102:
103: virtual short METHODCALLTYPE EXPORT get_red(void);
104: virtual void METHODCALLTYPE EXPORT set_red(short red);
105:
106: virtual short METHODCALLTYPE EXPORT get_green(void);
107: virtual void METHODCALLTYPE EXPORT set_green(short green);
108:
109: virtual short METHODCALLTYPE EXPORT get_blue(void);
110: virtual void METHODCALLTYPE EXPORT set_blue(short blue);
111:
112: // Debug method
113: virtual void METHODCALLTYPE EXPORT Dump(void);
114:
115: public:
116:
117: // Draw all polygons.
118: static void PolyDraw(void);
119:
120: // Release all polygons.
121: static void PolyTerm(void);
122:
123: // Dump all polygons to dbwin.
124: static void PolyDump(void);
125:
126:
127: private:
128: CPoly();
129:
130: short m_xorg;
131: short m_yorg;
132: short m_width;
133:
134: short m_red;
135: short m_green;
136: short m_blue;
137:
138: ULONG m_refs;
139: UINT m_cPoints;
140:
141: ITypeInfo FAR* m_ptinfo;
142:
143: POINTLINK FAR* m_ppointlink;
144: POINTLINK FAR* m_ppointlinkLast;
145: };
146:
147: // DISPIDs for the members and properties available via IDispatch.
148: //
149: enum IDMEMBER_CPOLY {
150: IDMEMBER_CPOLY_DRAW = 1,
151: IDMEMBER_CPOLY_RESET,
152: IDMEMBER_CPOLY_ADDPOINT,
153: IDMEMBER_CPOLY_ENUMPOINTS,
154: IDMEMBER_CPOLY_GETXORIGIN,
155: IDMEMBER_CPOLY_SETXORIGIN,
156: IDMEMBER_CPOLY_GETYORIGIN,
157: IDMEMBER_CPOLY_SETYORIGIN,
158: IDMEMBER_CPOLY_GETWIDTH,
159: IDMEMBER_CPOLY_SETWIDTH,
160: IDMEMBER_CPOLY_GETRED,
161: IDMEMBER_CPOLY_SETRED,
162: IDMEMBER_CPOLY_GETGREEN,
163: IDMEMBER_CPOLY_SETGREEN,
164: IDMEMBER_CPOLY_GETBLUE,
165: IDMEMBER_CPOLY_SETBLUE,
166: IDMEMBER_CPOLY_DUMP,
167: IDMEMBER_CPOLY_MAX
168: };
169:
170: // CPoly method indices
171: //
172: enum IMETH_CPOLY {
173: IMETH_CPOLY_QUERYINTERFACE = 0,
174: IMETH_CPOLY_ADDREF,
175: IMETH_CPOLY_RELEASE,
176: IMETH_CPOLY_GETTYPEINFOCOUNT,
177: IMETH_CPOLY_GETTYPEINFO,
178: IMETH_CPOLY_GETIDSOFNAMES,
179: IMETH_CPOLY_INVOKE,
180: IMETH_CPOLY_DRAW,
181: IMETH_CPOLY_RESET,
182: IMETH_CPOLY_ADDPOINT,
183: IMETH_CPOLY_ENUMPOINTS,
184: IMETH_CPOLY_GETXORIGIN,
185: IMETH_CPOLY_SETXORIGIN,
186: IMETH_CPOLY_GETYORIGIN,
187: IMETH_CPOLY_SETYORIGIN,
188: IMETH_CPOLY_GETWIDTH,
189: IMETH_CPOLY_SETWIDTH,
190: IMETH_CPOLY_GETRED,
191: IMETH_CPOLY_SETRED,
192: IMETH_CPOLY_GETGREEN,
193: IMETH_CPOLY_SETGREEN,
194: IMETH_CPOLY_GETBLUE,
195: IMETH_CPOLY_SETBLUE,
196: IMETH_CPOLY_DUMP,
197: IMETH_CPOLY_MAX
198: };
199:
200: // structure used to link together polygons
201: //
202: struct POLYLINK {
203: POLYLINK FAR* next;
204: CPoly FAR* ppoly;
205: };
206:
207:
208: // The CPoly class factory
209: //
210: CLASS CPolyCF : public IClassFactory
211: {
212: public:
213: static IClassFactory FAR* Create();
214:
215: /* IUnknown methods */
216: STDMETHOD(QueryInterface)(REFIID riid, void FAR* FAR* ppv);
217: STDMETHOD_(ULONG, AddRef)(void);
218: STDMETHOD_(ULONG, Release)(void);
219:
220: /* IClassFactory methods */
221: STDMETHOD(CreateInstance)(
222: IUnknown FAR* pUnkOuter, REFIID riid, void FAR* FAR* ppv);
223: STDMETHOD(LockServer)(BOOL fLock);
224:
225: private:
226: CPolyCF();
227: ~CPolyCF();
228:
229: ULONG m_refs;
230: };
231:
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.