The file select.
Inheritance: IContainer
Esempio n. 1
0
        /// <summary>
        /// The draw file select.
        /// </summary>
        /// <param name="context">
        /// The context.
        /// </param>
        /// <param name="layout">
        /// The layout.
        /// </param>
        /// <param name="fileSelect">
        /// The file select.
        /// </param>
        public void DrawFileSelect(IRenderContext context, Rectangle layout, FileSelect fileSelect)
        {
            var offset = 0;

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

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

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

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

            this.m_RenderUtilities.RenderText(
                context,
                new Vector2(layout.Center.X + offset, layout.Center.Y + offset),
                "(file select) " + text,
                this.m_AssetManager.Get <FontAsset>("font.Default"),
                HorizontalAlignment.Center,
                VerticalAlignment.Center);
        }
Esempio n. 2
0
        /// <summary>
        /// The draw file select.
        /// </summary>
        /// <param name="context">
        /// The context.
        /// </param>
        /// <param name="layout">
        /// The layout.
        /// </param>
        /// <param name="fileSelect">
        /// The file select.
        /// </param>
        public void DrawFileSelect(IRenderContext context, Rectangle layout, FileSelect fileSelect)
        {
            var offset = 0;
            if (fileSelect.State == ButtonUIState.Clicked)
            {
                this.DrawSunken(context, layout);
                offset = 1;
            }
            else
            {
                this.DrawRaised(context, layout);
            }

            var text = fileSelect.Path ?? string.Empty;
            while (text.Length > 0 && this.MeasureText(context, "(file select) ..." + text).X > layout.Width - 10)
            {
                text = text.Substring(1);
            }

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

            this.m_RenderUtilities.RenderText(
                context,
                new Vector2(layout.Center.X + offset, layout.Center.Y + offset),
                "(file select) " + text,
                this.m_AssetManager.Get<FontAsset>("font.Default"),
                HorizontalAlignment.Center,
                VerticalAlignment.Center);
        }
Esempio n. 3
0
 public void DrawFileSelect(IRenderContext context, Rectangle layout, FileSelect fileSelect)
 {
     this.m_BasicSkin.DrawFileSelect(context, layout, fileSelect);
 }