summaryrefslogtreecommitdiff
path: root/src/T2DLL/T2DlgItemIRepeater.cpp
blob: b671ca77f633df84e2b8f6f46152490c9f91bc4e (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
#include "T2DlgItemIRepeater.h"

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

T2DlgItemIRepeater::T2DlgItemIRepeater(T2TowerDoc *inDoc, T2ImageObj *inImageObj, CPalette *inPalette)
    : T2DlgItemIButton(inDoc, inImageObj, inPalette)
{
}

T2DlgItemIRepeater::~T2DlgItemIRepeater() {
}

/*virtual*/ void T2DlgItemIRepeater::OnT2DlgItemLButtonDown(UINT inFlags, CPoint inPt) {
    SetCapture();

    mIsClicked = true;
    m74 = true;
    SetPattern(100);
    Invalidate();

    Notify(GetDlgCtrlID(), 0, NULL);
    mTimerID = SetTimer(999, 100, NULL);
}

/*virtual*/ void T2DlgItemIRepeater::OnT2DlgItemLButtonUp(UINT inFlags, CPoint inPt) {
    if (mIsClicked) {
        if (mTimerID)
            KillTimer(mTimerID);

        SetPattern(0);
        ReleaseCapture();
        mIsClicked = false;

        if (m74) {
            m74 = false;
            Invalidate();
        }
    }
}

/*virtual*/ void T2DlgItemIRepeater::OnT2Timer(UINT inID) {
    if (inID == mTimerID && m74)
        Notify(GetDlgCtrlID(), 0, NULL);
}