summaryrefslogtreecommitdiff
path: root/src/T2DLL/T2DlgItemScr.h
blob: 39a120a96fd7ca1f59be07ddb1c1ac69a0d7b93d (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
#pragma once
#include "common.h"
#include "T2DlgItem.h"

class AFX_CLASS_EXPORT T2DlgItemScr : public T2DlgItem {
public:
	T2DlgItemScr(T2TowerDoc* towerDoc, T2ImageObj* imageObj, CPalette* palette);
	virtual void SetValue(int);

	virtual void SetPage(int);
	virtual void SetRange(int);

	enum {
		Area_Up = 1,
		Area_PageUp = 2,
		Area_Thumb = 3,
		Area_PageDown = 4,
		Area_Down = 5
	};

protected:
	virtual void OnT2DlgItemLButtonDown(UINT nFlags, CPoint pt);
	virtual void OnT2DlgItemLButtonUp(UINT nFlags, CPoint pt);
	virtual void OnT2DlgItemMouseMove(UINT nFlags, CPoint pt);
	virtual void OnT2Timer(UINT id);

	virtual int ScrollBarHittest(CPoint) const = 0;
	virtual void GetUpButtonRect(const CRect&, CRect&) const = 0;
	virtual void GetDnButtonRect(const CRect&, CRect&) const = 0;
	virtual int PositionToValue(const CPoint&) const = 0;
	virtual int PositionToValue(const CRect&) const = 0;

	void CalcScrollBarThumb(int* thumbPosition, int* thumbSize) const;
	void ScrollBarAction(int, int);
	BOOL IsScrollable() const;

	int mUpImage;
	int mDownImage;
	int mRange;
	int mPage;
	CPoint mMouseDownPoint;
	int mMouseDownValue;
	int mClickedArea;
	UINT mTimerID;
};