3 /////////////////////////////////////////////////////////////////////////////
5 // Copyright (c) 2002 Iain Murray, Inference Group, Cavendish, Cambridge.
7 /////////////////////////////////////////////////////////////////////////////
12 #include "../TabletPC/CursorInRange.h"
13 #include "../../DasherCore/DasherComponent.h"
14 #include "../../DasherCore/DasherTypes.h"
15 #include "../KeyboardHelper.h"
18 class CDasherMouseInput
;
21 class CDasherInterfaceBase
;
28 public ATL::CWindowImpl
<CCanvas
>,
29 public Dasher::CDasherComponent
33 static ATL::CWndClassInfo
& GetWndClassInfo()
35 static ATL::CWndClassInfo wc
= \
37 { sizeof(WNDCLASSEX
), CS_HREDRAW
| CS_VREDRAW
| CS_DBLCLKS
, StartWindowProc
, \
38 0, 0, NULL
, NULL
, NULL
, NULL
, NULL
, _T("CANVAS"), NULL
}, \
39 NULL
, NULL
, MAKEINTRESOURCE(IDC_CROSS
), TRUE
, 0, _T("") \
44 BEGIN_MSG_MAP( CCanvas
)
45 MESSAGE_HANDLER(WM_PAINT
, OnPaint
)
46 MESSAGE_HANDLER(WM_CREATE
, OnCreate
)
47 MESSAGE_HANDLER(WM_DESTROY
, OnDestroy
)
48 MESSAGE_HANDLER(WM_TIMER
, OnTimer
)
49 MESSAGE_HANDLER(WM_COMMAND
, OnCommand
)
50 MESSAGE_HANDLER(WM_SETFOCUS
, OnSetFocus
)
51 MESSAGE_HANDLER(WM_KEYUP
, OnKeyUp
)
52 MESSAGE_HANDLER(WM_KEYDOWN
, OnKeyDown
)
53 MESSAGE_HANDLER(WM_LBUTTONDBLCLK
, OnLButtonDblClk
)
54 MESSAGE_HANDLER(WM_LBUTTONDOWN
, OnLButtonDown
)
55 MESSAGE_HANDLER(WM_LBUTTONUP
, OnLButtonUp
)
56 MESSAGE_HANDLER(WM_CURSOR_IN_RANGE
, OnCursorInRange
)
57 MESSAGE_HANDLER(WM_CURSOR_OUT_OF_RANGE
, OnCursorOutOfRange
)
58 MESSAGE_HANDLER(WM_RBUTTONDOWN
, OnRButtonDown
)
59 MESSAGE_HANDLER(WM_RBUTTONUP
, OnRButtonUp
)
60 MESSAGE_HANDLER(WM_MOUSEMOVE
, OnMouseMove
)
61 MESSAGE_HANDLER(WM_SIZE
, OnSize
)
65 CCanvas(Dasher::CDasher
*DI
, Dasher::CEventHandler
*pEventHandler
, CSettingsStore
*pSettingsStore
);
68 HWND
Create(HWND hParent
);
72 LRESULT
OnSize(UINT message
, WPARAM wParam
, LPARAM lParam
, BOOL
& bHandled
);
73 LRESULT
OnMouseMove(UINT message
, WPARAM wParam
, LPARAM lParam
, BOOL
& bHandled
);
74 LRESULT
OnRButtonUp(UINT message
, WPARAM wParam
, LPARAM lParam
, BOOL
& bHandled
);
75 LRESULT
OnRButtonDown(UINT message
, WPARAM wParam
, LPARAM lParam
, BOOL
& bHandled
);
76 LRESULT
OnCursorInRange(UINT message
, WPARAM wParam
, LPARAM lParam
, BOOL
& bHandled
);
77 LRESULT
OnCursorOutOfRange(UINT message
, WPARAM wParam
, LPARAM lParam
, BOOL
& bHandled
);
78 LRESULT
OnLButtonDblClk(UINT message
, WPARAM wParam
, LPARAM lParam
, BOOL
& bHandled
);
79 LRESULT
OnLButtonDown(UINT message
, WPARAM wParam
, LPARAM lParam
, BOOL
& bHandled
);
80 LRESULT
OnLButtonUp(UINT message
, WPARAM wParam
, LPARAM lParam
, BOOL
& bHandled
);
81 LRESULT
OnPaint(UINT message
, WPARAM wParam
, LPARAM lParam
, BOOL
& bHandled
);
82 LRESULT
OnCreate(UINT message
, WPARAM wParam
, LPARAM lParam
, BOOL
& bHandled
);
83 LRESULT
OnDestroy(UINT message
, WPARAM wParam
, LPARAM lParam
, BOOL
& bHandled
);
84 LRESULT
OnTimer(UINT message
, WPARAM wParam
, LPARAM lParam
, BOOL
& bHandled
);
85 LRESULT
OnCommand(UINT message
, WPARAM wParam
, LPARAM lParam
, BOOL
& bHandled
);
86 LRESULT
OnSetFocus(UINT message
, WPARAM wParam
, LPARAM lParam
, BOOL
& bHandled
);
87 LRESULT
OnKeyUp(UINT message
, WPARAM wParam
, LPARAM lParam
, BOOL
& bHandled
);
88 LRESULT
OnKeyDown(UINT message
, WPARAM wParam
, LPARAM lParam
, BOOL
& bHandled
);
90 void Move(int x
, int y
, int Width
, int Height
);
98 void StartOnLeftClick(bool Value
) {
103 void MousePosStart(bool Value
);
104 void setkeycoords(int coords
[18]) {
105 for(int i
= 0; i
< 18; i
++) {
106 keycoords
[i
] = coords
[i
];
109 int *getkeycoords() {
113 void setforward(bool value
) {
116 void setbackward(bool value
) {
119 void setselect(bool value
) {
141 void SetScreenInterface(Dasher::CDasherInterfaceBase
* dasherinterface
);
145 bool GetCanvasSize(int& pTop
, int& pLeft
, int& pBottom
, int& pRight
);
147 void HandleEvent(Dasher::CEvent
*pEvent
);
152 int keycoords
[18], buttonnum
, yscaling
;
153 bool forward
, backward
, select
;
155 Dasher::CDasher
* m_pDasherInterface
;
159 //Dasher::CDasherMouseInput * m_pMouseInput;
160 //Dasher::CSocketInput * m_pSocketInput;
162 Dasher::screenint imousex
, imousey
;
179 // Indicates that a button is depressed, so we dont stop on idle
181 // Ticks as last event, for stop on idle
182 DWORD m_dwTicksLastEvent
;
184 // Enables tablet pc events
185 CCursorInRange m_CursorInRange
;
187 CKeyboardHelper
*m_pKeyboardHelper
;
191 #endif /* #ifndef __Canvas_h__ */