xref: /haiku/src/apps/haikudepot/ui/ShuttingDownWindow.cpp (revision 95c7b01864a09a574f2cb5e2d61e991c74970d19)
1*95c7b018SAndrew Lindesay /*
2*95c7b018SAndrew Lindesay  * Copyright 2021, Andrew Lindesay <apl@lindesay.co.nz>.
3*95c7b018SAndrew Lindesay  * All rights reserved. Distributed under the terms of the MIT License.
4*95c7b018SAndrew Lindesay  */
5*95c7b018SAndrew Lindesay #include "ShuttingDownWindow.h"
6*95c7b018SAndrew Lindesay 
7*95c7b018SAndrew Lindesay #include <Catalog.h>
8*95c7b018SAndrew Lindesay #include <LayoutBuilder.h>
9*95c7b018SAndrew Lindesay #include <Locker.h>
10*95c7b018SAndrew Lindesay 
11*95c7b018SAndrew Lindesay 
12*95c7b018SAndrew Lindesay #undef B_TRANSLATION_CONTEXT
13*95c7b018SAndrew Lindesay #define B_TRANSLATION_CONTEXT "ShuttingDownWindow"
14*95c7b018SAndrew Lindesay 
15*95c7b018SAndrew Lindesay #define WINDOW_FRAME BRect(0, 0, 240, 120)
16*95c7b018SAndrew Lindesay 
17*95c7b018SAndrew Lindesay 
18*95c7b018SAndrew Lindesay ShuttingDownWindow::ShuttingDownWindow(BWindow* parent)
19*95c7b018SAndrew Lindesay 	:
20*95c7b018SAndrew Lindesay 	BWindow(WINDOW_FRAME, B_TRANSLATE("Shutting Down"),
21*95c7b018SAndrew Lindesay 		B_FLOATING_WINDOW_LOOK, B_MODAL_SUBSET_WINDOW_FEEL,
22*95c7b018SAndrew Lindesay 		B_ASYNCHRONOUS_CONTROLS | B_AUTO_UPDATE_SIZE_LIMITS
23*95c7b018SAndrew Lindesay 			| B_NOT_RESIZABLE | B_NOT_ZOOMABLE | B_NOT_CLOSABLE )
24*95c7b018SAndrew Lindesay {
25*95c7b018SAndrew Lindesay 	AddToSubset(parent);
26*95c7b018SAndrew Lindesay 
27*95c7b018SAndrew Lindesay 	BTextView* textView = new BTextView("shutting down message");
28*95c7b018SAndrew Lindesay 	textView->AdoptSystemColors();
29*95c7b018SAndrew Lindesay 	textView->MakeEditable(false);
30*95c7b018SAndrew Lindesay 	textView->MakeSelectable(false);
31*95c7b018SAndrew Lindesay 	textView->SetText(B_TRANSLATE("Haiku Depot is stopping or completing "
32*95c7b018SAndrew Lindesay 		"running operations before shutting down."));
33*95c7b018SAndrew Lindesay 
34*95c7b018SAndrew Lindesay 	BLayoutBuilder::Group<>(this, B_VERTICAL, 0)
35*95c7b018SAndrew Lindesay 			.SetInsets(B_USE_WINDOW_SPACING, B_USE_WINDOW_SPACING,
36*95c7b018SAndrew Lindesay 				B_USE_WINDOW_SPACING, B_USE_DEFAULT_SPACING)
37*95c7b018SAndrew Lindesay 			.Add(textView)
38*95c7b018SAndrew Lindesay 		.End();
39*95c7b018SAndrew Lindesay 
40*95c7b018SAndrew Lindesay 	CenterOnScreen();
41*95c7b018SAndrew Lindesay }
42*95c7b018SAndrew Lindesay 
43*95c7b018SAndrew Lindesay 
44*95c7b018SAndrew Lindesay ShuttingDownWindow::~ShuttingDownWindow()
45*95c7b018SAndrew Lindesay {
46*95c7b018SAndrew Lindesay }
47*95c7b018SAndrew Lindesay 
48