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