MCPcopy Create free account
hub / github.com/crosspoint-reader/crosspoint-reader / drawTextField

Method drawTextField

src/components/themes/BaseTheme.cpp:895–909  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

893}
894
895void BaseTheme::drawTextField(const GfxRenderer& renderer, Rect rect, const int textWidth, bool cursorMode,
896 int contentStartX, int contentWidth) const {
897 const auto& metrics = UITheme::getInstance().getMetrics();
898 const int lineHeight = renderer.getLineHeight(UI_12_FONT_ID);
899 const int lineY = rect.y + rect.height + lineHeight + metrics.verticalSpacing;
900 const int thickness = cursorMode ? metrics.textFieldCursorThickness : metrics.textFieldNormalThickness;
901 if (contentWidth > 0) {
902 renderer.drawLine(rect.x + contentStartX, lineY,
903 rect.x + contentStartX + contentWidth + metrics.textFieldLineEndOffset, lineY, thickness, true);
904 } else {
905 const int lineW = textWidth + metrics.textFieldHorizontalPadding * 2;
906 const int lineStart = rect.x + (rect.width - lineW) / 2;
907 renderer.drawLine(lineStart, lineY, lineStart + lineW + metrics.textFieldLineEndOffset, lineY, thickness, true);
908 }
909}
910
911void BaseTheme::drawKeyboardKey(const GfxRenderer& renderer, Rect rect, const char* label, const bool isSelected,
912 const char* secondaryLabel, const KeyboardKeyType keyType,

Callers 1

renderMethod · 0.45

Calls 2

getLineHeightMethod · 0.80
drawLineMethod · 0.80

Tested by

no test coverage detected