* 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. */
| 2525 | * @note Updates the position if needed. |
| 2526 | */ |
| 2527 | void Scrollbar::SetCapacityFromWidget(Window *w, WidgetID widget, int padding) |
| 2528 | { |
| 2529 | NWidgetBase *nwid = w->GetWidget<NWidgetBase>(widget); |
| 2530 | if (this->IsVertical()) { |
| 2531 | this->SetCapacity(((int)nwid->current_y - padding) / (int)nwid->resize_y); |
| 2532 | } else { |
| 2533 | this->SetCapacity(((int)nwid->current_x - padding) / (int)nwid->resize_x); |
| 2534 | } |
| 2535 | } |
| 2536 | |
| 2537 | /** |
| 2538 | * Apply 'scroll' to a rect to be drawn in. |