MCPcopy Create free account
hub / github.com/Siv3D/OpenSiv3D / TextAreaDraw

Function TextAreaDraw

Siv3D/src/Siv3D/SimpleGUI/SivSimpleGUI.cpp:2170–2313  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2168 namespace detail
2169 {
2170 static void TextAreaDraw(const TextAreaEditState& text, const Font& font, const int32 fontHeight, const RectF& region,
2171 const RectF& textRenderRegion, const double textRenderRegionBottomY,
2172 const double textCursorLineX, const double textCursorLineY0, const double textCursorLineY1,
2173 const String& editingText, const Vec2& editingTextPos, const double maxScroll, const bool enabled)
2174 {
2175 // テキストエリアの描画
2176 if (enabled)
2177 {
2178 if (text.active)
2179 {
2180 region
2181 .draw()
2182 .drawFrame(0.0, 1.5, ColorF{ 0.35, 0.7, 1.0, 0.75 })
2183 .drawFrame(2.5, 0.0, ColorF{ 0.35, 0.7, 1.0 });
2184 }
2185 else
2186 {
2187 region
2188 .draw()
2189 .drawFrame(2.0, 0.0, ColorF{ 0.5 });
2190 }
2191 }
2192 else
2193 {
2194 region
2195 .draw(ColorF{ 0.9 })
2196 .drawFrame(2.0, 0.0, ColorF{ 0.67 });
2197 }
2198
2199 // テキスト入力カーソルの描画
2200 if (text.active && enabled)
2201 {
2202 const bool showCursor = (text.cursorStopwatch.ms() % 1200 < 600)
2203 || (text.leftPressStopwatch.isRunning() && (text.leftPressStopwatch < SecondsF{ 0.5 }))
2204 || (text.rightPressStopwatch.isRunning() && (text.rightPressStopwatch < SecondsF{ 0.5 }))
2205 || (text.upPressStopwatch.isRunning() && (text.upPressStopwatch < SecondsF{ 0.5 }))
2206 || (text.downPressStopwatch.isRunning() && (text.downPressStopwatch < SecondsF{ 0.5 }));
2207
2208 if (showCursor)
2209 {
2210 if ((textCursorLineY0 < textRenderRegionBottomY)
2211 && (textRenderRegion.y < textCursorLineY1))
2212 {
2213 const double x = (Math::Ceil(textCursorLineX) - 0.5);
2214 Line{ x, textCursorLineY0, x, textCursorLineY1 }.stretched(-2).draw(1, Palette::Black);
2215 }
2216 }
2217 }
2218
2219 {
2220 const ColorF textColor = GetTextColor(enabled);
2221 const auto& pixelShader = Font::GetPixelShader(font.method());
2222
2223 // テキストの描画
2224 {
2225 const ScopedCustomShader2D shader{ pixelShader };
2226
2227 for (const auto& clipInfo : text.clipInfos)

Callers 1

TextAreaAtFunction · 0.85

Calls 15

CeilFunction · 0.85
GetTextColorFunction · 0.85
GetCandicateCursorIndexFunction · 0.85
methodMethod · 0.80
GetCursorIndexFunction · 0.50
MaxFunction · 0.50
drawFrameMethod · 0.45
drawMethod · 0.45
msMethod · 0.45
isRunningMethod · 0.45
stretchedMethod · 0.45
drawClippedMethod · 0.45

Tested by

no test coverage detected