New helper class TestView.

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@21360 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Ingo Weinhold 2007-06-08 23:46:25 +00:00
parent 691d242ba1
commit 4ac1c030e2
3 changed files with 79 additions and 0 deletions

View File

@ -13,6 +13,7 @@ SimpleTest WidgetLayoutTest :
RadioButton.cpp
StringView.cpp
Test.cpp
TestView.cpp
TwoDimensionalSliderView.cpp
View.cpp
ViewContainer.cpp

View File

@ -0,0 +1,48 @@
/*
* Copyright 2007, Ingo Weinhold <bonefish@cs.tu-berlin.de>.
* All rights reserved. Distributed under the terms of the MIT License.
*/
#include "TestView.h"
TestView::TestView(BSize minSize, BSize maxSize, BSize preferredSize)
: BView("test view", B_WILL_DRAW | B_FULL_UPDATE_ON_RESIZE),
fMinSize(minSize),
fMaxSize(maxSize),
fPreferredSize(preferredSize)
{
SetViewColor((rgb_color){150, 220, 150, 255});
SetHighColor((rgb_color){0, 80, 0, 255});
}
BSize
TestView::MinSize()
{
return fMinSize;
}
BSize
TestView::MaxSize()
{
return fMaxSize;
}
BSize
TestView::PreferredSize()
{
return fPreferredSize;
}
void
TestView::Draw(BRect updateRect)
{
BRect bounds(Bounds());
StrokeRect(bounds);
StrokeLine(bounds.LeftTop(), bounds.RightBottom());
StrokeLine(bounds.LeftBottom(), bounds.RightTop());
}

View File

@ -0,0 +1,30 @@
/*
* Copyright 2007, Ingo Weinhold <bonefish@cs.tu-berlin.de>.
* All rights reserved. Distributed under the terms of the MIT License.
*/
#ifndef WIDGET_LAYOUT_TEST_TEST_VIEW_H
#define WIDGET_LAYOUT_TEST_TEST_VIEW_H
#include <View.h>
class TestView : public BView {
public:
TestView(BSize minSize, BSize maxSize,
BSize preferredSize);
virtual BSize MinSize();
virtual BSize MaxSize();
virtual BSize PreferredSize();
virtual void Draw(BRect updateRect);
private:
BSize fMinSize;
BSize fMaxSize;
BSize fPreferredSize;
};
#endif // WIDGET_LAYOUT_TEST_TEST_VIEW_H