summaryrefslogtreecommitdiff
path: root/src/T2DLL/T2DlgItemCustomerGage.cpp
blob: f18d8b26b64fc5090e2189e770a1e8666e72d2d4 (plain)
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
#include "StdAfx.h"
#include "T2DlgItemCustomerGage.h"
#include "T2Tenant.h"

#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif

T2DlgItemCustomerGage::T2DlgItemCustomerGage(T2TowerDoc* towerDoc, T2ImageObj* imageObj, CPalette* palette)
    : T2DlgItemGageBase(towerDoc, imageObj, palette)
    , mTenant(NULL)
{
}

/*virtual*/ int T2DlgItemCustomerGage::GetMinValue() {
    return 1;
}

/*virtual*/ int T2DlgItemCustomerGage::GetMaxValue() {
    return 300;
}

/*virtual*/ int T2DlgItemCustomerGage::GetValue() {
    int value = GetMinValue();
    if (mTenant) {
        mTenant->UpdateResidencialEstimate(mTowerDoc);
        value = mTenant->GetEstimate();
    }
    return value;
}

/*virtual*/ int T2DlgItemCustomerGage::GetBlueValue() {
    return 200;
}

/*virtual*/ int T2DlgItemCustomerGage::GetYellowValue() {
    return 70;
}

/*virtual*/ COLORREF T2DlgItemCustomerGage::GetGageColor(int value) {
    return (value <= GetYellowValue()) ? PALETTERGB(255, 0, 0) :
           (value <= GetBlueValue()) ? PALETTERGB(255, 255, 0) :
           PALETTERGB(0, 0, 255);
}

void T2DlgItemCustomerGage::SetTenant(T2Tenant* tenant) {
    mTenant = tenant;
}

/*virtual*/ BOOL T2DlgItemCustomerGage::IsDrawInterior() {
    return (mTenant != NULL);
}