-
Notifications
You must be signed in to change notification settings - Fork 0
/
SCaptureButton.cpp
61 lines (50 loc) · 1.4 KB
/
SCaptureButton.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 "SCaptureButton.h"
namespace SOUI
{
SCaptureButton::SCaptureButton(void)
{
m_evtSet.addEvent(EVENTID(EventCapture));
m_evtSet.addEvent(EVENTID(EventCaptureFinish));
}
SCaptureButton::~SCaptureButton(void)
{
}
void SCaptureButton::OnLButtonDown( UINT nFlags, CPoint point )
{
SWindow::OnLButtonDown(nFlags,point);
HCURSOR hCursor=GETRESPROVIDER->LoadCursor(_T("target"));
::SetCursor(hCursor);
}
void SCaptureButton::OnLButtonUp( UINT nFlags, CPoint point )
{
SWindow::OnLButtonUp(nFlags,point);
EventCaptureFinish evt(this,point);
FireEvent(evt);
}
void SCaptureButton::OnMouseMove( UINT nFlags, CPoint point )
{
if(IsChecked())
{
EventCapture evt(this,point);
FireEvent(evt);
}
}
void SCaptureButton::OnPaint( IRenderTarget *pRT )
{
if(!m_pBgSkin) return;
m_pBgSkin->DrawByIndex(pRT,GetWindowRect(),IsChecked()?1:0);
}
CSize SCaptureButton::GetDesiredSize(int nWid,int nHei )
{
if(!m_pBgSkin) return CSize();
return m_pBgSkin->GetSkinSize();
}
BOOL SCaptureButton::IsChecked()
{
return m_dwState & WndState_PushDown;
}
void SCaptureButton::OnMouseLeave()
{
}
}