1 | TTestHaikuWindow::TTestHaikuWindow(BRect oFrame)
|
---|
2 | : SUPER(oFrame, _T(gAppNameEnUs), B_TITLED_WINDOW, B_ASYNCHRONOUS_CONTROLS)
|
---|
3 | {
|
---|
4 | // Filter
|
---|
5 | AddCommonFilter(new TMouseDownFilter());
|
---|
6 | }
|
---|
7 | //------------------------------------------------------------------------------
|
---|
8 | void 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 | //------------------------------------------------------------------------------
|
---|
19 | void 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 | //==============================================================================
|
---|
28 | TMouseDownFilter::TMouseDownFilter()
|
---|
29 | : SUPER(B_MOUSE_DOWN)
|
---|
30 | {
|
---|
31 | }
|
---|
32 | //------------------------------------------------------------------------------
|
---|
33 | filter_result TMouseDownFilter::Filter(BMessage* oMsg, BHandler** oTgt)
|
---|
34 | {
|
---|
35 | DBEXP("TMouseDownFilter::Filter()", "");
|
---|
36 | *oTgt = Looper();
|
---|
37 | return B_DISPATCH_MESSAGE;
|
---|
38 | }
|
---|
39 | //------------------------------------------------------------------------------
|
---|
40 | //==============================================================================
|
---|