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:
@@ -13,6 +13,7 @@ SimpleTest WidgetLayoutTest :
|
|||||||
RadioButton.cpp
|
RadioButton.cpp
|
||||||
StringView.cpp
|
StringView.cpp
|
||||||
Test.cpp
|
Test.cpp
|
||||||
|
TestView.cpp
|
||||||
TwoDimensionalSliderView.cpp
|
TwoDimensionalSliderView.cpp
|
||||||
View.cpp
|
View.cpp
|
||||||
ViewContainer.cpp
|
ViewContainer.cpp
|
||||||
|
|||||||
@@ -0,0 +1,48 @@
|
|||||||
|
/*
|
||||||
|
* Copyright 2007, Ingo Weinhold <[email protected]>.
|
||||||
|
* 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());
|
||||||
|
}
|
||||||
@@ -0,0 +1,30 @@
|
|||||||
|
/*
|
||||||
|
* Copyright 2007, Ingo Weinhold <[email protected]>.
|
||||||
|
* 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
|
||||||
Reference in New Issue
Block a user