|
|
1.1 root 1: /*
2: *
3: */
4:
5: #include "array_x.h"
6:
7: #define spaceVertical 10
8: #define spaceHorizontal 40
9:
10: extern CBrush CbrushBackground;
11: extern CBrush CbrushFrame;
12: extern LOGFONT DefaultFont;
13:
14: extern CAaaArray rgLoc;
15: extern BOOL fXYZ;
16: extern BOOL fTotal;
17:
18: enum {
19: SET_COLORS=1,
20: SET_PERCENT=2,
21: SET_STRING=4,
22: SET_SIZE=8,
23: SET_LOCATION=16,
24: SET_LOCATIONPREP=32
25: };
26:
27: class DISPOBJ
28: {
29: DISPOBJ * pParent;
30: BOOL fOpen;
31: DISPOBJ * pChild;
32: DISPOBJ * pSib;
33: CRect rtChildren;
34:
35: public:
36: BOOL fPrune;
37: POINT ptRight;
38: POINT ptLeft;
39: CRect rtArea;
40: DISPOBJ * pRoot;
41: int iLevel;
42: CRect rtTotal;
43:
44: DISPOBJ * Parent() { return pParent; }
45: DISPOBJ * Child() { return pChild; }
46: DISPOBJ * Sib() { return pSib; }
47: BOOL IsOpen() { return fOpen; }
48:
49: DISPOBJ()
50: {
51: pParent = pChild = pSib = NULL;
52: fPrune = fOpen = FALSE;
53: iLevel = 0;
54: pRoot = this;
55: }
56:
57: void AddSibling(DISPOBJ * pNew) {
58: pNew->pParent = pParent;
59: pNew->iLevel = iLevel;
60: pNew->pRoot = pRoot;
61:
62: if (pSib == NULL) {
63: pSib = pNew;
64: return;
65: }
66:
67: DISPOBJ * p = pSib;
68: while (p->pSib != NULL) {
69: p = p->pSib;
70: }
71:
72: p->pSib = pNew;
73:
74: return;
75: }
76:
77: void AddChild(DISPOBJ * pNew)
78: {
79: pNew->pParent = this;
80: pNew->iLevel = iLevel + 1;
81: pNew->pRoot = pRoot;
82:
83: if (pChild == NULL) {
84: pChild = pNew;
85: return;
86: }
87:
88: pChild->AddSibling(pNew);
89: return;
90: }
91:
92: virtual void DoForeground(CDC * cdc, BOOL fZoom, RANGESTRUCT * prs) = 0;
93:
94: void PaintTree(CDC * cdc, BOOL fZoom, RANGESTRUCT * prs, RECT rt);
95: void DoBackground( CDC * cdc, CBrush * pBrushBack = &CbrushBackground,
96: CBrush * pBrushFrame = &CbrushFrame) {
97: cdc->FillRect( &rtArea, pBrushBack );
98: cdc->FrameRect( &rtArea, pBrushFrame );
99:
100: return;
101: }
102:
103:
104: void Close()
105: {
106: DISPOBJ * p;
107: fOpen = FALSE;
108:
109: if (pChild && (pChild->fOpen)) {
110: p = pChild;
111: while (p != NULL) {
112: p->Close();
113: p = p->pSib;
114: }
115: }
116: return;
117: }
118:
119: void ExpandAll()
120: {
121: if (pSib) {
122: pSib->ExpandAll();
123: }
124:
125: if (pChild) {
126: pChild->ExpandAll();
127: }
128:
129: Open();
130: }
131:
132: void Open() {
133:
134: if (fOpen || (pChild == NULL)) {
135: return;
136: }
137:
138: fOpen = TRUE;
139: }
140:
141: virtual int Height(BOOL fZoom) = 0;
142: virtual int Width(BOOL fZoom) = 0;
143:
144: private:
145: void SetPropOnOne(int flags, RANGESTRUCT * prs, CDC * pcdc, BOOL fZoom, TIMETYPE t);
146:
147: public:
148:
149: void SetProperties(int flags, RANGESTRUCT * prs = 0, CDC * pcdc = 0, BOOL fZoom = FALSE, TIMETYPE progTime = 0);
150: virtual void DoSetPercents(TIMETYPE t) = 0;
151: virtual void DoSetColors(RANGESTRUCT * prs) = 0;
152: virtual void DoSetString(void) = 0;
153: virtual void DoAssignSize(CDC * pcdc) = 0;
154: void DoSetLocation(BOOL fZoom, BOOL fPrep);
155:
156:
157: BOOL DblClick( CPoint pt )
158: {
159: if (rtArea.PtInRect( pt )) {
160: if (fOpen) {
161: Close();
162: } else {
163: Open();
164: }
165: return TRUE;
166: }
167:
168: if (fOpen && pChild && pChild->DblClick( pt ) ) {
169: return TRUE;
170: }
171:
172: if (pSib && pSib->DblClick( pt ) ) {
173: return TRUE;
174: }
175:
176: return FALSE;
177: }
178: };
179:
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.