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

Method DrawWidget

src/network/network_gui.cpp:523–556  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

521 }
522
523 void DrawWidget(const Rect &r, WidgetID widget) const override
524 {
525 switch (widget) {
526 case WID_NG_MATRIX: {
527 uint16_t y = r.top;
528
529 auto [first, last] = this->vscroll->GetVisibleRangeIterators(this->servers);
530 for (auto it = first; it != last; ++it) {
531 const NetworkGame *ngl = *it;
532 this->DrawServerLine(ngl, y, ngl == this->server);
533 y += this->resize.step_height;
534 }
535 break;
536 }
537
538 case WID_NG_LASTJOINED:
539 /* Draw the last joined server, if any */
540 if (this->last_joined != nullptr) this->DrawServerLine(this->last_joined, r.top, this->last_joined == this->server);
541 break;
542
543 case WID_NG_DETAILS:
544 this->DrawDetails(r);
545 break;
546
547 case WID_NG_NAME:
548 case WID_NG_CLIENTS:
549 case WID_NG_MAPSIZE:
550 case WID_NG_DATE:
551 case WID_NG_YEARS:
552 case WID_NG_INFO:
553 if (widget - WID_NG_NAME == this->servers.SortType()) this->DrawSortButtonState(widget, this->servers.IsDescSortOrder() ? SBS_DOWN : SBS_UP);
554 break;
555 }
556 }
557
558
559 void OnPaint() override

Callers

nothing calls this directly

Calls 6

DrawServerLineMethod · 0.95
DrawDetailsMethod · 0.95
SortTypeMethod · 0.80
DrawSortButtonStateMethod · 0.80
IsDescSortOrderMethod · 0.80

Tested by

no test coverage detected