0x00446314
| 635 | |
| 636 | // 0x00446314 |
| 637 | static void drawScroll(Ui::Window& window, Gfx::DrawingContext& drawingCtx, [[maybe_unused]] const uint32_t scrollIndex) |
| 638 | { |
| 639 | const auto& rt = drawingCtx.currentRenderTarget(); |
| 640 | auto tr = Gfx::TextRenderer(drawingCtx); |
| 641 | |
| 642 | // Background |
| 643 | drawingCtx.clearSingle(Colours::getShade(window.getColour(WindowColour::secondary).c(), 4)); |
| 644 | |
| 645 | // Directories / files |
| 646 | auto i = 0; |
| 647 | auto y = 0; |
| 648 | auto lineHeight = window.rowHeight; |
| 649 | for (const auto& entry : _files) |
| 650 | { |
| 651 | if (y + lineHeight < rt.y) |
| 652 | { |
| 653 | y += lineHeight; |
| 654 | i++; |
| 655 | continue; |
| 656 | } |
| 657 | else if (y > rt.y + rt.height) |
| 658 | { |
| 659 | break; |
| 660 | } |
| 661 | |
| 662 | // Draw the row highlight |
| 663 | auto stringId = StringIds::black_stringid; |
| 664 | if (i == window.var_85A) |
| 665 | { |
| 666 | drawingCtx.drawRect(0, y, window.width, lineHeight, enumValue(ExtColour::unk30), Gfx::RectFlags::transparent); |
| 667 | stringId = StringIds::wcolour2_stringid; |
| 668 | } |
| 669 | |
| 670 | // Draw the folder icon (TODO: draw a drive for rootPath) |
| 671 | auto x = 1; |
| 672 | if (isRootPath(entry) || fs::is_directory(entry)) |
| 673 | { |
| 674 | drawingCtx.drawImage(x, y, ImageIds::icon_folder); |
| 675 | x += 14; |
| 676 | } |
| 677 | |
| 678 | // Copy name to our work buffer (if drive letter use the full path) |
| 679 | auto nameBuffer = isRootPath(entry) ? entry.u8string() : entry.stem().u8string(); |
| 680 | nameBuffer = Localisation::convertUnicodeToLoco(nameBuffer); |
| 681 | |
| 682 | // Draw the name |
| 683 | auto args = getStringPtrFormatArgs(nameBuffer.c_str()); |
| 684 | auto point = Point(x, y); |
| 685 | tr.drawStringLeft(point, Colour::black, stringId, args); |
| 686 | |
| 687 | y += lineHeight; |
| 688 | i++; |
| 689 | } |
| 690 | } |
| 691 | |
| 692 | // 0x0044685C |
| 693 | static bool keyUp(Window& w, uint32_t charCode, uint32_t keyCode) |
nothing calls this directly
no test coverage detected