haiku/3rdparty/mmu_man/themes/TextInputAlert.cpp
François Revol f0d95841ee Add missing copyrights.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@27811 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-10-01 04:28:35 +00:00

52 lines
1.1 KiB
C++

/*
* Copyright 2007-2008, François Revol, <revol@free.fr>. All rights reserved.
* Distributed under the terms of the MIT License.
*/
//HACK :P
#define private public
#include <Alert.h>
#undef private
#include "TextInputAlert.h"
#define TEXT_HEIGHT 25
TextInputAlert::TextInputAlert(const char *title,
const char *text,
const char *initial, /* initial input value */
const char *button0Label,
const char *button1Label,
const char *button2Label,
button_width widthStyle,
alert_type type)
: BAlert(title, text, button0Label, button1Label, button2Label, widthStyle, type)
{
ResizeBy(0,TEXT_HEIGHT);
BRect f = Bounds();
f.InsetBySelf(TEXT_HEIGHT, f.Height()/4 - TEXT_HEIGHT/2);
f.left *= 3;
fText = new BTextControl(f, "text", "Name:", initial, NULL);
fText->SetDivider(f.Width()/3);
ChildAt(0)->AddChild(fText);
TextView()->Hide();
fText->SetViewColor(ChildAt(0)->ViewColor());
fText->SetLowColor(ChildAt(0)->LowColor());
fText->TextView()->SelectAll();
}
TextInputAlert::~TextInputAlert()
{
}
void
TextInputAlert::Show()
{
BAlert::Show();
}