public void OnEvent(DeftEvent theEvent, params object[] args) { if (DeftUI.focus == null) { return; } var eventType = theEvent.GetType(); if (eventType == typeof(Event_OnLeftMouseClick)) { DeftUI.focusState = UIFocusState.None; } else if (eventType == typeof(Event_OnLeftMousePress)) { if (DeftUI.focus.Bounds.Contains(Input.MousePos) && DeftUI.focus.isDraggable) { DeftUI.focusState = UIFocusState.Dragging; } else { var anchor = DeftUI.focus.Bounds.GetBoxAnchorPointAtPos(Input.MousePos, 15); if (anchor != AnchorPoint.None && DeftUI.focus.isResizable) { DeftUI.focusState = UIFocusState.Resizing; DeftUI.focusResizeAnchor = anchor; } } } }
public void OnEvent(DeftEvent theEvent, params object[] args) { Gadget focus = DeftUI.focus; if (focus == null) { return; } if (DeftUI.focusState == UIFocusState.Dragging) { Drag(focus); } else if (DeftUI.focusState == UIFocusState.Resizing) { Resize(focus, DeftUI.focusResizeAnchor); } }
public void OnEvent(DeftEvent theEvent, params object[] args) { string text = (string)args[0]; if (DeftUI.focus == null) { return; } if (DeftUI.focus.GetType().IsSubclassOf(typeof(TextBox)) && (text == "BACKSPACE" || text == "DELETE")) { var textBox = DeftUI.focus as TextBox; textBox.ApplyTextOpCode(text); } else { DeftUI.focus.OnTextEntry(text); } }
public void OnEvent(DeftEvent theEvent, params object[] args) { Gadget focus = DeftUI.focus; if (focus == null) { SelectNewFocusGadget(); } else { // Already have an active gadget, only make a new selection IF: // If within borders, we're not within the borders of a higher layer element // If not within borders, // If resizable, mouse not within resize boxes if (focus.Bounds.Contains(Input.MousePos)) { if (!IsHighestLayerGadgetAtPos(focus.Layer, Input.MousePos)) { SelectNewFocusGadget(); } } else // Mouse not within focus borders { if (!focus.isResizable) { SelectNewFocusGadget(); } else if (focus.Bounds.GetBoxAnchorPointAtPos(Input.MousePos, 7) == AnchorPoint.None) { SelectNewFocusGadget(); } } } // After focus gadget has been determined, fire its OnClick event. if (DeftUI.focus != null) { DeftUI.focus.OnClick(); } }
public void OnEvent(DeftEvent theEvent, params object[] args) { }