1 /* 2 * Copyright 2013-2014, Stephan Aßmus <superstippi@gmx.de>. 3 * Copyright 2018-2022, Andrew Lindesay <apl@lindesay.co.nz>. 4 * All rights reserved. Distributed under the terms of the MIT License. 5 */ 6 7 #include "GeneralContentScrollView.h" 8 9 10 GeneralContentScrollView::GeneralContentScrollView( 11 const char* name, BView* target) 12 : 13 BScrollView(name, target, 0, false, true, B_NO_BORDER) 14 { 15 } 16 17 18 void 19 GeneralContentScrollView::DoLayout() 20 { 21 BRect innerFrame = Bounds(); 22 innerFrame.right -= B_V_SCROLL_BAR_WIDTH + 1; 23 24 BView* target = Target(); 25 if (target != NULL) { 26 Target()->MoveTo(innerFrame.left, innerFrame.top); 27 Target()->ResizeTo(innerFrame.Width(), innerFrame.Height()); 28 } 29 30 BScrollBar* scrollBar = ScrollBar(B_VERTICAL); 31 32 if (scrollBar != NULL) { 33 BRect rect = innerFrame; 34 rect.left = rect.right + 1; 35 rect.right = rect.left + B_V_SCROLL_BAR_WIDTH; 36 37 scrollBar->MoveTo(rect.left, rect.top); 38 scrollBar->ResizeTo(rect.Width(), rect.Height()); 39 } 40 } 41