btrfs: Attempt to fix GCC2 build.
[haiku.git] / src / apps / diskusage / MainWindow.cpp
blob4f3beb3b60622723c169d3f058582f66fe93c8f9
1 /*
2 * Copyright (c) 2008 Stephan Aßmus <superstippi@gmx.de>.
3 * Copyright (c) 2009 Philippe Saint-Pierre, stpere@gmail.com
4 * All rights reserved. Distributed under the terms of the MIT license.
6 * Copyright (c) 1999 Mike Steed. You are free to use and distribute this software
7 * as long as it is accompanied by it's documentation and this copyright notice.
8 * The software comes with no warranty, etc.
9 */
10 #include "MainWindow.h"
12 #include <Application.h>
13 #include <Catalog.h>
14 #include <Node.h>
15 #include <Roster.h>
16 #include <Screen.h>
18 #include <LayoutBuilder.h>
20 #include "DiskUsage.h"
21 #include "ControlsView.h"
23 #undef B_TRANSLATION_CONTEXT
24 #define B_TRANSLATION_CONTEXT "MainWindow"
26 MainWindow::MainWindow(BRect pieRect)
28 BWindow(pieRect, B_TRANSLATE_SYSTEM_NAME("DiskUsage"), B_TITLED_WINDOW,
29 B_ASYNCHRONOUS_CONTROLS | B_QUIT_ON_WINDOW_CLOSE
30 | B_AUTO_UPDATE_SIZE_LIMITS)
32 fControlsView = new ControlsView();
34 SetLayout(new BGroupLayout(B_VERTICAL));
36 AddChild(BLayoutBuilder::Group<>(B_VERTICAL)
37 .Add(fControlsView)
38 .SetInsets(0, B_USE_WINDOW_SPACING, 0, 0)
40 float maxHeight = BScreen(this).Frame().Height() - 12;
41 fControlsView->SetExplicitMaxSize(BSize(maxHeight, maxHeight));
45 MainWindow::~MainWindow()
50 void
51 MainWindow::MessageReceived(BMessage* message)
53 switch (message->what) {
54 case kBtnCancel:
55 case kBtnRescan:
56 case B_SIMPLE_DATA:
57 case B_REFS_RECEIVED:
58 fControlsView->MessageReceived(message);
59 break;
61 default:
62 BWindow::MessageReceived(message);
63 break;
68 bool
69 MainWindow::QuitRequested()
71 be_app->PostMessage(B_QUIT_REQUESTED);
72 return true;
76 // #pragma mark -
79 void
80 MainWindow::EnableRescan()
82 fControlsView->EnableRescan();
86 void
87 MainWindow::EnableCancel()
89 fControlsView->EnableCancel();
93 void
94 MainWindow::ShowInfo(const FileInfo* info)
96 fControlsView->ShowInfo(info);
100 BVolume*
101 MainWindow::FindDeviceFor(dev_t device, bool invoke)
103 return fControlsView->FindDeviceFor(device, invoke);