コード例 #1
0
ファイル: HorizontalLayout.cs プロジェクト: ndech/Alpha
 public HorizontalLayout(Control parent, UniScalar verticalPosition, UniScalar height, int leftOffset = 0, int rightOffset = 0)
 {
     _verticalPosition = verticalPosition;
     _height = height;
     _leftOffset = leftOffset;
     _rightOffset = rightOffset;
     Parent = parent;
 }
コード例 #2
0
ファイル: Tooltip.cs プロジェクト: ndech/Alpha
 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;
 }
コード例 #3
0
ファイル: PositionLayout.cs プロジェクト: ndech/Alpha
        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;
        }
コード例 #4
0
ファイル: DynamicTooltip.cs プロジェクト: ndech/Alpha
 public DynamicTooltip(IContext context, string id, Control associatedControl, double delay)
     : base(context, id, associatedControl, delay)
 {
 }
コード例 #5
0
ファイル: Screen.cs プロジェクト: ndech/Alpha
 public void Unregister()
 {
     HoveredControl = null;
     ClickedControl = null;
     ActivatedControl = null;
     DesactivateTree();
 }
コード例 #6
0
ファイル: Screen.cs プロジェクト: ndech/Alpha
 public void RecalculateActiveComponents()
 {
     ClickedControl = null;
     HoveredControl = null;
 }
コード例 #7
0
ファイル: Screen.cs プロジェクト: ndech/Alpha
 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);
 }
コード例 #8
0
ファイル: HorizontalLayout.cs プロジェクト: ndech/Alpha
 public LayoutItem(Control control, int width)
 {
     Control = control;
     Width = width;
 }
コード例 #9
0
ファイル: HorizontalLayout.cs プロジェクト: ndech/Alpha
 public HorizontalLayout AddControl(Control item, int width)
 {
     _controls.Add(new LayoutItem(item, width));
     Parent.Register(item);
     return this;
 }