()
| 248 | |
| 249 | /// <inheritdoc /> |
| 250 | public override void Draw() |
| 251 | { |
| 252 | var style = Style.Current; |
| 253 | |
| 254 | // Background |
| 255 | Render2D.FillRectangle(new Rectangle(Float2.Zero, Size), Color.Lerp(style.BackgroundSelected, style.Background, 0.6f)); |
| 256 | Render2D.FillRectangle(new Rectangle(1.1f, 1.1f, Width - 2, Height - 2), style.Background); |
| 257 | |
| 258 | // Padding for text |
| 259 | var textRect = GetClientArea(); |
| 260 | float textX = HorizontalTextAlignment switch |
| 261 | { |
| 262 | TextAlignment.Near => 15, |
| 263 | TextAlignment.Center => 5, |
| 264 | TextAlignment.Far => -5, |
| 265 | _ => throw new ArgumentOutOfRangeException() |
| 266 | }; |
| 267 | textRect.X += textX; |
| 268 | textRect.Width -= 10; |
| 269 | |
| 270 | // Tooltip text |
| 271 | Render2D.DrawText( |
| 272 | style.FontMedium, |
| 273 | _currentText, |
| 274 | textRect, |
| 275 | style.Foreground, |
| 276 | HorizontalTextAlignment, |
| 277 | TextAlignment.Center, |
| 278 | TextWrapping.WrapWords |
| 279 | ); |
| 280 | } |
| 281 | |
| 282 | /// <inheritdoc /> |
| 283 | protected override void PerformLayoutBeforeChildren() |
no test coverage detected