Added a small visual test for the BScrollView class: it will create a window

with all possible different scrollview combinations (horiz/vert/border/highlight).
The Jamfile will build two versions, ScrollViewTest and ScrollViewTest_r5;
the former compiles our ScrollView.cpp in, while the latter just uses the
one in libbe.so.


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@6647 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Axel Dörfler
2004-02-19 06:33:57 +00:00
parent 8b35053e1a
commit 8afcf72a6a
2 changed files with 121 additions and 0 deletions
+15
View File
@@ -44,5 +44,20 @@ CommonTestLib libinterfacetest.so
: app support
;
SimpleTest ScrollViewTest_r5 :
ScrollViewTest.cpp
: be
;
SimpleTest ScrollViewTest :
ScrollViewTest.cpp
ScrollView.cpp
: be
;
SEARCH on [ FGristFiles
ScrollView.cpp
] = [ FDirName $(OBOS_TOP) src kits interface ] ;
SubInclude OBOS_TOP src tests kits interface bprintjob ;
SubInclude OBOS_TOP src tests kits interface picture ;
+106
View File
@@ -0,0 +1,106 @@
/*
** Copyright 2004, Axel Dörfler, [email protected]. All rights reserved.
** Distributed under the terms of the OpenBeOS License.
*/
#include <ScrollView.h>
#include <Application.h>
#include <Window.h>
#include <Box.h>
class Window : public BWindow {
public:
Window();
virtual ~Window();
virtual bool QuitRequested();
};
Window::Window()
: BWindow(BRect(100, 100, 580, 580), "Scroll-Test",
B_TITLED_WINDOW, B_ASYNCHRONOUS_CONTROLS | B_NOT_RESIZABLE)
{
const bool horiz[] = {false, true, false, true};
const bool vert[] = {false, false, true, true};
const border_style border[] = {B_NO_BORDER, B_PLAIN_BORDER, B_FANCY_BORDER, B_FANCY_BORDER};
BRect rect(1, 1, 119, 119);
BRect frame = rect.InsetByCopy(20, 20);
for (int32 i = 0; i < 16; i++) {
if (i > 0 && (i % 4) == 0)
rect.OffsetBy(-480, 120);
BBox *box = new BBox(rect);
AddChild(box);
BView *view = new BView(frame, "main view", B_FOLLOW_ALL, B_WILL_DRAW);
BView *inner = new BView(frame.OffsetToCopy(B_ORIGIN).InsetBySelf(2, 2),
"inner", B_FOLLOW_ALL, B_WILL_DRAW);
inner->SetViewColor(200, 42, 42);
view->AddChild(inner);
BScrollView *scroller = new BScrollView("scroller", view, B_FOLLOW_ALL,
0, horiz[i % 4], vert[i % 4], border[i / 4]);
if (i >= 12)
scroller->SetBorderHighlighted(true);
box->AddChild(scroller);
rect.OffsetBy(120, 0);
}
}
Window::~Window()
{
}
bool
Window::QuitRequested()
{
be_app->PostMessage(B_QUIT_REQUESTED);
return true;
}
// #pragma mark -
class Application : public BApplication {
public:
Application();
virtual void ReadyToRun(void);
};
Application::Application()
: BApplication("application/x-vnd.obos-test")
{
}
void
Application::ReadyToRun(void)
{
Window *window = new Window();
window->Show();
}
// #pragma mark -
int
main(int argc, char **argv)
{
Application app;
app.Run();
return 0;
}