Beispiel #1
0
 public override void Render(int x, int y)
 {
     if (m_Background != null)
     {
         m_Background.Render(x + m_Area.X, y + m_Area.Y, m_Area.Width, m_Area.Height);
     }
     base.Render(x, y);
 }
Beispiel #2
0
        public override void Render(int x, int y)
        {
            int h;

            if (m_Background != null)
            {
                m_Background.Render(x + m_Area.X, y + m_Area.Y, m_Area.Width, m_Area.Height);
            }
            if (m_Border != null)
            {
                m_Border.Render(x + m_Area.X, y + m_Area.Y, m_Area.Width, m_Area.Height);
            }
            base.Render(x, y);

            x += m_Area.X + m_MenuPadding.Left;
            y += m_Area.Y + m_MenuPadding.Top;

            int idx = 0;

            foreach (MenuItem item in m_Items)
            {
                if (item == null || item is MenuItemSeparator)
                {
                    if (m_Separator != null && m_ItemSpacing.Size > 0)
                    {
                        m_Separator.Render(x, y, m_Area.Width - m_MenuPadding.Left - m_MenuPadding.Right, m_ItemSpacing.Size);
                    }
                    y += m_ItemSpacing.Size;
                }
                else
                {
                    h = item.Height + m_ItemPadding.Top + m_ItemPadding.Bottom;
                    if (idx == m_HoverItemIndex)
                    {
                        item.Render(
                            UIComponentState.Hover,
                            x, y, m_Area.Width - m_MenuPadding.Left - m_MenuPadding.Right, h,
                            m_ItemPadding.Top, m_ItemPadding.Right, m_ItemPadding.Bottom, m_ItemPadding.Left,
                            m_Font, m_ItemStates.Hover.Color, m_ItemStates.Hover.Background, m_ItemStates.Hover.Border
                            );
                    }
                    else
                    {
                        item.Render(
                            UIComponentState.None,
                            x, y, m_Area.Width - m_MenuPadding.Left - m_MenuPadding.Right, h,
                            m_ItemPadding.Top, m_ItemPadding.Right, m_ItemPadding.Bottom, m_ItemPadding.Left,
                            m_Font, m_ItemStates.Normal.Color, m_ItemStates.Normal.Background, m_ItemStates.Normal.Border
                            );
                    }
                    y += h;
                }
                y += m_ItemSpacing.Space;
                idx++;
            }
        }
Beispiel #3
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();
        }