1 /* 2 * Copyright 2007, Ingo Weinhold <bonefish@cs.tu-berlin.de>. 3 * All rights reserved. Distributed under the terms of the MIT License. 4 */ 5 6 #include "TestView.h" 7 8 9 TestView::TestView(BSize minSize, BSize maxSize, BSize preferredSize) 10 : BView("test view", B_WILL_DRAW | B_FULL_UPDATE_ON_RESIZE), 11 fMinSize(minSize), 12 fMaxSize(maxSize), 13 fPreferredSize(preferredSize) 14 { 15 SetViewColor((rgb_color){150, 220, 150, 255}); 16 SetHighColor((rgb_color){0, 80, 0, 255}); 17 } 18 19 20 BSize 21 TestView::MinSize() 22 { 23 return fMinSize; 24 } 25 26 27 BSize 28 TestView::MaxSize() 29 { 30 return fMaxSize; 31 } 32 33 34 BSize 35 TestView::PreferredSize() 36 { 37 return fPreferredSize; 38 } 39 40 41 void 42 TestView::Draw(BRect updateRect) 43 { 44 BRect bounds(Bounds()); 45 StrokeRect(bounds); 46 StrokeLine(bounds.LeftTop(), bounds.RightBottom()); 47 StrokeLine(bounds.LeftBottom(), bounds.RightTop()); 48 } 49