Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Apply Guichan's changes from 8090b4fbd0cb73c092307a5b551929275b8aef5a… #62

Merged
merged 1 commit into from
Aug 31, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion TODO
Original file line number Diff line number Diff line change
@@ -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.
Expand Down
28 changes: 14 additions & 14 deletions src/widgets/listbox.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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();
Expand Down
13 changes: 9 additions & 4 deletions src/widgets/scrollarea.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down