Ticket #2075: DigestCode.cpp

File DigestCode.cpp, 1.4 KB (added by shinta, 17 years ago)
Line 
1TTestHaikuWindow::TTestHaikuWindow(BRect oFrame)
2 : SUPER(oFrame, _T(gAppNameEnUs), B_TITLED_WINDOW, B_ASYNCHRONOUS_CONTROLS)
3{
4 // Filter
5 AddCommonFilter(new TMouseDownFilter());
6}
7//------------------------------------------------------------------------------
8void TTestHaikuWindow::MessageReceived(BMessage* oMsg)
9{
10 switch( oMsg->what ) {
11 case B_MOUSE_DOWN:
12 MouseDown(oMsg);
13 break;
14 default:
15 SUPER::MessageReceived(oMsg);
16 }
17}
18//------------------------------------------------------------------------------
19void TTestHaikuWindow::MouseDown(BMessage* oMsg)
20{
21 BPoint aPoint;
22
23 oMsg->FindPoint("where", &aPoint); // gets aPoint in BWindow coordinate
24 DBEXP("TTestHaikuWindow::MouseDown()", BRect(aPoint, B_ORIGIN));
25}
26//------------------------------------------------------------------------------
27//==============================================================================
28TMouseDownFilter::TMouseDownFilter()
29 : SUPER(B_MOUSE_DOWN)
30{
31}
32//------------------------------------------------------------------------------
33filter_result TMouseDownFilter::Filter(BMessage* oMsg, BHandler** oTgt)
34{
35 DBEXP("TMouseDownFilter::Filter()", "");
36 *oTgt = Looper();
37 return B_DISPATCH_MESSAGE;
38}
39//------------------------------------------------------------------------------
40//==============================================================================