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 #include <ControlLook.h> 10 11 12 GeneralContentScrollView::GeneralContentScrollView( 13 const char* name, BView* target) 14 : 15 BScrollView(name, target, 0, false, true, B_NO_BORDER) 16 { 17 } 18 19 20 void 21 GeneralContentScrollView::DoLayout() 22 { 23 float scrollBarWidth = be_control_look->GetScrollBarWidth(B_VERTICAL); 24 BRect innerFrame = Bounds(); 25 innerFrame.right -= scrollBarWidth + 1; 26 27 BView* target = Target(); 28 if (target != NULL) { 29 Target()->MoveTo(innerFrame.left, innerFrame.top); 30 Target()->ResizeTo(innerFrame.Width(), innerFrame.Height()); 31 } 32 33 BScrollBar* scrollBar = ScrollBar(B_VERTICAL); 34 35 if (scrollBar != NULL) { 36 BRect rect = innerFrame; 37 rect.left = rect.right + 1; 38 rect.right = rect.left + scrollBarWidth; 39 40 scrollBar->MoveTo(rect.left, rect.top); 41 scrollBar->ResizeTo(rect.Width(), rect.Height()); 42 } 43 } 44