2 #include <Application.h>
7 class MouseView
: public BView
{
9 MouseView(BRect frame
, bool noHistory
);
12 virtual void AttachedToWindow();
13 virtual void MouseMoved(BPoint point
, uint32 transit
,
14 const BMessage
*message
);
15 virtual void MouseDown(BPoint point
);
16 virtual void MouseUp(BPoint point
);
23 MouseView::MouseView(BRect frame
, bool noHistory
)
24 : BView(frame
, "MouseView", B_FOLLOW_ALL
, B_WILL_DRAW
),
27 SetViewColor(255, 255, 200);
29 SetHighColor(200, 0, 0);
31 SetHighColor(0, 200, 0);
35 MouseView::~MouseView()
41 MouseView::AttachedToWindow()
44 SetEventMask(0, B_NO_POINTER_HISTORY
);
49 MouseView::MouseDown(BPoint point
)
51 SetMouseEventMask(0, B_NO_POINTER_HISTORY
);
52 SetHighColor(0, 0, 200);
57 MouseView::MouseUp(BPoint point
)
60 SetHighColor(200, 0, 0);
62 SetHighColor(0, 200, 0);
67 MouseView::MouseMoved(BPoint point
, uint32 transit
, const BMessage
*message
)
69 FillRect(BRect(point
- BPoint(1, 1), point
+ BPoint(1, 1)));
78 main(int argc
, char** argv
)
80 BApplication
app("application/x-vnd.Simon-NoPointerHistory");
82 BWindow
* window
= new BWindow(BRect(100, 100, 700, 400), "Window",
83 B_TITLED_WINDOW
, B_QUIT_ON_WINDOW_CLOSE
);
84 window
->AddChild(new MouseView(BRect(10, 10, 295, 290), true));
85 window
->AddChild(new MouseView(BRect(305, 10, 590, 290), false));