Ejemplo n.º 1
0
        public void Render(IRenderContext renderContext, Rectangle layout, FileSelect fileSelect)
        {
            var offset = 0;

            if (fileSelect.State == ButtonUIState.Clicked)
            {
                _basicSkinHelper.DrawSunken(renderContext, layout);
                offset = 1;
            }
            else
            {
                _basicSkinHelper.DrawRaised(renderContext, layout);
            }

            var text = fileSelect.Path ?? string.Empty;

            while (text.Length > 0 && _renderUtilities.MeasureText(renderContext, "(file select) ..." + text, _fontAsset).X > layout.Width - 10)
            {
                text = text.Substring(1);
            }

            if (text.Length != (fileSelect.Path ?? string.Empty).Length)
            {
                text = "..." + text;
            }

            _renderUtilities.RenderText(
                renderContext,
                new Vector2(layout.Center.X + offset, layout.Center.Y + offset),
                "(file select) " + text,
                _fontAsset,
                HorizontalAlignment.Center,
                VerticalAlignment.Center);
        }
        public void Render(IRenderContext renderContext, Rectangle layout, ScrollableContainer scrollableContainer)
        {
            _basicSkinHelper.DrawSunken(renderContext, layout);

            var layoutWidth  = layout.Width - _skinLayout.HorizontalScrollBarHeight;
            var layoutHeight = layout.Height - _skinLayout.VerticalScrollBarWidth;

            var childContent = scrollableContainer.ChildContent;

            _renderUtilities.RenderTexture(
                renderContext,
                new Vector2(layout.X, layout.Y),
                new TextureAsset(childContent),
                new Vector2(layoutWidth, layoutHeight),
                sourceArea: new Rectangle(
                    (int)(scrollableContainer.ScrollX * (System.Math.Max(childContent.Width, layoutWidth) - layoutWidth)),
                    (int)(scrollableContainer.ScrollY * (System.Math.Max(childContent.Height, layoutHeight) - layoutHeight)),
                    layoutWidth,
                    layoutHeight));

            var raisedPadding = 3;

            _basicSkinHelper.DrawSunken(renderContext, new Rectangle(
                                            layout.X,
                                            layout.Y + layout.Height - _skinLayout.HorizontalScrollBarHeight,
                                            layout.Width - _skinLayout.VerticalScrollBarWidth,
                                            _skinLayout.HorizontalScrollBarHeight));
            _basicSkinHelper.DrawSunken(renderContext, new Rectangle(
                                            layout.X + layout.Width - _skinLayout.VerticalScrollBarWidth,
                                            layout.Y,
                                            _skinLayout.VerticalScrollBarWidth,
                                            layout.Height - _skinLayout.HorizontalScrollBarHeight));

            _basicSkinHelper.DrawRaised(renderContext, new Rectangle(
                                            (int)(layout.X + scrollableContainer.ScrollX * (layoutWidth - layoutWidth / (float)childContent.Width * layoutWidth)) + raisedPadding,
                                            layout.Y + layout.Height - _skinLayout.HorizontalScrollBarHeight + raisedPadding,
                                            (int)(layoutWidth / (float)childContent.Width * layoutWidth) - raisedPadding * 2,
                                            _skinLayout.HorizontalScrollBarHeight - raisedPadding * 2));

            _basicSkinHelper.DrawRaised(renderContext, new Rectangle(
                                            layout.X + layout.Width - _skinLayout.VerticalScrollBarWidth + raisedPadding,
                                            (int)(layout.Y + scrollableContainer.ScrollY * (layoutHeight - layoutHeight / (float)childContent.Height * layoutHeight)) + raisedPadding,
                                            _skinLayout.VerticalScrollBarWidth - raisedPadding * 2,
                                            (int)(layoutHeight / (float)childContent.Height * layoutHeight) - raisedPadding * 2));
        }
Ejemplo n.º 3
0
        public void Render(IRenderContext renderContext, Rectangle layout, MenuItem menuItem)
        {
            if (menuItem.Active)
            {
                _basicSkinHelper.DrawRaised(renderContext, layout);
            }
            else
            {
                _basicSkinHelper.DrawFlat(renderContext, layout);
            }

            _renderUtilities.RenderText(
                renderContext,
                new Vector2(layout.X + 5, layout.Center.Y),
                menuItem.Text,
                _fontAsset,
                verticalAlignment: VerticalAlignment.Center);
        }
Ejemplo n.º 4
0
        public void Render(IRenderContext renderContext, Rectangle layout, ListItem listItem)
        {
            if (listItem.Parent is ListView)
            {
                var view = listItem.Parent as ListView;
                if (view.SelectedItem == listItem)
                {
                    _basicSkinHelper.DrawRaised(renderContext, layout);
                }
            }

            _renderUtilities.RenderText(
                renderContext,
                new Vector2(layout.X + 5, layout.Center.Y),
                listItem.Text,
                _fontAsset,
                verticalAlignment: VerticalAlignment.Center);
        }
Ejemplo n.º 5
0
        public void Render(IRenderContext renderContext, Rectangle layout, Button button)
        {
            var offset = 0;

            if (button.State == ButtonUIState.Clicked)
            {
                _basicSkinHelper.DrawSunken(renderContext, layout);
                offset = 1;
            }
            else
            {
                _basicSkinHelper.DrawRaised(renderContext, layout);
            }

            _renderUtilities.RenderText(
                renderContext,
                new Vector2(layout.Center.X + offset, layout.Center.Y + offset),
                button.Text,
                _fontAsset,
                HorizontalAlignment.Center,
                VerticalAlignment.Center);
        }
Ejemplo n.º 6
0
 public void Render(IRenderContext renderContext, Rectangle layout, Window window)
 {
     _basicSkinHelper.DrawRaised(renderContext, layout);
 }