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