xref: /haiku/src/apps/cortex/TransportView/TransportWindow.cpp (revision d3d8b26997fac34a84981e6d2b649521de2cc45a)
1 // TransportWindow.cpp
2 
3 #include "TransportWindow.h"
4 #include "RouteWindow.h"
5 #include "TransportView.h"
6 
7 #include "NodeGroup.h"
8 
9 #include <Debug.h>
10 #include <Message.h>
11 #include <Messenger.h>
12 #include <View.h>
13 
14 __USE_CORTEX_NAMESPACE
15 
16 // -------------------------------------------------------- //
17 // *** ctors/dtor
18 // -------------------------------------------------------- //
19 
20 TransportWindow::~TransportWindow() {}
21 
22 TransportWindow::TransportWindow(
23 	NodeManager*						manager,
24 	BWindow*								parent,
25 	const char*							name) :
26 	BWindow(
27 		BRect(200,200,200,200),
28 		name,
29 		B_FLOATING_WINDOW_LOOK, B_FLOATING_SUBSET_WINDOW_FEEL,
30 		B_WILL_ACCEPT_FIRST_CLICK|B_AVOID_FOCUS|B_NOT_ZOOMABLE|B_NOT_RESIZABLE|B_ASYNCHRONOUS_CONTROLS),
31 	m_view(0),
32 	m_parent(parent) {
33 
34 	AddToSubset(m_parent);
35 
36 	ASSERT(parent);
37 	ASSERT(manager);
38 
39 	m_view = new TransportView(manager, "transportView");
40 	AddChild(m_view);
41 }
42 
43 BMessenger TransportWindow::parentWindow() const {
44 	return BMessenger(m_parent);
45 }
46 
47 // -------------------------------------------------------- //
48 // *** BWindow
49 // -------------------------------------------------------- //
50 
51 bool TransportWindow::QuitRequested() {
52 
53 	// redirect request to parent window
54 	m_parent->PostMessage(RouteWindow::M_TOGGLE_TRANSPORT_WINDOW);
55 	return false;
56 
57 //	BMessage m(RouteWindow::M_INSPECTOR_CLOSED);
58 //	m.AddPointer("inspector", (void*)this);
59 //	m.AddRect("frame", Frame());
60 //	BMessenger(m_routeWindow).SendMessage(&m);
61 //	return true;
62 }
63 
64 // -------------------------------------------------------- //
65 // *** BHandler
66 // -------------------------------------------------------- //
67 
68 void TransportWindow::MessageReceived(
69 	BMessage*								message) {
70 
71 	switch(message->what) {
72 		case M_SELECT_GROUP:
73 			m_view->_handleSelectGroup(message);
74 			break;
75 
76 		case RouteWindow::M_REFRESH_TRANSPORT_SETTINGS:
77 			m_view->_refreshTransportSettings();
78 			break;
79 
80 		default:
81 			_inherited::MessageReceived(message);
82 	}
83 }
84 
85 // END -- TransportWindow.cpp --
86