MCPcopy Create free account
hub / github.com/OpenTTD/OpenTTD / GetVisibleRangeIterators

Method GetVisibleRangeIterators

src/widget_type.h:875–881  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

873 */
874 template <typename Tcontainer>
875 auto GetVisibleRangeIterators(Tcontainer &container) const
876 {
877 assert(static_cast<size_t>(this->GetCount()) == container.size()); // Scrollbar and container size must match.
878 auto first = std::next(std::begin(container), this->GetPosition());
879 auto last = std::next(first, std::min<size_t>(this->GetCapacity(), this->GetCount() - this->GetPosition()));
880 return std::make_pair(first, last);
881 }
882
883 /**
884 * Return an iterator pointing to the element of a scrolled widget that a user clicked in.

Callers 15

DrawWidgetMethod · 0.80
DrawWidgetMethod · 0.80
DrawWidgetMethod · 0.80
DrawWidgetMethod · 0.80
DrawWidgetMethod · 0.80
DrawWidgetMethod · 0.80
GetIndustryListWidthMethod · 0.80
DrawWidgetMethod · 0.80
DrawWidgetMethod · 0.80
DrawWidgetMethod · 0.80
DrawWidgetMethod · 0.80
DrawWidgetMethod · 0.80

Calls 5

GetCountMethod · 0.95
GetPositionMethod · 0.95
GetCapacityMethod · 0.95
beginFunction · 0.50
sizeMethod · 0.45

Tested by

no test coverage detected