* Copyright 2006, Haiku.
* Distributed under the terms of the MIT License.
*
* Authors:
* Ingo Weinhold <bonefish@cs.tu-berlin.de>
*/
#include "ScrollableView.h"
#include <View.h>
ScrollableView::ScrollableView()
: Scrollable()
{
}
ScrollableView::~ScrollableView()
{
}
void
ScrollableView::ScrollOffsetChanged(BPoint oldOffset, BPoint newOffset)
{
if (BView* view = dynamic_cast<BView*>(this)) {
BRect bounds(view->Bounds());
view->CopyBits(bounds.OffsetByCopy(newOffset - oldOffset), bounds);
for (int32 i = 0; BView* child = view->ChildAt(i); i++)
child->MoveTo(child->Frame().LeftTop() + oldOffset - newOffset);
}
}