1 /* 2 * Copyright 2007-2008 Oliver Ruiz Dorantes, oliver.ruiz.dorantes_at_gmail.com 3 * 4 * All rights reserved. Distributed under the terms of the MIT License. 5 * 6 */ 7 8 #include <ConnectionIncoming.h> 9 10 #define B_PULSES_BY_SECOND(x) (2*x) 11 12 namespace Bluetooth { 13 14 ConnectionView::ConnectionView(BRect frame, const char *name): BView(BRect(0, 0, 400, 400), "MyViewName", 15 B_FOLLOW_LEFT | B_FOLLOW_TOP, 16 B_WILL_DRAW | B_PULSE_NEEDED) 17 { 18 19 SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR)); 20 21 } 22 23 ConnectionView::~ConnectionView() 24 { 25 26 } 27 28 29 void ConnectionView::MessageReceived(BMessage *message) 30 { 31 switch(message->what) 32 { 33 default: 34 35 break; 36 } 37 } 38 39 40 void ConnectionView::Draw(BRect update) 41 { 42 43 } 44 45 46 void ConnectionView::Pulse() 47 { 48 static int a = 0; 49 50 if (a++ == B_PULSES_BY_SECOND(5)) { 51 // BUG: for some reason the window is not being removed... 52 Window()->PostMessage(B_QUIT_REQUESTED); 53 Window()->Quit(); 54 } 55 } 56 57 58 59 //--------------------------------------------------------------- 60 ConnectionIncoming::ConnectionIncoming(RemoteDevice* rDevice) 61 : BWindow(BRect(700, 100, 900, 150), "Connection Completed", 62 B_FLOATING_WINDOW_LOOK, B_NORMAL_WINDOW_FEEL, 63 B_NOT_ZOOMABLE | B_NOT_RESIZABLE) 64 { 65 _ConnectionView = new ConnectionView(BRect(0, 0, 400, 400),"mViewName"); 66 67 AddChild(_ConnectionView); 68 } 69 70 71 ConnectionIncoming::~ConnectionIncoming() 72 { 73 74 } 75 76 77 void ConnectionIncoming::MessageReceived(BMessage *message) 78 { 79 switch(message->what) 80 { 81 default: 82 83 break; 84 } 85 } 86 87 88 bool ConnectionIncoming::QuitRequested() 89 { 90 return BWindow::QuitRequested(); 91 } 92 93 } 94