| 792 | } |
| 793 | |
| 794 | void OnClick([[maybe_unused]] Point pt, WidgetID widget, [[maybe_unused]] int click_count) override |
| 795 | { |
| 796 | switch (widget) { |
| 797 | case WID_SB_SEL_PAGE: { |
| 798 | DropDownList list = this->BuildDropDownList(); |
| 799 | if (!list.empty()) { |
| 800 | /* Get the index of selected page. */ |
| 801 | int selected = 0; |
| 802 | for (size_t i = 0; i < this->story_pages.size(); i++) { |
| 803 | const StoryPage *p = this->story_pages[i]; |
| 804 | if (p->index == this->selected_page_id) break; |
| 805 | selected++; |
| 806 | } |
| 807 | |
| 808 | ShowDropDownList(this, std::move(list), selected, widget); |
| 809 | } |
| 810 | break; |
| 811 | } |
| 812 | |
| 813 | case WID_SB_PREV_PAGE: |
| 814 | this->SelectPrevPage(); |
| 815 | break; |
| 816 | |
| 817 | case WID_SB_NEXT_PAGE: |
| 818 | this->SelectNextPage(); |
| 819 | break; |
| 820 | |
| 821 | case WID_SB_PAGE_PANEL: { |
| 822 | int clicked_y = this->vscroll->GetScrolledRowFromWidget(pt.y, this, WID_SB_PAGE_PANEL, WidgetDimensions::scaled.frametext.top); |
| 823 | this->EnsureStoryPageElementLayout(); |
| 824 | |
| 825 | for (const LayoutCacheElement &ce : this->layout_cache) { |
| 826 | if (clicked_y >= ce.bounds.top && clicked_y < ce.bounds.bottom && pt.x >= ce.bounds.left && pt.x < ce.bounds.right) { |
| 827 | this->OnPageElementClick(*ce.pe); |
| 828 | return; |
| 829 | } |
| 830 | } |
| 831 | } |
| 832 | } |
| 833 | } |
| 834 | |
| 835 | void OnDropdownSelect(WidgetID widget, int index, int) override |
| 836 | { |
nothing calls this directly
no test coverage detected