} // ScrollBar

        #endregion

        #region Init

        protected internal override void Init()
        {
            base.Init();

            SkinControlInformation sc = new SkinControlInformation(buttonPlus.SkinInformation);
            sc.Layers["Control"] = new SkinLayer(SkinInformation.Layers[skinButton]);
            sc.Layers[skinButton].Name = "Control";
            buttonPlus.SkinInformation = buttonMinus.SkinInformation = sc;

            SkinControlInformation ss = new SkinControlInformation(buttonSlider.SkinInformation);
            ss.Layers["Control"] = new SkinLayer(SkinInformation.Layers[skinSlider]);
            ss.Layers[skinSlider].Name = "Control";
            buttonSlider.SkinInformation = ss;

            buttonMinus.Glyph = new Glyph(SkinInformation.Layers[skinMinus].Image.Texture)
            {
                SizeMode = SizeMode.Centered,
                Color = Skin.Controls["Button"].Layers["Control"].Text.Colors.Enabled
            };

            buttonPlus.Glyph = new Glyph(SkinInformation.Layers[skinPlus].Image.Texture)
            {
                SizeMode = SizeMode.Centered,
                Color = Skin.Controls["Button"].Layers["Control"].Text.Colors.Enabled
            };

            buttonSlider.Glyph = new Glyph(SkinInformation.Layers[skinGlyph].Image.Texture) { SizeMode = SizeMode.Centered };
        } // Init
        } // Init

        protected internal override void InitSkin()
        {
            base.InitSkin();
            SkinInformation = new SkinControlInformation(Skin.Controls["ComboBox"]);
            AdjustMargins();
            ReadOnly = ReadOnly; // To init the right cursor
        } // InitSkin
Exemple #3
0
        } // ButtonClose_Click

        #endregion

        #region Draw and Render

        /// <summary>
        /// Render the control to the main render target.
        /// </summary>
        internal override void DrawControlOntoMainTexture()
        {

            #region Shadow

            if (Visible && Shadow)
            {
                SkinControlInformation skinControlShadow = Skin.Controls[skinShadow];
                SkinLayer   skinLayerShadow   = skinControlShadow.Layers[layerShadow];

                Color shadowColor = Color.FromNonPremultiplied(skinLayerShadow.States.Enabled.Color.R, 
                                                               skinLayerShadow.States.Enabled.Color.G,
                                                               skinLayerShadow.States.Enabled.Color.B, Alpha);

                Renderer.Begin();
                    Renderer.DrawLayer(skinLayerShadow,
                                       new Rectangle(Left - skinControlShadow.OriginMargins.Left,
                                                     Top - skinControlShadow.OriginMargins.Top, 
                                                     Width + skinControlShadow.OriginMargins.Horizontal,
                                                     Height + skinControlShadow.OriginMargins.Vertical),
                                       shadowColor, 0);
                Renderer.End();
            }

            #endregion

            base.DrawControlOntoMainTexture();
        } // Render
