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

Method OnClick

src/textfile_gui.cpp:504–535  ·  view source on GitHub ↗

virtual */

Source from the content-addressed store, hash-verified

502}
503
504/* virtual */ void TextfileWindow::OnClick([[maybe_unused]] Point pt, WidgetID widget, [[maybe_unused]] int click_count)
505{
506 switch (widget) {
507 case WID_TF_WRAPTEXT:
508 this->ToggleWidgetLoweredState(WID_TF_WRAPTEXT);
509 this->InvalidateData();
510 break;
511
512 case WID_TF_JUMPLIST: {
513 DropDownList list;
514 for (size_t line : this->jumplist) {
515 list.push_back(MakeDropDownListStringItem(GetString(STR_TEXTFILE_JUMPLIST_ITEM, this->lines[line].text), (int)line));
516 }
517 ShowDropDownList(this, std::move(list), -1, widget);
518 break;
519 }
520
521 case WID_TF_NAVBACK:
522 this->NavigateHistory(-1);
523 break;
524
525 case WID_TF_NAVFORWARD:
526 this->NavigateHistory(+1);
527 break;
528
529 case WID_TF_BACKGROUND: {
530 const Hyperlink *link = this->GetHyperlink(pt);
531 if (link != nullptr) this->OnHyperlinkClick(*link);
532 break;
533 }
534 }
535}
536
537/* virtual */ bool TextfileWindow::OnTooltip([[maybe_unused]] Point pt, WidgetID widget, TooltipCloseCondition close_cond)
538{

Callers

nothing calls this directly

Calls 9

NavigateHistoryMethod · 0.95
GetHyperlinkMethod · 0.95
OnHyperlinkClickMethod · 0.95
ShowDropDownListFunction · 0.85
push_backMethod · 0.80
GetStringFunction · 0.70
InvalidateDataMethod · 0.45

Tested by

no test coverage detected