small cleanup
password window is now font sensitiv, fixes Ticket #705 git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@23548 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
parent
c0a4294edd
commit
13ab80745a
@ -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 <host.haiku@gmx.de>
|
||||
*/
|
||||
|
||||
|
||||
#include "PasswordWindow.h"
|
||||
|
||||
|
||||
#include <Application.h>
|
||||
#include <Box.h>
|
||||
#include <Button.h>
|
||||
#include <Screen.h>
|
||||
#include <StringView.h>
|
||||
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
|
||||
|
@ -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();
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user