1 2 #include <stdio.h> 3 4 #include <Message.h> 5 6 #include "Desktop.h" 7 8 #include "DrawView.h" 9 10 // constructor 11 DrawView::DrawView(BRect frame) 12 : BView(frame, "desktop", B_FOLLOW_ALL, 0), 13 fDesktop(NULL) 14 { 15 SetViewColor(B_TRANSPARENT_COLOR); 16 } 17 18 // destructor 19 DrawView::~DrawView() 20 { 21 } 22 23 // MouseDown 24 void 25 DrawView::MouseDown(BPoint where) 26 { 27 SetMouseEventMask(B_POINTER_EVENTS, B_LOCK_WINDOW_FOCUS); 28 29 fDesktop->PostMessage(Window()->CurrentMessage()); 30 } 31 32 // MouseUp 33 void 34 DrawView::MouseUp(BPoint where) 35 { 36 fDesktop->PostMessage(Window()->CurrentMessage()); 37 } 38 39 // MouseMoved 40 void 41 DrawView::MouseMoved(BPoint where, uint32 code, const BMessage* dragMessage) 42 { 43 fDesktop->PostMessage(Window()->CurrentMessage()); 44 } 45 46 // SetDesktop 47 void 48 DrawView::SetDesktop(Desktop* desktop) 49 { 50 fDesktop = desktop; 51 } 52 53 54