mirror of
https://github.com/OpenTTD/OpenTTD.git
synced 2025-07-16 09:05:08 +01:00
(svn r21447) -Add: accessor function to get the direction of a scrollbar
This commit is contained in:
parent
91b043afbc
commit
0848d92af1
@ -1624,7 +1624,7 @@ int Scrollbar::GetScrolledRowFromWidget(int clickpos, const Window * const w, in
|
|||||||
void Scrollbar::SetCapacityFromWidget(Window *w, int widget, int padding)
|
void Scrollbar::SetCapacityFromWidget(Window *w, int widget, int padding)
|
||||||
{
|
{
|
||||||
NWidgetBase *nwid = w->GetWidget<NWidgetBase>(widget);
|
NWidgetBase *nwid = w->GetWidget<NWidgetBase>(widget);
|
||||||
if (this->is_vertical) {
|
if (this->IsVertical()) {
|
||||||
this->SetCapacity(((int)nwid->current_y - padding) / (int)nwid->resize_y);
|
this->SetCapacity(((int)nwid->current_y - padding) / (int)nwid->resize_y);
|
||||||
} else {
|
} else {
|
||||||
this->SetCapacity(((int)nwid->current_x - padding) / (int)nwid->resize_x);
|
this->SetCapacity(((int)nwid->current_x - padding) / (int)nwid->resize_x);
|
||||||
|
@ -559,6 +559,15 @@ public:
|
|||||||
return IsInsideBS(item, this->GetPosition(), this->GetCapacity());
|
return IsInsideBS(item, this->GetPosition(), this->GetCapacity());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Is the scrollbar vertical or not?
|
||||||
|
* @return True iff the scrollbar is vertical.
|
||||||
|
*/
|
||||||
|
FORCEINLINE bool IsVertical() const
|
||||||
|
{
|
||||||
|
return this->is_vertical;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets the number of elements in the list
|
* Sets the number of elements in the list
|
||||||
* @param num the number of elements in the list
|
* @param num the number of elements in the list
|
||||||
|
Loading…
Reference in New Issue
Block a user