update the playground to my local changes, the textview test isintegrated with the build now

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@12566 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Stephan Aßmus 2005-05-04 00:38:14 +00:00
parent fc72699071
commit a3b4fd6b87
4 changed files with 38 additions and 14 deletions

View File

@ -3,4 +3,5 @@ SubDir OBOS_TOP src tests servers app ;
SubInclude OBOS_TOP src tests servers app copy_bits ;
SubInclude OBOS_TOP src tests servers app painter ;
SubInclude OBOS_TOP src tests servers app scrolling ;
SubInclude OBOS_TOP src tests servers app textview ;
SubInclude OBOS_TOP src tests servers app windows ;

View File

@ -54,6 +54,8 @@ void
TestView::Draw(BRect updateRect)
{
// ellipses
// TODO: this should be unnecessary
SetPenSize(1.0);
SetHighColor(200, 90, 0, 255);
StrokeEllipse(BPoint(80.0, 50.0), 70.0, 40.0);
@ -92,6 +94,7 @@ TestView::MouseMoved(BPoint where, uint32 transit,
const BMessage* dragMessage)
{
if (fTracking) {
printf("TestView::MouseMoved(%.1f, %.1f)\n", where.x, where.y);
BPoint offset = fLastMousePos - where;
ScrollBy(offset.x, offset.y);
fLastMousePos = where + offset;

View File

@ -4,10 +4,12 @@
class window : public BWindow {
public:
window() : BWindow(BRect(10, 10, 300, 300), "BTextView test", B_DOCUMENT_WINDOW, B_ASYNCHRONOUS_CONTROLS)
window() : BWindow(BRect(30, 30, 300, 300), "BTextView test", B_DOCUMENT_WINDOW, B_ASYNCHRONOUS_CONTROLS)
{
BTextView *textview = new BTextView(Bounds(), "textview", Bounds(), B_WILL_DRAW);
BTextView *textview = new BTextView(Bounds(), "textview", Bounds(),
B_FOLLOW_ALL, B_WILL_DRAW);
AddChild(textview);
textview->SetText("Type into the Haiku BTextView!");
textview->MakeFocus();
}

View File

@ -10,6 +10,7 @@
#include <MenuBar.h>
#include <MenuItem.h>
#include <TextControl.h>
#include <TextView.h>
#include <View.h>
#include <Window.h>
@ -24,19 +25,18 @@ class HelloView : public BView {
{
// TODO: Find bug: this influences StringWidth(), but the font is not used
// SetFontSize(9);
rgb_color bg = ui_color(B_PANEL_BACKGROUND_COLOR);
SetViewColor(bg);
SetLowColor(bg);
}
virtual void Draw(BRect updateRect)
{
rgb_color bg = ui_color(B_PANEL_BACKGROUND_COLOR);
rgb_color shadow = tint_color(LowColor(), B_DARKEN_2_TINT);
rgb_color light = tint_color(LowColor(), B_LIGHTEN_MAX_TINT);
SetHighColor(bg);
FillRect(updateRect);
BRect r(Bounds());
rgb_color shadow = tint_color(bg, B_DARKEN_2_TINT);
rgb_color light = tint_color(bg, B_LIGHTEN_MAX_TINT);
BeginLineArray(4);
AddLine(BPoint(r.left, r.top),
BPoint(r.right, r.top), shadow);
@ -97,7 +97,8 @@ class HelloView : public BView {
void
show_window(BRect frame, const char* name)
{
BRect f(0,0, frame.Width(), frame.Height());
// BRect f(0, 0, frame.Width(), frame.Height());
BRect f(frame);
BWindow* window = new BWindow(f, name,
B_TITLED_WINDOW,
B_ASYNCHRONOUS_CONTROLS | B_QUIT_ON_WINDOW_CLOSE);
@ -127,17 +128,34 @@ show_window(BRect frame, const char* name)
bg->SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR));
bg->AddChild(view);
// button
b.Set(0.0, 0.0, 80.0, 13.0);
b.OffsetTo(5.0, 5.0);
BButton* control = new BButton(b, "button", "Button", NULL);
view->AddChild(control);
BButton* button = new BButton(b, "button", "Button", NULL);
view->AddChild(button);
//button->MoveTo(5.0, 5.0);
b.bottom = b.top + 20.0;
b.OffsetTo(5.0, view->Bounds().bottom - (b.Height() + 5.0));
// text control
b.left = button->Frame().left;
b.top = button->Frame().bottom + 5.0;
b.bottom = b.top + 35.0;
b.right += 50.0;
// BTextControl* textControl = new BTextControl(b, "text control", "Text", "<enter text here>", NULL);
BRect textRect(b);
textRect.OffsetTo(0.0, 0.0);
BTextView* textControl = new BTextView(b, "text view", textRect,
B_FOLLOW_ALL, B_WILL_DRAW);
view->AddChild(textControl);
textControl->SetText("This is a BTextView.");
textControl->MakeFocus(true);
// check box
// b.OffsetTo(5.0, view->Bounds().bottom - (b.Height() + 5.0));
BCheckBox* checkBox = new BCheckBox(b, "check box", "CheckBox", NULL);
view->AddChild(checkBox);
checkBox->MoveTo(5.0, view->Bounds().bottom - (b.Height() + 10.0));
window->MoveTo(frame.left, frame.top);
// window->MoveTo(frame.left, frame.top);
window->Show();
}