xref: /haiku/src/kits/bluetooth/UI/ConnectionIncoming.cpp (revision e221c09e508ffc3c62738140c9b6fc4fa211662a)
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 
13 ConnectionView::ConnectionView(BRect frame, const char *name, uint32 resizeMask, uint32 flags)
14 		: BView(BRect(0, 0, 400, 400), "MyViewName", B_FOLLOW_LEFT | B_FOLLOW_TOP,
15 		B_WILL_DRAW | B_PULSE_NEEDED)
16 {
17 
18 	SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR));
19 
20 }
21 
22 ConnectionView::~ConnectionView()
23 {
24 
25 }
26 
27 
28 void ConnectionView::MessageReceived(BMessage *message)
29 {
30 	switch(message->what)
31 	{
32 	default:
33 
34 	break;
35 	}
36 }
37 
38 
39 void ConnectionView::Draw(BRect update)
40 {
41 
42 }
43 
44 
45 void ConnectionView::Pulse()
46 {
47 	static int a = 0;
48 	if (a++ == B_PULSES_BY_SECOND(5))
49 		Window()->QuitRequested();
50 
51 }
52 
53 
54 
55 //---------------------------------------------------------------
56 //---------------------------------------------------------------
57 //---------------------------------------------------------------
58 ConnectionIncoming::ConnectionIncoming(RemoteDevice* rDevice)
59 			 : BWindow(BRect(700, 100, 900, 150), "Incomming Connection",
60                                    B_FLOATING_WINDOW_LOOK, B_NORMAL_WINDOW_FEEL,
61                                    B_NOT_ZOOMABLE | B_NOT_RESIZABLE)
62 {
63 _ConnectionView = new ConnectionView(BRect(0, 0, 400, 400),"mViewName", B_FOLLOW_TOP | B_FOLLOW_LEFT, B_WILL_DRAW);
64 
65 AddChild(_ConnectionView);
66 }
67 
68 //---------------------------------------------------------------
69 ConnectionIncoming::~ConnectionIncoming()
70 {
71 
72 }
73 
74 //---------------------------------------------------------------
75 void ConnectionIncoming::MessageReceived(BMessage *message)
76 {
77 	switch(message->what)
78 	{
79 	default:
80 
81 	break;
82 	}
83 }
84 
85 //---------------------------------------------------------------
86 bool ConnectionIncoming::QuitRequested()
87 {
88 	Quit();
89 	return BWindow::QuitRequested();
90 }
91 
92