forked from SomeSupport/eMule
-
Notifications
You must be signed in to change notification settings - Fork 97
/
3DPreviewControl.cpp
61 lines (50 loc) · 1.21 KB
/
3DPreviewControl.cpp
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
50
51
52
53
54
55
56
57
58
59
60
61
#include "stdafx.h"
#include "eMule.h"
#include "3DPreviewControl.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
CBarShader C3DPreviewControl::s_preview(16,32);
// C3DPreviewControl
IMPLEMENT_DYNAMIC(C3DPreviewControl, CStatic)
BEGIN_MESSAGE_MAP(C3DPreviewControl, CStatic)
ON_WM_PAINT()
END_MESSAGE_MAP()
C3DPreviewControl::C3DPreviewControl()
: m_iSliderPos(0) // use flat
{
}
C3DPreviewControl::~C3DPreviewControl()
{
}
// Sets "slider" position for type of preview
void C3DPreviewControl::SetSliderPos(int iPos)
{
if ( iPos <= 5 && iPos >= -5)
{
m_iSliderPos = iPos;
}
if ( GetSafeHwnd() )
{
Invalidate();
UpdateWindow();
}
}
void C3DPreviewControl::OnPaint()
{
CPaintDC dc(this); // device context for painting
RECT outline_rec;
outline_rec.top=0;
outline_rec.bottom=18;
outline_rec.left=0;
outline_rec.right=34;
CBrush gdiBrush(RGB(104,104,104));
CBrush* pOldBrush = dc.SelectObject(&gdiBrush); //eklmn: select a new brush
dc.FrameRect(&outline_rec, &gdiBrush);
dc.SelectObject(pOldBrush); //eklmn: recover an old brush
s_preview.SetFileSize((uint64)32);
s_preview.Fill(RGB(192,192,255));
s_preview.DrawPreview(&dc, 1, 1, m_iSliderPos);
}