btrfs: Attempt to fix GCC2 build.
[haiku.git] / src / apps / bootmanager / BootManagerWindow.cpp
blob24330c3fdd06a5421aad93e5de27e74b0beef7d1
1 /*
2 * Copyright 2008-2010, Haiku, Inc. All rights reserved.
3 * Distributed under the terms of the MIT License.
5 * Authors:
6 * Michael Pfeiffer <laplace@users.sourceforge.net>
7 */
10 #include "BootManagerWindow.h"
12 #include <Application.h>
13 #include <Catalog.h>
14 #include <LayoutBuilder.h>
15 #include <Roster.h>
16 #include <Screen.h>
18 #include <tracker_private.h>
20 #include "DefaultPartitionPage.h"
21 #include "PartitionsPage.h"
22 #include "WizardView.h"
25 #undef B_TRANSLATION_CONTEXT
26 #define B_TRANSLATION_CONTEXT "BootManagerWindow"
29 BootManagerWindow::BootManagerWindow()
31 BWindow(BRect(100, 100, 500, 400), B_TRANSLATE_SYSTEM_NAME("BootManager"),
32 B_TITLED_WINDOW, B_ASYNCHRONOUS_CONTROLS | B_NOT_ZOOMABLE
33 | B_AUTO_UPDATE_SIZE_LIMITS)
35 float minWidth, maxWidth, minHeight, maxHeight;
36 GetSizeLimits(&minWidth, &maxWidth, &minHeight, &maxHeight);
38 // Use font to determine necessary size of window:
39 const BFont* font = be_plain_font;
40 minWidth = 400 * (double)font->Size() / 12.0f;
41 minHeight = 250 * (double)font->Size() / 12.0f;
43 SetSizeLimits(minWidth, maxWidth, minHeight, maxHeight);
45 fWizardView = new WizardView("wizard");
46 BLayoutBuilder::Group<>(this)
47 .Add(fWizardView);
49 fController.Initialize(fWizardView);
51 CenterOnScreen();
53 // Prevent minimizing this window if the user would have no way to
54 // get back to it. (For example when only the Installer runs.)
55 if (!be_roster->IsRunning(kDeskbarSignature))
56 SetFlags(Flags() | B_NOT_MINIMIZABLE);
60 BootManagerWindow::~BootManagerWindow()
65 void
66 BootManagerWindow::MessageReceived(BMessage* msg)
68 switch (msg->what) {
69 case kMessageNext:
70 fController.Next(fWizardView);
71 break;
73 case kMessagePrevious:
74 fController.Previous(fWizardView);
75 break;
77 default:
78 BWindow::MessageReceived(msg);
83 bool
84 BootManagerWindow::QuitRequested()
86 be_app->PostMessage(B_QUIT_REQUESTED);
87 return true;