From f9730d5666e42c319a6c6e695db4caab90859d1d Mon Sep 17 00:00:00 2001 From: rubidium Date: Fri, 10 Dec 2010 17:33:50 +0000 Subject: [PATCH] (svn r21447) -Add: accessor function to get the direction of a scrollbar --- src/widget.cpp | 2 +- src/widget_type.h | 9 +++++++++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/src/widget.cpp b/src/widget.cpp index 4831284fba..59aff4fcc5 100644 --- a/src/widget.cpp +++ b/src/widget.cpp @@ -1624,7 +1624,7 @@ int Scrollbar::GetScrolledRowFromWidget(int clickpos, const Window * const w, in void Scrollbar::SetCapacityFromWidget(Window *w, int widget, int padding) { NWidgetBase *nwid = w->GetWidget(widget); - if (this->is_vertical) { + if (this->IsVertical()) { this->SetCapacity(((int)nwid->current_y - padding) / (int)nwid->resize_y); } else { this->SetCapacity(((int)nwid->current_x - padding) / (int)nwid->resize_x); diff --git a/src/widget_type.h b/src/widget_type.h index 96d40d95c9..54183b0d0e 100644 --- a/src/widget_type.h +++ b/src/widget_type.h @@ -559,6 +559,15 @@ public: 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 * @param num the number of elements in the list