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