From a3b4fd6b87d9a1d0306d565d4ca06dd9718e7c3d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Stephan=20A=C3=9Fmus?= Date: Wed, 4 May 2005 00:38:14 +0000 Subject: [PATCH] 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 --- src/tests/servers/app/Jamfile | 1 + src/tests/servers/app/scrolling/main.cpp | 3 ++ src/tests/servers/app/textview/main.cpp | 6 ++-- src/tests/servers/app/windows/main.cpp | 42 +++++++++++++++++------- 4 files changed, 38 insertions(+), 14 deletions(-) diff --git a/src/tests/servers/app/Jamfile b/src/tests/servers/app/Jamfile index 62c8e80897..7ec1945e43 100644 --- a/src/tests/servers/app/Jamfile +++ b/src/tests/servers/app/Jamfile @@ -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 ; diff --git a/src/tests/servers/app/scrolling/main.cpp b/src/tests/servers/app/scrolling/main.cpp index ba6fbaae61..e34f6ceb6e 100644 --- a/src/tests/servers/app/scrolling/main.cpp +++ b/src/tests/servers/app/scrolling/main.cpp @@ -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; diff --git a/src/tests/servers/app/textview/main.cpp b/src/tests/servers/app/textview/main.cpp index 9a56bf395d..8443804de7 100644 --- a/src/tests/servers/app/textview/main.cpp +++ b/src/tests/servers/app/textview/main.cpp @@ -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(); } diff --git a/src/tests/servers/app/windows/main.cpp b/src/tests/servers/app/windows/main.cpp index 8d08a0e3b9..0565fbb2c8 100644 --- a/src/tests/servers/app/windows/main.cpp +++ b/src/tests/servers/app/windows/main.cpp @@ -10,6 +10,7 @@ #include #include #include +#include #include #include @@ -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", "", 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(); }