TextEdit control & a bunch of other stuff (#3436)

This commit is contained in:
Pieter-Jan Briers
2022-11-12 03:12:49 +01:00
committed by GitHub
parent db95c6284b
commit e34935c9e2
56 changed files with 4244 additions and 532 deletions
@@ -41,6 +41,8 @@ internal partial class UserInterfaceManager
private Control? _suppliedTooltip;
private const float TooltipDelay = 1;
private WindowRoot? _focusedRoot;
private static (Control control, Vector2 rel)? MouseFindControlAtPos(Control control, Vector2 position)
{
for (var i = control.ChildCount - 1; i >= 0; i--)
@@ -215,17 +217,28 @@ internal partial class UserInterfaceManager
_doMouseGuiInput(control, guiArgs, (c, ev) => c.MouseWheel(ev), true);
}
public void TextEntered(TextEventArgs textEvent)
public void TextEntered(TextEnteredEventArgs textEnteredEvent)
{
if (KeyboardFocused == null)
{
return;
}
var guiArgs = new GUITextEventArgs(KeyboardFocused, textEvent.CodePoint);
var guiArgs = new GUITextEnteredEventArgs(KeyboardFocused, textEnteredEvent);
KeyboardFocused.TextEntered(guiArgs);
}
public void TextEditing(TextEditingEventArgs textEvent)
{
if (KeyboardFocused == null)
{
return;
}
var guiArgs = new GUITextEditingEventArgs(KeyboardFocused, textEvent);
KeyboardFocused.TextEditing(guiArgs);
}
public ScreenCoordinates MousePositionScaled => ScreenToUIPosition(_inputManager.MouseScreenPosition);
private static void _doMouseGuiInput<T>(Control? control, T guiEvent, Action<Control, T> action,