/** * Callback functions.. may need to refactor? */ virtual public void mousePressed_func(Vector2 pos, object obj, int mouse) { Vector2 mousePos = root.mousePos; if (mouse > 0) { foreach (UIElement b in children) { if (b.HitTest(mousePos) && b.mousePressedCallback != null) { b.mousePressedCallback(mousePos, b, mouse); break; } } if (mouse == 1) { UITextInput.TestActiveTextInput(this); if (alwaysSort == 0) { depth = 2; } root.Sort(); } } }
/** * Called by other objects to see if the textinput should lose focus * needs to be expanded? */ public static void TestActiveTextInput(UIElement obj) { if (activeTextInput != null) { if (!obj.children.Contains <Entity>(activeTextInput)) { aedit3.root.Window.TextInput -= activeTextInput.TextInputCallback; activeTextInput.state = UIButtonState.Released; activeTextInput = null; } } }
/** * Callback func used for setting the text input * called by textinput objects */ public static void SetActiveTextInput(Vector2 pos, Object obj, int mouse) { if (mouse == 1) { if (activeTextInput != null) { activeTextInput.state = UIButtonState.Released; aedit3.root.Window.TextInput -= activeTextInput.TextInputCallback; } activeTextInput = (UITextInput)obj; aedit3.root.Window.TextInput += activeTextInput.TextInputCallback; activeTextInput.state = UIButtonState.Pressed; } }