| 987 | } |
| 988 | |
| 989 | static void drawSearchBox(Window& self, Gfx::DrawingContext& drawingCtx) |
| 990 | { |
| 991 | char* textBuffer = (char*)StringManager::getString(StringIds::buffer_2039); |
| 992 | strncpy(textBuffer, inputSession.buffer.c_str(), 256); |
| 993 | |
| 994 | auto& widget = widgets[widx::textInput]; |
| 995 | const auto& rt = drawingCtx.currentRenderTarget(); |
| 996 | auto clipped = Gfx::clipRenderTarget(rt, Ui::Rect(widget.left + 1 + self.x, widget.top + 1 + self.y, widget.width() - 2, widget.height() - 2)); |
| 997 | if (!clipped) |
| 998 | { |
| 999 | return; |
| 1000 | } |
| 1001 | |
| 1002 | drawingCtx.pushRenderTarget(*clipped); |
| 1003 | |
| 1004 | FormatArguments args{}; |
| 1005 | args.push(StringIds::buffer_2039); |
| 1006 | |
| 1007 | auto tr = Gfx::TextRenderer(drawingCtx); |
| 1008 | |
| 1009 | // Draw search box input buffer |
| 1010 | Ui::Point position = { inputSession.xOffset, 1 }; |
| 1011 | tr.drawStringLeft(position, Colour::black, StringIds::black_stringid, args); |
| 1012 | |
| 1013 | // Draw search box cursor, blinking |
| 1014 | if (Input::isFocused(self.type, self.number, widx::textInput) && (inputSession.cursorFrame % 32) < 16) |
| 1015 | { |
| 1016 | // We draw the string again to figure out where the cursor should go; position.x will be adjusted |
| 1017 | textBuffer[inputSession.cursorPosition] = '\0'; |
| 1018 | position = { inputSession.xOffset, 1 }; |
| 1019 | position = tr.drawStringLeft(position, Colour::black, StringIds::black_stringid, args); |
| 1020 | drawingCtx.fillRect(position.x, position.y, position.x, position.y + 9, Colours::getShade(self.getColour(WindowColour::secondary).c(), 9), Gfx::RectFlags::none); |
| 1021 | } |
| 1022 | |
| 1023 | drawingCtx.popRenderTarget(); |
| 1024 | } |
| 1025 | |
| 1026 | // 0x004733F5 |
| 1027 | static void draw(Window& self, Gfx::DrawingContext& drawingCtx) |
no test coverage detected