| 558 | #endif |
| 559 | |
| 560 | void UIMenu::_render() |
| 561 | { |
| 562 | #ifdef USE_TILE_LOCAL |
| 563 | if (m_buffers_dirty) |
| 564 | { |
| 565 | pack_buffers(); |
| 566 | m_buffers_dirty = false; |
| 567 | } |
| 568 | |
| 569 | GLW_3VF t = {(float)m_region.x, (float)m_region.y, 0}, s = {1, 1, 1}; |
| 570 | glmanager->set_transform(t, s); |
| 571 | |
| 572 | m_shape_buf.draw(); |
| 573 | m_div_line_buf.draw(); |
| 574 | for (int i = 0; i < TEX_MAX; i++) |
| 575 | m_tile_buf[i].draw(); |
| 576 | m_text_buf.draw(); |
| 577 | m_line_buf.draw(); |
| 578 | |
| 579 | glmanager->reset_transform(); |
| 580 | #else |
| 581 | |
| 582 | int vis_min, vis_max; |
| 583 | is_visible_item_range(&vis_min, &vis_max); |
| 584 | const int scroll = m_menu->m_ui.scroller->get_scroll(); |
| 585 | |
| 586 | for (int i = vis_min; i < vis_max; i++) |
| 587 | { |
| 588 | const MenuEntry *me = m_menu->items[i]; |
| 589 | int y = item_info[i].y - item_info[vis_min].y + 1; |
| 590 | int x = item_info[i].x + item_info[i].column * m_nat_column_width; |
| 591 | cgotoxy(m_region.x + x + 1, m_region.y + scroll + y); |
| 592 | const int col = m_menu->item_colour(me); |
| 593 | textcolour(col); |
| 594 | |
| 595 | // TODO: is this highlighting good enough for accessibility purposes? |
| 596 | if (m_hover_idx == i) |
| 597 | textbackground(default_hover_colour()); |
| 598 | // XX these will format the hover differently. |
| 599 | // TODO: multiline entries |
| 600 | if (m_menu->get_flags() & MF_ALLOW_FORMATTING) |
| 601 | { |
| 602 | formatted_string s = formatted_string::parse_string( |
| 603 | me->get_text(), col); |
| 604 | // headings always occupy full width |
| 605 | if (item_info[i].heading) |
| 606 | s.chop(m_region.width).display(); |
| 607 | else |
| 608 | s.chop(m_nat_column_width).display(); |
| 609 | } |
| 610 | else |
| 611 | { |
| 612 | string text = me->get_text(); |
| 613 | // headings always occupy full width |
| 614 | if (item_info[i].heading) |
| 615 | text = chop_string(text, m_region.width); |
| 616 | else |
| 617 | text = chop_string(text, m_nat_column_width); |
nothing calls this directly
no test coverage detected