summaryrefslogtreecommitdiff
path: root/src/T2DLL/T2DlgItemMerchandiseField.cpp
blob: bc02ee0958ffe7c620d624318d96a7686a3da2b5 (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
#include "CEditWFocus.h"
#include "T2Dialog.h"
#include "T2DlgItemMerchandiseField.h"

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

T2DlgItemMerchandiseField::T2DlgItemMerchandiseField(T2TowerDoc *inDoc, T2ImageObj *inImageObj, CPalette *inPalette)
    : T2DlgItemEdit(inDoc, inImageObj, inPalette)
{
}

/*virtual*/ T2DlgItemMerchandiseField::~T2DlgItemMerchandiseField() {
}

/*virtual*/ void T2DlgItemMerchandiseField::CreateSubItem(void *inData) {
    T2DlgItemEdit::CreateSubItem(inData);
    if (mSubItem)
        mSubItem->SetReadOnly();
}

/*virtual*/ void T2DlgItemMerchandiseField::OnT2SetFocus(CWnd *inWnd) {
    T2DlgItemEdit::OnT2SetFocus(inWnd);

    T2DlgItem *theField1 = ((T2Dialog *) GetParent())->GetT2DlgItem(GetDlgCtrlID() + 1);
    if (theField1) {
        theField1->SetValue(GetValue());
        theField1->ShowWindow(SW_SHOWNORMAL);
    }

    T2DlgItem *theField2 = ((T2Dialog *) GetParent())->GetT2DlgItem(GetDlgCtrlID() + 2);
    if (theField2)
        theField2->ShowWindow(SW_HIDE);
}

/*virtual*/ void T2DlgItemMerchandiseField::OnT2KillFocus(CWnd *inWnd) {
    T2DlgItemEdit::OnT2KillFocus(inWnd);

    T2DlgItem *theField1 = ((T2Dialog *) GetParent())->GetT2DlgItem(GetDlgCtrlID() + 1);
    if (theField1)
        theField1->ShowWindow(SW_HIDE);

    T2DlgItem *theField2 = ((T2Dialog *) GetParent())->GetT2DlgItem(GetDlgCtrlID() + 2);
    if (theField2)
        theField2->ShowWindow(SW_SHOWNORMAL);
}