diff --git a/src/bin/screen_blanker/PasswordWindow.cpp b/src/bin/screen_blanker/PasswordWindow.cpp index 3aa5066d79..006e93f916 100644 --- a/src/bin/screen_blanker/PasswordWindow.cpp +++ b/src/bin/screen_blanker/PasswordWindow.cpp @@ -1,56 +1,66 @@ /* - * Copyright 2003-2006, Haiku. + * Copyright 2003-2007, Haiku, Inc. All Rights Reserved. * Distributed under the terms of the MIT License. * * Authors: * Michael Phipps * Jérôme Duval, jerome.duval@free.fr + * Julun */ #include "PasswordWindow.h" + #include #include #include #include -#include PasswordWindow::PasswordWindow() : BWindow(BRect(100, 100, 400, 230), "Enter Password", B_NO_BORDER_WINDOW_LOOK, B_FLOATING_ALL_WINDOW_FEEL, B_NOT_MOVABLE | B_NOT_CLOSABLE |B_NOT_ZOOMABLE | B_NOT_MINIMIZABLE - | B_NOT_RESIZABLE | B_ASYNCHRONOUS_CONTROLS , - B_ALL_WORKSPACES) + | B_NOT_RESIZABLE | B_ASYNCHRONOUS_CONTROLS , B_ALL_WORKSPACES) { - BScreen screen(this); - MoveTo(screen.Frame().left + (screen.Frame().Width() - Bounds().Width()) / 2, - screen.Frame().top + (screen.Frame().Height() - Bounds().Height()) / 2); - - BView* topView = new BView(Bounds(), "top", B_FOLLOW_ALL, B_WILL_DRAW); - topView->SetViewColor(ui_color(B_MENU_BACKGROUND_COLOR)); + BView* topView = new BView(Bounds(), "topView", B_FOLLOW_ALL, B_WILL_DRAW); + topView->SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR)); AddChild(topView); BRect bounds(Bounds()); - bounds.InsetBy(5, 5); + bounds.InsetBy(10.0, 10.0); - BBox* box = new BBox(bounds, NULL, B_FOLLOW_NONE); - box->SetLabel("Unlock screen saver"); - topView->AddChild(box); - - fPassword = new BTextControl(BRect(10,28,260,47), NULL, "Enter password:", - NULL, B_FOLLOW_NONE); - fPassword->TextView()->HideTyping(true); - fPassword->SetDivider(100); - box->AddChild(fPassword); + BBox *customBox = new BBox(bounds, "customBox", B_FOLLOW_NONE); + topView->AddChild(customBox); + customBox->SetLabel("Unlock screen saver"); + + bounds.top += 10.0; + fPassword = new BTextControl(bounds, "password", "Enter password:", + "VeryLongPasswordPossible", B_FOLLOW_NONE); + customBox->AddChild(fPassword); fPassword->MakeFocus(true); + fPassword->ResizeToPreferred(); + fPassword->TextView()->HideTyping(true); + fPassword->SetDivider(be_plain_font->StringWidth("Enter password:") + 5.0); - BButton* button = new BButton(BRect(160,70,255,85), "fUnlock", "Unlock", + BButton* button = new BButton(BRect(), "unlock", "Unlock", new BMessage(kMsgUnlock), B_FOLLOW_NONE); - button->SetTarget(NULL, be_app); - box->AddChild(button); + customBox->AddChild(button); button->MakeDefault(true); + button->ResizeToPreferred(); + button->SetTarget(NULL, be_app); + + BRect frame = fPassword->Frame(); + button->MoveTo(frame.right - button->Bounds().Width(), frame.bottom + 10.0); + customBox->ResizeTo(frame.right + 10.0, button->Frame().bottom + 10.0); + + frame = customBox->Frame(); + ResizeTo(frame.right + 10.0, frame.bottom + 10.0); + + BScreen screen(this); + MoveTo(screen.Frame().left + (screen.Frame().Width() - Bounds().Width()) / 2, + screen.Frame().top + (screen.Frame().Height() - Bounds().Height()) / 2); } diff --git a/src/bin/screen_blanker/PasswordWindow.h b/src/bin/screen_blanker/PasswordWindow.h index dbea9b679a..f8abb99013 100644 --- a/src/bin/screen_blanker/PasswordWindow.h +++ b/src/bin/screen_blanker/PasswordWindow.h @@ -1,5 +1,5 @@ /* - * Copyright 2003-2006, Haiku. + * Copyright 2003-2007, Haiku, Inc. All Rights Reserved. * Distributed under the terms of the MIT License. * * Authors: @@ -16,7 +16,8 @@ const static int32 kMsgUnlock = 'ULMS'; -class PasswordWindow : public BWindow{ + +class PasswordWindow : public BWindow { public: PasswordWindow();