diff --git a/TODO b/TODO index d680912..f8208c9 100644 --- a/TODO +++ b/TODO @@ -1,4 +1,4 @@ -* Continue rebasing from 8090b4fbd0cb73c092307a5b551929275b8aef5a +* Continue rebasing from 9263b256a3f3fc7fd5388264d84fd623eb7a0097 * Add a focus listener interface. * Make focus apply synchronously. * Graphics and input objects for DirectX. diff --git a/src/widgets/listbox.cpp b/src/widgets/listbox.cpp index 5816677..672127b 100644 --- a/src/widgets/listbox.cpp +++ b/src/widgets/listbox.cpp @@ -169,6 +169,20 @@ namespace gcn void ListBox::logic() { adjustSize(); + + Rectangle scroll; + + if (mSelected < 0) + { + scroll.y = 0; + } + else + { + scroll.y = getRowHeight() * mSelected; + } + + scroll.height = getRowHeight(); + showPart(scroll); } int ListBox::getSelected() const @@ -196,20 +210,6 @@ namespace gcn { mSelected = selected; } - - Rectangle scroll; - - if (mSelected < 0) - { - scroll.y = 0; - } - else - { - scroll.y = getRowHeight() * mSelected; - } - - scroll.height = getRowHeight(); - showPart(scroll); } distributeValueChangedEvent(); diff --git a/src/widgets/scrollarea.cpp b/src/widgets/scrollarea.cpp index d9db6cf..7b40c90 100644 --- a/src/widgets/scrollarea.cpp +++ b/src/widgets/scrollarea.cpp @@ -986,10 +986,15 @@ namespace gcn Rectangle ScrollArea::getChildrenArea() { - return Rectangle(0, - 0, - getWidth() - (mVBarVisible ? mScrollbarWidth : 0), - getHeight() - (mHBarVisible ? mScrollbarWidth : 0)); + Rectangle area = Rectangle(0, + 0, + getWidth() - (mVBarVisible ? mScrollbarWidth : 0), + getHeight() - (mHBarVisible ? mScrollbarWidth : 0)); + if (area.width < 0 || area.height < 0) + { + return Rectangle(); + } + return area; } Rectangle ScrollArea::getVerticalBarDimension()