xref: /haiku/src/apps/haikudepot/ui/ShuttingDownWindow.cpp (revision 05bd1a31dc7a9b4e79ca2d6acc9bdad252f853f8)
195c7b018SAndrew Lindesay /*
295c7b018SAndrew Lindesay  * Copyright 2021, Andrew Lindesay <apl@lindesay.co.nz>.
395c7b018SAndrew Lindesay  * All rights reserved. Distributed under the terms of the MIT License.
495c7b018SAndrew Lindesay  */
595c7b018SAndrew Lindesay #include "ShuttingDownWindow.h"
695c7b018SAndrew Lindesay 
795c7b018SAndrew Lindesay #include <Catalog.h>
895c7b018SAndrew Lindesay #include <LayoutBuilder.h>
995c7b018SAndrew Lindesay #include <Locker.h>
1095c7b018SAndrew Lindesay 
1195c7b018SAndrew Lindesay 
1295c7b018SAndrew Lindesay #undef B_TRANSLATION_CONTEXT
1395c7b018SAndrew Lindesay #define B_TRANSLATION_CONTEXT "ShuttingDownWindow"
1495c7b018SAndrew Lindesay 
1595c7b018SAndrew Lindesay #define WINDOW_FRAME BRect(0, 0, 240, 120)
1695c7b018SAndrew Lindesay 
1795c7b018SAndrew Lindesay 
ShuttingDownWindow(BWindow * parent)1895c7b018SAndrew Lindesay ShuttingDownWindow::ShuttingDownWindow(BWindow* parent)
1995c7b018SAndrew Lindesay 	:
20ee88fb6fSHumdinger 	BWindow(WINDOW_FRAME, B_TRANSLATE("Cleaning up" B_UTF8_ELLIPSIS),
2195c7b018SAndrew Lindesay 		B_FLOATING_WINDOW_LOOK, B_MODAL_SUBSET_WINDOW_FEEL,
2295c7b018SAndrew Lindesay 		B_ASYNCHRONOUS_CONTROLS | B_AUTO_UPDATE_SIZE_LIMITS
2395c7b018SAndrew Lindesay 			| B_NOT_RESIZABLE | B_NOT_ZOOMABLE | B_NOT_CLOSABLE )
2495c7b018SAndrew Lindesay {
2595c7b018SAndrew Lindesay 	AddToSubset(parent);
2695c7b018SAndrew Lindesay 
2795c7b018SAndrew Lindesay 	BTextView* textView = new BTextView("shutting down message");
2895c7b018SAndrew Lindesay 	textView->AdoptSystemColors();
2995c7b018SAndrew Lindesay 	textView->MakeEditable(false);
3095c7b018SAndrew Lindesay 	textView->MakeSelectable(false);
3195c7b018SAndrew Lindesay 	textView->SetText(B_TRANSLATE("HaikuDepot is stopping or completing "
32ee88fb6fSHumdinger 		"running operations before quitting."));
3395c7b018SAndrew Lindesay 
3495c7b018SAndrew Lindesay 	BLayoutBuilder::Group<>(this, B_VERTICAL, 0)
3595c7b018SAndrew Lindesay 			.SetInsets(B_USE_WINDOW_SPACING, B_USE_WINDOW_SPACING,
3695c7b018SAndrew Lindesay 				B_USE_WINDOW_SPACING, B_USE_DEFAULT_SPACING)
3795c7b018SAndrew Lindesay 			.Add(textView)
3895c7b018SAndrew Lindesay 		.End();
3995c7b018SAndrew Lindesay 
4095c7b018SAndrew Lindesay 	CenterOnScreen();
41*05bd1a31SAndrew Lindesay 	ResizeToPreferred();
4295c7b018SAndrew Lindesay }
4395c7b018SAndrew Lindesay 
4495c7b018SAndrew Lindesay 
~ShuttingDownWindow()4595c7b018SAndrew Lindesay ShuttingDownWindow::~ShuttingDownWindow()
4695c7b018SAndrew Lindesay {
4795c7b018SAndrew Lindesay }
4895c7b018SAndrew Lindesay 
49