xref: /haiku/src/bin/screen_blanker/PasswordWindow.cpp (revision 7008829b0f31b1407d6e1394525765da88d9763f)
1bef4185eSJérôme Duval /*
2911290f7SJérôme Duval  * Copyright 2003-2005, Haiku.
3bef4185eSJérôme Duval  * Distributed under the terms of the MIT License.
4911290f7SJérôme Duval  *
5911290f7SJérôme Duval  * Authors:
6911290f7SJérôme Duval  *		Michael Phipps
7*7008829bSJérôme Duval  *		Jérôme Duval, jerome.duval@free.fr
8bef4185eSJérôme Duval  */
9bef4185eSJérôme Duval #include <Application.h>
10bef4185eSJérôme Duval #include <Screen.h>
116ebd8e95SJérôme Duval #include <StringView.h>
12bef4185eSJérôme Duval #include "PasswordWindow.h"
13bef4185eSJérôme Duval 
14bef4185eSJérôme Duval 
15bef4185eSJérôme Duval void
16bef4185eSJérôme Duval PasswordWindow::Setup()
17bef4185eSJérôme Duval {
1809362b0dSJérôme Duval 	BScreen theScreen(this);
19bef4185eSJérôme Duval 	MoveTo((theScreen.Frame().IntegerWidth()-Bounds().IntegerWidth())/2,(theScreen.Frame().IntegerHeight()-Bounds().IntegerHeight())/2);
20bef4185eSJérôme Duval 	fBgd=new BView (Bounds(),"fBgdView",0,0);
21bef4185eSJérôme Duval 	fBgd->SetHighColor(ui_color(B_MENU_BACKGROUND_COLOR));
22bef4185eSJérôme Duval 	fBgd->SetLowColor(ui_color(B_MENU_BACKGROUND_COLOR));
23bef4185eSJérôme Duval 	fBgd->SetViewColor(ui_color(B_MENU_BACKGROUND_COLOR));
24bef4185eSJérôme Duval 	AddChild(fBgd);
25bef4185eSJérôme Duval 	BRect bounds(fBgd->Bounds());
26bef4185eSJérôme Duval 	bounds.InsetBy(5,5);
27bef4185eSJérôme Duval 
28bef4185eSJérôme Duval 	fCustomBox = new BBox(bounds, "custBeBox", B_FOLLOW_NONE);
296ebd8e95SJérôme Duval 	BStringView *label = new BStringView(BRect(0,0,60,15), "labelView", "Unlock screen saver");
306ebd8e95SJérôme Duval 	fCustomBox->SetLabel(label);
31bef4185eSJérôme Duval 	fBgd->AddChild(fCustomBox);
32bef4185eSJérôme Duval 
336ebd8e95SJérôme Duval 	fPassword = new BTextControl(BRect(10,28,260,47),"pwdCntrl","Enter password:", NULL, B_FOLLOW_NONE);
340b092335SJérôme Duval 	fPassword->TextView()->HideTyping(true);
35bef4185eSJérôme Duval 	fPassword->SetDivider(100);
36bef4185eSJérôme Duval 	fCustomBox->AddChild(fPassword);
37cc5b9137SJérôme Duval 	fPassword->MakeFocus(true);
38bef4185eSJérôme Duval 
39bef4185eSJérôme Duval 	fUnlock = new BButton(BRect(160,70,255,85), "fUnlock", "Unlock", new BMessage(UNLOCK_MESSAGE), B_FOLLOW_NONE);
40bef4185eSJérôme Duval 	fUnlock->SetTarget(NULL, be_app);
41bef4185eSJérôme Duval 	fCustomBox->AddChild(fUnlock);
42bef4185eSJérôme Duval 	fUnlock->MakeDefault(true);
43bef4185eSJérôme Duval }
44bef4185eSJérôme Duval 
45