summaryrefslogtreecommitdiff
path: root/src/T2DLL/T2DlgItemBox.cpp
blob: 3c9c5443c98720d63fa40a3f2bd622a2a7e47f6f (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
#include "StdAfx.h"
#include "T2DlgItemBox.h"

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

T2DlgItemBox::T2DlgItemBox(T2TowerDoc* inDoc, T2ImageObj* inImageObj, CPalette* inPalette)
    : T2DlgItem(inDoc, inImageObj, inPalette)
{
}

/*virtual*/ BOOL T2DlgItemBox::OnT2DlgItemEraseBkgnd(CDC* pDC) {
    CRect rect;
    GetClientRect(rect);

    CPen whitePen;
    whitePen.CreatePen(PS_SOLID, 0, PALETTERGB(255, 255, 255));
    CPen greyPen;
    greyPen.CreatePen(PS_SOLID, 0, PALETTERGB(133, 133, 133));
    CBrush brush;

    int saveDC = pDC->SaveDC();
    pDC->SelectPalette(mPalette, false);
    pDC->RealizePalette();

    if (IsWindowEnabled()) {
        pDC->SelectObject(greyPen);
        pDC->MoveTo(rect.right - 1, rect.top);
        pDC->LineTo(rect.left, rect.top);
        pDC->LineTo(rect.left, rect.bottom);

        pDC->SelectObject(whitePen);
        pDC->MoveTo(rect.right - 1, rect.top + 1);
        pDC->LineTo(rect.right - 1, rect.bottom - 1);
        pDC->LineTo(rect.left, rect.bottom - 1);
    } else {
        brush.CreateSolidBrush(PALETTERGB(179, 179, 179));
        pDC->FrameRect(rect, &brush);
    }

    pDC->RestoreDC(saveDC);

    return true;
}