1b12daa5fSOliver Ruiz Dorantes/*
2b12daa5fSOliver Ruiz Dorantes * Copyright 2007-2008 Oliver Ruiz Dorantes, oliver.ruiz.dorantes_at_gmail.com
3b12daa5fSOliver Ruiz Dorantes *
4b12daa5fSOliver Ruiz Dorantes * All rights reserved. Distributed under the terms of the MIT License.
5b12daa5fSOliver Ruiz Dorantes *
6b12daa5fSOliver Ruiz Dorantes */
7b12daa5fSOliver Ruiz Dorantes
8b12daa5fSOliver Ruiz Dorantes#include <ConnectionIncoming.h>
9b12daa5fSOliver Ruiz Dorantes
10f696e88aSlooncraz
11b12daa5fSOliver Ruiz Dorantes#define B_PULSES_BY_SECOND(x) (2*x)
12b12daa5fSOliver Ruiz Dorantes
13b12daa5fSOliver Ruiz Dorantes
14f696e88aSlooncraznamespace Bluetooth {
15b12daa5fSOliver Ruiz Dorantes
16b12daa5fSOliver Ruiz Dorantes
17f696e88aSlooncrazConnectionView::ConnectionView(BRect frame, const char *name)
18f696e88aSlooncraz	:
19f696e88aSlooncraz	BView(BRect(0, 0, 400, 400), "MyViewName", B_FOLLOW_LEFT | B_FOLLOW_TOP,
20f696e88aSlooncraz		B_WILL_DRAW | B_PULSE_NEEDED)
21f696e88aSlooncraz{
22f696e88aSlooncraz	SetViewUIColor(B_PANEL_BACKGROUND_COLOR);
23b12daa5fSOliver Ruiz Dorantes}
24b12daa5fSOliver Ruiz Dorantes
25f696e88aSlooncraz
26b12daa5fSOliver Ruiz DorantesConnectionView::~ConnectionView()
27b12daa5fSOliver Ruiz Dorantes{
28b12daa5fSOliver Ruiz Dorantes}
29b12daa5fSOliver Ruiz Dorantes
30b12daa5fSOliver Ruiz Dorantes
31b12daa5fSOliver Ruiz Dorantesvoid ConnectionView::MessageReceived(BMessage *message)
32b12daa5fSOliver Ruiz Dorantes{
33b12daa5fSOliver Ruiz Dorantes}
34b12daa5fSOliver Ruiz Dorantes
35b12daa5fSOliver Ruiz Dorantes
36b12daa5fSOliver Ruiz Dorantesvoid ConnectionView::Draw(BRect update)
37b12daa5fSOliver Ruiz Dorantes{
38b12daa5fSOliver Ruiz Dorantes}
39b12daa5fSOliver Ruiz Dorantes
40b12daa5fSOliver Ruiz Dorantes
41b12daa5fSOliver Ruiz Dorantesvoid ConnectionView::Pulse()
42b12daa5fSOliver Ruiz Dorantes{
43b12daa5fSOliver Ruiz Dorantes	static int a = 0;
443205e523SOliver Ruiz Dorantes
453205e523SOliver Ruiz Dorantes	if (a++ == B_PULSES_BY_SECOND(5)) {
463205e523SOliver Ruiz Dorantes		// BUG: for some reason the window is not being removed...
475e531393SOliver Ruiz Dorantes		Window()->PostMessage(B_QUIT_REQUESTED);
483205e523SOliver Ruiz Dorantes		Window()->Quit();
493205e523SOliver Ruiz Dorantes	}
50b12daa5fSOliver Ruiz Dorantes}
51b12daa5fSOliver Ruiz Dorantes
52b12daa5fSOliver Ruiz Dorantes
53f696e88aSlooncraz//#pragma mark -
54f696e88aSlooncraz
55b12daa5fSOliver Ruiz Dorantes
56b12daa5fSOliver Ruiz DorantesConnectionIncoming::ConnectionIncoming(RemoteDevice* rDevice)
57f696e88aSlooncraz	:
58f696e88aSlooncraz	BWindow(BRect(700, 100, 900, 150), "Connection completed",
59f696e88aSlooncraz		B_FLOATING_WINDOW_LOOK, B_NORMAL_WINDOW_FEEL,
60f696e88aSlooncraz		B_NOT_ZOOMABLE | B_NOT_RESIZABLE)
61b12daa5fSOliver Ruiz Dorantes{
623205e523SOliver Ruiz Dorantes	_ConnectionView = new ConnectionView(BRect(0, 0, 400, 400),"mViewName");
63b12daa5fSOliver Ruiz Dorantes
643205e523SOliver Ruiz Dorantes	AddChild(_ConnectionView);
65b12daa5fSOliver Ruiz Dorantes}
66b12daa5fSOliver Ruiz Dorantes
673205e523SOliver Ruiz Dorantes
68b12daa5fSOliver Ruiz DorantesConnectionIncoming::~ConnectionIncoming()
69b12daa5fSOliver Ruiz Dorantes{
70b12daa5fSOliver Ruiz Dorantes}
71b12daa5fSOliver Ruiz Dorantes
723205e523SOliver Ruiz Dorantes
73b12daa5fSOliver Ruiz Dorantesvoid ConnectionIncoming::MessageReceived(BMessage *message)
74b12daa5fSOliver Ruiz Dorantes{
75b12daa5fSOliver Ruiz Dorantes}
76b12daa5fSOliver Ruiz Dorantes
773205e523SOliver Ruiz Dorantes
78b12daa5fSOliver Ruiz Dorantesbool ConnectionIncoming::QuitRequested()
79b12daa5fSOliver Ruiz Dorantes{
80b12daa5fSOliver Ruiz Dorantes	return BWindow::QuitRequested();
81b12daa5fSOliver Ruiz Dorantes}
82b12daa5fSOliver Ruiz Dorantes
83f696e88aSlooncraz
843205e523SOliver Ruiz Dorantes}
85