(svn r18580) -Codechange: Use widget information only for setting scrollbar capacity.

This commit is contained in:
alberth
2009-12-20 20:08:39 +00:00
parent 05c30d294e
commit f20e477a02
21 changed files with 53 additions and 39 deletions

View File

@@ -78,6 +78,23 @@ WindowDesc::~WindowDesc()
{
}
/**
* Set capacity of visible elements from the size and resize properties of a widget.
* @param w Window.
* @param widget Widget with size and resize properties.
* @param padding Padding to subtract from the size.
* @note Updates the position if needed.
*/
void Scrollbar::SetCapacityFromWidget(Window *w, int widget, int padding)
{
NWidgetBase *nwid = w->GetWidget<NWidgetBase>(widget);
if (this->is_vertical) {
this->SetCapacity(((int)nwid->current_y - padding) / (int)nwid->resize_y);
} else {
this->SetCapacity(((int)nwid->current_x - padding) / (int)nwid->resize_x);
}
}
/**
* Set the window that has the focus
* @param w The window to set the focus on