public HorizontalLayout(Control parent, UniScalar verticalPosition, UniScalar height, int leftOffset = 0, int rightOffset = 0) { _verticalPosition = verticalPosition; _height = height; _leftOffset = leftOffset; _rightOffset = rightOffset; Parent = parent; }
public Tooltip(IContext context, string id, Control associatedControl, double delay, string text = null) : base(context, id, new UniRectangle()) { _associatedControl = associatedControl; _text = context.TextManager.Create("Courrier", 14, "", new Vector2I(400, 500), Color.Wheat, HorizontalAlignment.Left, VerticalAlignment.Top, new Padding(8)); if(text != null) _text.Content = text; Texture texture = Context.TextureManager.Create("tooltip.png", @"Data/UI/"); _rectangle = new TexturedExtensibleRectangle(Context, new Vector2I(), texture, 8); _delay = delay; Visible = false; }
public PositionLayout Create(Control control) { UniScalar x, y; if (_horizontalAlignment == HorizontalAlignment.Left) x = _padding.Left; else if(_horizontalAlignment == HorizontalAlignment.Right) x = new UniScalar(1.0f) - _width - _padding.Right; else x = new UniScalar(0.5f) - ((_width - _padding.Left - _padding.Right) / 2 + _padding.Left) ; if (_verticalAlignment == VerticalAlignment.Top) y = _padding.Top; else if (_verticalAlignment == VerticalAlignment.Bottom) y = new UniScalar(1.0f) - _height - _padding.Bottom; else y = new UniScalar(0.5f) - ((_height - _padding.Top - _padding.Bottom)/2 + _padding.Top); control.Coordinates = new UniRectangle(x, y, _width, _height); ParentComponent.Register(control); return this; }
public DynamicTooltip(IContext context, string id, Control associatedControl, double delay) : base(context, id, associatedControl, delay) { }
public void Unregister() { HoveredControl = null; ClickedControl = null; ActivatedControl = null; DesactivateTree(); }
public void RecalculateActiveComponents() { ClickedControl = null; HoveredControl = null; }
public void MouseMoved(Vector2I position) { if (ClickedControl != null) { ClickedControl.OnControlDragged(Context.UiManager.MousePosition - Context.UiManager.PreviousMousePosition); return; } //Todo : if activated control //If we are still hovering the same component, we search if we hover one of it's child UiComponent node; if (HoveredControl != null && HoveredControl.InBoundsAndActive(position)) node = HoveredControl; else // If not, we search the full tree node = this; HoveredControl = node.GetHoveredControl(position); }
public LayoutItem(Control control, int width) { Control = control; Width = width; }
public HorizontalLayout AddControl(Control item, int width) { _controls.Add(new LayoutItem(item, width)); Parent.Register(item); return this; }