xref: /haiku/src/apps/diskprobe/ProbeWindow.cpp (revision 83b1a68c52ba3e0e8796282759f694b7fdddf06d)
1 /*
2  * Copyright 2004-2006, Axel Dörfler, axeld@pinc-software.de. All rights reserved.
3  * Distributed under the terms of the MIT License.
4  */
5 
6 
7 #include "ProbeWindow.h"
8 #include "DiskProbe.h"
9 
10 #include <Application.h>
11 #include <View.h>
12 
13 
14 ProbeWindow::ProbeWindow(BRect rect, entry_ref *ref)
15 	: BWindow(rect, ref->name, B_DOCUMENT_WINDOW,
16 		B_ASYNCHRONOUS_CONTROLS | B_AUTO_UPDATE_SIZE_LIMITS),
17 	fRef(*ref)
18 {
19 }
20 
21 
22 ProbeWindow::~ProbeWindow()
23 {
24 }
25 
26 
27 void
28 ProbeWindow::MessageReceived(BMessage *message)
29 {
30 	switch (message->what) {
31 		case B_MOUSE_WHEEL_CHANGED:
32 			if (BView *view = FindView("dataView"))
33 				view->MessageReceived(message);
34 			break;
35 
36 		case B_SIMPLE_DATA:
37 		{
38 			BMessage refsReceived(*message);
39 			refsReceived.what = B_REFS_RECEIVED;
40 			be_app_messenger.SendMessage(&refsReceived);
41 			break;
42 		}
43 
44 		default:
45 			BWindow::MessageReceived(message);
46 	}
47 }
48 
49 
50 bool
51 ProbeWindow::QuitRequested()
52 {
53 	BMessage update(kMsgSettingsChanged);
54 	update.AddRect("window_frame", Frame());
55 	be_app_messenger.SendMessage(&update);
56 
57 	be_app_messenger.SendMessage(kMsgWindowClosed);
58 	return true;
59 }
60 
61