예제 #1
0
        public virtual void Render(UIComponentState state, int x, int y, int width, int height, int paddingTop, int paddingRight, int paddingBottom, int paddingLeft, Font font, Color4 color, ISizedRenderable2D background, ISizedRenderable2D border)
        {
            int stt = (int)state;

            if (TextCache[stt] == null)
            {
                TextCache[stt] = new TextBox(Name, font, color, x + paddingLeft, y + paddingTop, width - paddingLeft - paddingRight, height - paddingTop - paddingBottom, UITextAlign.Left, UIVerticalAlign.Center, 0);
            }
            TextBox box = TextCache[stt];

            if (background != null)
            {
                background.Render(x, y, width, height);
            }
            if (border != null)
            {
                border.Render(x, y, width, height);
            }
            box.Render();
        }
예제 #2
0
 protected override bool IsAssociatedDataValid(Entity entity, UIComponentState associatedData)
 {
     return
         (entity.Get(UIComponent.Key) == associatedData.UIComponent &&
          entity.Get(TransformComponent.Key) == associatedData.TransformComponent);
 }
예제 #3
0
 protected override bool IsAssociatedDataValid(Entity entity, UIComponent component, UIComponentState associatedData)
 {
     return
         (entity.Get <UIComponent>() == component &&
          entity.Transform == associatedData.TransformComponent);
 }
예제 #4
0
            public                                                    UIComponentStateDefaults this[UIComponentState state] {
                get {
                    switch (state)
                    {
                    case UIComponentState.None: return(Normal);

                    case UIComponentState.Focus: return(Focus);

                    case UIComponentState.Hover: return(Hover);

                    case UIComponentState.MouseDown: return(MouseDown);
                    }
                    return(UIComponentStateDefaults.Default);
                }

                set {
                    switch (state)
                    {
                    case UIComponentState.None: Normal = value; break;

                    case UIComponentState.Focus: Focus = value; break;

                    case UIComponentState.Hover: Hover = value; break;

                    case UIComponentState.MouseDown: MouseDown = value; break;
                    }
                }
            }
예제 #5
0
 protected virtual void MouseUp(UIMouseButtonEventArgs args)
 {
     m_State = UIComponentState.Hover;
 }
예제 #6
0
 protected virtual void MouseDown(UIMouseButtonEventArgs args)
 {
     m_State = UIComponentState.MouseDown;
 }
예제 #7
0
 protected virtual void MouseOut(UIMouseOverEventArgs args)
 {
     m_State = UIComponentState.None;
 }
예제 #8
0
 protected virtual void MouseOver(UIMouseOverEventArgs args)
 {
     m_State = UIComponentState.Hover;
 }