Exemple #4
0
        } // LoadSkin

        #endregion

        #region Load Controls

        /// <summary>
        /// Load the skin information of every control.
        /// </summary>
        private static void LoadControlsDescription()
        {
            if (skinDescription.Resource.Element("Skin").Element("Controls") == null)
            {
                return;
            }

            foreach (XElement control in skinDescription.Resource.Descendants("Control"))
            {
                SkinControlInformation skinControl;
                // Create skin control
                string parent  = ReadAttribute(control, "Inherits", null, false);
                bool   inherit = false;
                if (parent != null) // If there is a parent then it loads the information from it.
                {
                    skinControl = new SkinControlInformation(Controls[parent]);
                    inherit     = true;
                }
                else
                {
                    skinControl = new SkinControlInformation();
                }

                // Load general information
                ReadAttribute(ref skinControl.Name, inherit, control, "Name", null, true);

                ReadAttribute(ref skinControl.DefaultSize.Width, inherit, control.Element("DefaultSize"), "Width", 0, false);
                ReadAttribute(ref skinControl.DefaultSize.Height, inherit, control.Element("DefaultSize"), "Height", 0, false);

                ReadAttribute(ref skinControl.MinimumSize.Width, inherit, control.Element("MinimumSize"), "Width", 0, false);
                ReadAttribute(ref skinControl.MinimumSize.Height, inherit, control.Element("MinimumSize"), "Height", 0, false);

                ReadAttribute(ref skinControl.OriginMargins.Left, inherit, control.Element("OriginMargins"), "Left", 0, false);
                ReadAttribute(ref skinControl.OriginMargins.Top, inherit, control.Element("OriginMargins"), "Top", 0, false);
                ReadAttribute(ref skinControl.OriginMargins.Right, inherit, control.Element("OriginMargins"), "Right", 0, false);
                ReadAttribute(ref skinControl.OriginMargins.Bottom, inherit, control.Element("OriginMargins"), "Bottom", 0, false);

                ReadAttribute(ref skinControl.ClientMargins.Left, inherit, control.Element("ClientMargins"), "Left", 0, false);
                ReadAttribute(ref skinControl.ClientMargins.Top, inherit, control.Element("ClientMargins"), "Top", 0, false);
                ReadAttribute(ref skinControl.ClientMargins.Right, inherit, control.Element("ClientMargins"), "Right", 0, false);
                ReadAttribute(ref skinControl.ClientMargins.Bottom, inherit, control.Element("ClientMargins"), "Bottom", 0, false);

                ReadAttribute(ref skinControl.ResizerSize, inherit, control.Element("ResizerSize"), "Value", 0, false);
                // Load control's layers
                if (control.Element("Layers") != null)
                {
                    foreach (var layer in control.Element("Layers").Elements())
                    {
                        if (layer.Name == "Layer")
                        {
                            LoadLayer(skinControl, layer);
                        }
                    }
                }
                Controls.Add(skinControl);
            }
        } // LoadControls
Exemple #5
0
 public SkinControlInformation(SkinControlInformation source) : base(source)
 {
     DefaultSize   = source.DefaultSize;
     MinimumSize   = source.MinimumSize;
     OriginMargins = source.OriginMargins;
     ClientMargins = source.ClientMargins;
     ResizerSize   = source.ResizerSize;
     Layers        = new SkinList <SkinLayer>(source.Layers);
     Attributes    = new SkinList <SkinAttribute>(source.Attributes);
 } // SkinControl
        } // Init

        protected internal override void InitSkin()
        {
            base.InitSkin();
            SkinInformation = new SkinControlInformation(Skin.Controls["TextBox"]);

            #if (WINDOWS)
                Cursor = Skin.Cursors["Text"].Cursor;
            #endif

            font = (SkinInformation.Layers["Control"].Text != null) ? SkinInformation.Layers["Control"].Text.Font.Font : null;
        } // InitSkin
Exemple #7
0
        } // Init

        protected internal override void InitSkin()
        {
            base.InitSkin();
            SkinInformation = new SkinControlInformation(Skin.Controls[skinWindow]);
            AdjustMargins();

            CheckLayer(SkinInformation, layerWindow);
            CheckLayer(SkinInformation, layerCaption);
            CheckLayer(SkinInformation, layerFrameTop);
            CheckLayer(SkinInformation, layerFrameLeft);
            CheckLayer(SkinInformation, layerFrameRight);
            CheckLayer(SkinInformation, layerFrameBottom);
            CheckLayer(Skin.Controls[skinButton], layerButton);
            CheckLayer(Skin.Controls[skinShadow], layerShadow);
        } // InitSkin
Exemple #8
0
        } // SpinBox

        #endregion

        #region Init

        protected internal override void Init()
        {
            base.Init();

            SkinControlInformation sc = new SkinControlInformation(btnUp.SkinInformation);
            sc.Layers["Control"] = new SkinLayer(SkinInformation.Layers["Button"]);
            sc.Layers["Button"].Name = "Control";
            btnUp.SkinInformation = btnDown.SkinInformation = sc;

            btnUp.Glyph = new Glyph(Skin.Images["Shared.ArrowUp"].Texture)
            {
                SizeMode = SizeMode.Centered,
                Color = Skin.Controls["Button"].Layers["Control"].Text.Colors.Enabled
            };

            btnDown.Glyph = new Glyph(Skin.Images["Shared.ArrowDown"].Texture)
            {
                SizeMode = SizeMode.Centered,
                Color = Skin.Controls["Button"].Layers["Control"].Text.Colors.Enabled
            };
        } // Init
        } // Console

        #endregion

        #region Init

        protected internal override void InitSkin()
        {
            base.InitSkin();
            SkinInformation = new SkinControlInformation(Skin.Controls["Console"]);
            PositionControls();
        } // InitSkin
        } // MainMenu

        #endregion

        #region Init

        protected internal override void InitSkin()
        {
            base.InitSkin();
            SkinInformation = new SkinControlInformation(Skin.Controls["MainMenu"]);
        } // InitSkin
