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

Method OnClick

src/framerate_gui.cpp:656–679  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

654 }
655
656 void OnClick([[maybe_unused]] Point pt, WidgetID widget, [[maybe_unused]] int click_count) override
657 {
658 switch (widget) {
659 case WID_FRW_TIMES_NAMES:
660 case WID_FRW_TIMES_CURRENT:
661 case WID_FRW_TIMES_AVERAGE: {
662 /* Open time graph windows when clicking detail measurement lines */
663 const Scrollbar *sb = this->GetScrollbar(WID_FRW_SCROLLBAR);
664 int32_t line = sb->GetScrolledRowFromWidget(pt.y, this, widget, WidgetDimensions::scaled.vsep_normal + GetCharacterHeight(FS_NORMAL));
665 if (line != INT32_MAX) {
666 line++;
667 /* Find the visible line that was clicked */
668 for (PerformanceElement e : DISPLAY_ORDER_PFE) {
669 if (_pf_data[e].num_valid > 0) line--;
670 if (line == 0) {
671 ShowFrametimeGraphWindow(e);
672 break;
673 }
674 }
675 }
676 break;
677 }
678 }
679 }
680
681 void OnResize() override
682 {

Callers

nothing calls this directly

Calls 4

GetCharacterHeightFunction · 0.85
ShowFrametimeGraphWindowFunction · 0.85
GetScrollbarMethod · 0.80

Tested by

no test coverage detected