* Sets the clicked element in the matrix. * @param clicked The clicked element. */
| 1955 | * @param clicked The clicked element. |
| 1956 | */ |
| 1957 | void NWidgetMatrix::SetClicked(int clicked) |
| 1958 | { |
| 1959 | this->clicked = clicked; |
| 1960 | if (this->clicked >= 0 && this->sb != nullptr && this->widgets_x != 0) { |
| 1961 | int vpos = (this->clicked / this->widgets_x) * this->widget_h; // Vertical position of the top. |
| 1962 | /* Need to scroll down -> Scroll to the bottom. |
| 1963 | * However, last entry has no 'this->pip_inter' underneath, and we must stay below this->sb->GetCount() */ |
| 1964 | if (this->sb->GetPosition() < vpos) vpos += this->widget_h - this->pip_inter - 1; |
| 1965 | this->sb->ScrollTowards(vpos); |
| 1966 | } |
| 1967 | } |
| 1968 | |
| 1969 | /** |
| 1970 | * Set the number of elements in this matrix. |
no test coverage detected