diff --git a/src/tests/servers/app/windows/main.cpp b/src/tests/servers/app/windows/main.cpp index 78a4683963..b5b3826294 100644 --- a/src/tests/servers/app/windows/main.cpp +++ b/src/tests/servers/app/windows/main.cpp @@ -6,6 +6,31 @@ #include "View.h" #include "Window.h" +class HelloView : public BView { + public: + HelloView(BRect frame, const char* name, + uint32 resizeFlags, uint32 flags) + : BView(frame, name, resizeFlags, flags) + { } + + virtual void Draw(BRect updateRect) + { + SetHighColor(ui_color(B_PANEL_BACKGROUND_COLOR)); + FillRect(updateRect); + BRect r(Bounds()); + + const char* message = "Hello World!"; + float width = StringWidth(message); + BPoint p(r.left + r.Width() / 2.0 - width / 2.0, + r.top + r.Height() / 2.0); + + SetHighColor(255, 0, 0, 128); + DrawString(message, p); + } +}; + + +// show_window void show_window(BRect frame, const char* name) { @@ -13,7 +38,8 @@ show_window(BRect frame, const char* name) B_TITLED_WINDOW, B_ASYNCHRONOUS_CONTROLS | B_QUIT_ON_WINDOW_CLOSE); - BView* view = new BView(window->Bounds(), "test", B_FOLLOW_ALL, B_WILL_DRAW); + BView* view = new HelloView(window->Bounds(), "test", B_FOLLOW_ALL, + B_WILL_DRAW | B_FULL_UPDATE_ON_RESIZE); window->AddChild(view);