1bef4185eSJérôme Duval /* 2bef4185eSJérôme Duval * Copyright 2003, Michael Phipps. All rights reserved. 3bef4185eSJérôme Duval * Distributed under the terms of the MIT License. 4bef4185eSJérôme Duval */ 5bef4185eSJérôme Duval 6bef4185eSJérôme Duval #include <Application.h> 7bef4185eSJérôme Duval #include <Screen.h> 8*6ebd8e95SJérôme Duval #include <StringView.h> 9bef4185eSJérôme Duval #include "PasswordWindow.h" 10bef4185eSJérôme Duval 11bef4185eSJérôme Duval 12bef4185eSJérôme Duval void 13bef4185eSJérôme Duval PasswordWindow::Setup() 14bef4185eSJérôme Duval { 15bef4185eSJérôme Duval BScreen theScreen(B_MAIN_SCREEN_ID); 16bef4185eSJérôme Duval MoveTo((theScreen.Frame().IntegerWidth()-Bounds().IntegerWidth())/2,(theScreen.Frame().IntegerHeight()-Bounds().IntegerHeight())/2); 17bef4185eSJérôme Duval fBgd=new BView (Bounds(),"fBgdView",0,0); 18bef4185eSJérôme Duval fBgd->SetHighColor(ui_color(B_MENU_BACKGROUND_COLOR)); 19bef4185eSJérôme Duval fBgd->SetLowColor(ui_color(B_MENU_BACKGROUND_COLOR)); 20bef4185eSJérôme Duval fBgd->SetViewColor(ui_color(B_MENU_BACKGROUND_COLOR)); 21bef4185eSJérôme Duval AddChild(fBgd); 22bef4185eSJérôme Duval BRect bounds(fBgd->Bounds()); 23bef4185eSJérôme Duval bounds.InsetBy(5,5); 24bef4185eSJérôme Duval 25bef4185eSJérôme Duval fCustomBox = new BBox(bounds, "custBeBox", B_FOLLOW_NONE); 26*6ebd8e95SJérôme Duval BStringView *label = new BStringView(BRect(0,0,60,15), "labelView", "Unlock screen saver"); 27*6ebd8e95SJérôme Duval fCustomBox->SetLabel(label); 28bef4185eSJérôme Duval fBgd->AddChild(fCustomBox); 29bef4185eSJérôme Duval 30*6ebd8e95SJérôme Duval fPassword = new BTextControl(BRect(10,28,260,47),"pwdCntrl","Enter password:", NULL, B_FOLLOW_NONE); 310b092335SJérôme Duval fPassword->TextView()->HideTyping(true); 32bef4185eSJérôme Duval fPassword->SetDivider(100); 33bef4185eSJérôme Duval fCustomBox->AddChild(fPassword); 34cc5b9137SJérôme Duval fPassword->MakeFocus(true); 35bef4185eSJérôme Duval 36bef4185eSJérôme Duval fUnlock = new BButton(BRect(160,70,255,85), "fUnlock", "Unlock", new BMessage(UNLOCK_MESSAGE), B_FOLLOW_NONE); 37bef4185eSJérôme Duval fUnlock->SetTarget(NULL, be_app); 38bef4185eSJérôme Duval fCustomBox->AddChild(fUnlock); 39bef4185eSJérôme Duval fUnlock->MakeDefault(true); 40bef4185eSJérôme Duval } 41bef4185eSJérôme Duval 42