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