Exemple #11
0
        } // LoadControls

        #endregion

        #region Load Layers

        /// <summary>
        /// Load layers information.
        /// </summary>
        private static void LoadLayer(SkinControlInformation skinControl, XElement layerNode)
        {
            string    name      = ReadAttribute(layerNode, "Name", null, true);
            bool      over      = ReadAttribute(layerNode, "Override", false, false);
            SkinLayer skinLayer = skinControl.Layers[name];

            bool inherent = true;

            if (skinLayer == null)
            {
                skinLayer = new SkinLayer();
                inherent  = false;
            }

            if (inherent && over)
            {
                skinLayer = new SkinLayer();
                skinControl.Layers[name] = skinLayer;
            }

            ReadAttribute(ref skinLayer.Name, inherent, layerNode, "Name", null, true);
            ReadAttribute(ref skinLayer.Image.Name, inherent, layerNode, "Image", "Control", false);
            ReadAttribute(ref skinLayer.Width, inherent, layerNode, "Width", 0, false);
            ReadAttribute(ref skinLayer.Height, inherent, layerNode, "Height", 0, false);

            string layerAlignment = skinLayer.Alignment.ToString();

            ReadAttribute(ref layerAlignment, inherent, layerNode, "Alignment", "MiddleCenter", false);
            skinLayer.Alignment = (Alignment)Enum.Parse(typeof(Alignment), layerAlignment, true);

            ReadAttribute(ref skinLayer.OffsetX, inherent, layerNode, "OffsetX", 0, false);
            ReadAttribute(ref skinLayer.OffsetY, inherent, layerNode, "OffsetY", 0, false);

            ReadAttribute(ref skinLayer.SizingMargins.Left, inherent, layerNode.Element("SizingMargins"), "Left", 0, false);
            ReadAttribute(ref skinLayer.SizingMargins.Top, inherent, layerNode.Element("SizingMargins"), "Top", 0, false);
            ReadAttribute(ref skinLayer.SizingMargins.Right, inherent, layerNode.Element("SizingMargins"), "Right", 0, false);
            ReadAttribute(ref skinLayer.SizingMargins.Bottom, inherent, layerNode.Element("SizingMargins"), "Bottom", 0, false);

            ReadAttribute(ref skinLayer.ContentMargins.Left, inherent, layerNode.Element("ContentMargins"), "Left", 0, false);
            ReadAttribute(ref skinLayer.ContentMargins.Top, inherent, layerNode.Element("ContentMargins"), "Top", 0, false);
            ReadAttribute(ref skinLayer.ContentMargins.Right, inherent, layerNode.Element("ContentMargins"), "Right", 0, false);
            ReadAttribute(ref skinLayer.ContentMargins.Bottom, inherent, layerNode.Element("ContentMargins"), "Bottom", 0, false);

            #region States

            if (layerNode.Element("States") != null)
            {
                ReadAttribute(ref skinLayer.States.Enabled.Index, inherent, layerNode.Element("States").Element("Enabled"), "Index", 0, false);
                int di = skinLayer.States.Enabled.Index;
                ReadAttribute(ref skinLayer.States.Hovered.Index, inherent, layerNode.Element("States").Element("Hovered"), "Index", di, false);
                ReadAttribute(ref skinLayer.States.Pressed.Index, inherent, layerNode.Element("States").Element("Pressed"), "Index", di, false);
                ReadAttribute(ref skinLayer.States.Focused.Index, inherent, layerNode.Element("States").Element("Focused"), "Index", di, false);
                ReadAttribute(ref skinLayer.States.Disabled.Index, inherent, layerNode.Element("States").Element("Disabled"), "Index", di, false);

                ReadAttribute(ref skinLayer.States.Enabled.Color, inherent, layerNode.Element("States").Element("Enabled"), "Color", Color.White, false);
                Color dc = skinLayer.States.Enabled.Color;
                ReadAttribute(ref skinLayer.States.Hovered.Color, inherent, layerNode.Element("States").Element("Hovered"), "Color", dc, false);
                ReadAttribute(ref skinLayer.States.Pressed.Color, inherent, layerNode.Element("States").Element("Pressed"), "Color", dc, false);
                ReadAttribute(ref skinLayer.States.Focused.Color, inherent, layerNode.Element("States").Element("Focused"), "Color", dc, false);
                ReadAttribute(ref skinLayer.States.Disabled.Color, inherent, layerNode.Element("States").Element("Disabled"), "Color", dc, false);

                ReadAttribute(ref skinLayer.States.Enabled.Overlay, inherent, layerNode.Element("States").Element("Enabled"), "Overlay", false, false);
                bool dv = skinLayer.States.Enabled.Overlay;
                ReadAttribute(ref skinLayer.States.Hovered.Overlay, inherent, layerNode.Element("States").Element("Hovered"), "Overlay", dv, false);
                ReadAttribute(ref skinLayer.States.Pressed.Overlay, inherent, layerNode.Element("States").Element("Pressed"), "Overlay", dv, false);
                ReadAttribute(ref skinLayer.States.Focused.Overlay, inherent, layerNode.Element("States").Element("Focused"), "Overlay", dv, false);
                ReadAttribute(ref skinLayer.States.Disabled.Overlay, inherent, layerNode.Element("States").Element("Disabled"), "Overlay", dv, false);
            }

            #endregion

            #region Overlays

            if (layerNode.Element("Overlays") != null)
            {
                ReadAttribute(ref skinLayer.Overlays.Enabled.Index, inherent, layerNode.Element("Overlays").Element("Enabled"), "Index", 0, false);
                int di = skinLayer.Overlays.Enabled.Index;
                ReadAttribute(ref skinLayer.Overlays.Hovered.Index, inherent, layerNode.Element("Overlays").Element("Hovered"), "Index", di, false);
                ReadAttribute(ref skinLayer.Overlays.Pressed.Index, inherent, layerNode.Element("Overlays").Element("Pressed"), "Index", di, false);
                ReadAttribute(ref skinLayer.Overlays.Focused.Index, inherent, layerNode.Element("Overlays").Element("Focused"), "Index", di, false);
                ReadAttribute(ref skinLayer.Overlays.Disabled.Index, inherent, layerNode.Element("Overlays").Element("Disabled"), "Index", di, false);

                ReadAttribute(ref skinLayer.Overlays.Enabled.Color, inherent, layerNode.Element("Overlays").Element("Enabled"), "Color", Color.White, false);
                Color dc = skinLayer.Overlays.Enabled.Color;
                ReadAttribute(ref skinLayer.Overlays.Hovered.Color, inherent, layerNode.Element("Overlays").Element("Hovered"), "Color", dc, false);
                ReadAttribute(ref skinLayer.Overlays.Pressed.Color, inherent, layerNode.Element("Overlays").Element("Pressed"), "Color", dc, false);
                ReadAttribute(ref skinLayer.Overlays.Focused.Color, inherent, layerNode.Element("Overlays").Element("Focused"), "Color", dc, false);
                ReadAttribute(ref skinLayer.Overlays.Disabled.Color, inherent, layerNode.Element("Overlays").Element("Disabled"), "Color", dc, false);
            }

            #endregion

            #region Text

            if (layerNode.Element("Text") != null)
            {
                ReadAttribute(ref skinLayer.Text.Name, inherent, layerNode.Element("Text"), "Font", null, true);
                ReadAttribute(ref skinLayer.Text.OffsetX, inherent, layerNode.Element("Text"), "OffsetX", 0, false);
                ReadAttribute(ref skinLayer.Text.OffsetY, inherent, layerNode.Element("Text"), "OffsetY", 0, false);

                layerAlignment = skinLayer.Text.Alignment.ToString();
                ReadAttribute(ref layerAlignment, inherent, layerNode.Element("Text"), "Alignment", "MiddleCenter", false);
                skinLayer.Text.Alignment = (Alignment)Enum.Parse(typeof(Alignment), layerAlignment, true);

                LoadColors(inherent, layerNode.Element("Text"), ref skinLayer.Text.Colors);
            }

            #endregion

            #region Attributes

            if (layerNode.Element("Attributes") != null)
            {
                foreach (var attribute in layerNode.Element("Attributes").Elements())
                {
                    if (attribute.Name == "Attribute")
                    {
                        LoadLayerAttribute(skinLayer, attribute);
                    }
                }
            }

            #endregion

            if (!inherent)
            {
                skinControl.Layers.Add(skinLayer);
            }
        } // LoadLayer