summaryrefslogtreecommitdiff
path: root/src/T2DLL/T2DlgItemIRepeater.cpp
blob: 597d4c4141da30fbd65544c0b016dbfffedd7b26 (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 "StdAfx.h"
#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);
}