1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
|
#include "StdAfx.h"
#include "T2DlgItemProfitsGage.h"
#include "T2Tenant.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
T2DlgItemProfitsGage::T2DlgItemProfitsGage(T2TowerDoc* inDoc, T2ImageObj* inImageObj, CPalette* inPalette)
: T2DlgItemGageBase(inDoc, inImageObj, inPalette)
, mTenant(NULL)
{
}
void T2DlgItemProfitsGage::CalcCost() {
mCost = mTenant->GetOutMoney();
}
/*virtual*/ int T2DlgItemProfitsGage::GetMinValue() {
int val = mCost * -1;
if (mCost == 0)
val = 0;
return val;
}
/*virtual*/ int T2DlgItemProfitsGage::GetMaxValue() {
int val;
if (mCost == 0)
val = 4;
else
val = (mCost * 230) / 70;
return val;
}
/*virtual*/ int T2DlgItemProfitsGage::GetValue() {
int val = GetMinValue();
if (mTenant)
val = mTenant->CalcInMoney();
return val;
}
/*virtual*/ int T2DlgItemProfitsGage::GetBlueValue() {
int val;
if (mCost == 0)
val = 2;
else
val = (mCost * 130) / 70;
return val;
}
/*virtual*/ int T2DlgItemProfitsGage::GetYellowValue() {
int val = 0;
if (mCost == 0)
val = 1;
return val;
}
/*virtual*/ DWORD T2DlgItemProfitsGage::GetGageColor(int inValue) {
return (inValue < GetYellowValue()) ? PALETTERGB(255, 0, 0) : (inValue < GetBlueValue()) ? PALETTERGB(255, 255, 0) : PALETTERGB(0, 0, 255);
}
void T2DlgItemProfitsGage::SetTenant(T2Tenant* inTenant) {
mTenant = inTenant;
CalcCost();
}
/*virtual*/ void T2DlgItemProfitsGage::DrawInterior(CDC* pDC, const CRect& inRect) {
T2DlgItemGageBase::DrawInterior(pDC, inRect);
DrawValueByText(pDC, inRect);
}
/*virtual*/ BOOL T2DlgItemProfitsGage::IsDrawInterior() {
return (mTenant != NULL);
}
|