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.
10 #include "MainWindow.h"
12 #include <Application.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
)
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()
51 MainWindow::MessageReceived(BMessage
* message
)
53 switch (message
->what
) {
58 fControlsView
->MessageReceived(message
);
62 BWindow::MessageReceived(message
);
69 MainWindow::QuitRequested()
71 be_app
->PostMessage(B_QUIT_REQUESTED
);
80 MainWindow::EnableRescan()
82 fControlsView
->EnableRescan();
87 MainWindow::EnableCancel()
89 fControlsView
->EnableCancel();
94 MainWindow::ShowInfo(const FileInfo
* info
)
96 fControlsView
->ShowInfo(info
);
101 MainWindow::FindDeviceFor(dev_t device
, bool invoke
)
103 return fControlsView
->FindDeviceFor(device
, invoke
);