Example #1
0
		public SkinControl(SkinControl source)
			: base(source) {
			this.Inherits = source.Inherits;
			this.DefaultSize = source.DefaultSize;
			this.MinimumSize = source.MinimumSize;
			this.OriginMargins = source.OriginMargins;
			this.ClientMargins = source.ClientMargins;
			this.ResizerSize = source.ResizerSize;
			this.Layers = new SkinList<SkinLayer>(source.Layers);
			this.Attributes = new SkinList<SkinAttribute>(source.Attributes);
		}
Example #2
0
		protected internal virtual void InitSkin() {
			if (Manager != null && Manager.Skin != null && Manager.Skin.Controls != null) {
				SkinControl s = Manager.Skin.Controls[Utilities.DeriveControlName(this)];
				if (s != null)
					Skin = new SkinControl(s);
				else
					Skin = new SkinControl(Manager.Skin.Controls["Control"]);
			} else {
				throw new Exception("Control skin cannot be initialized. No skin loaded.");
			}
		}
Example #3
0
		protected internal override void InitSkin() {
			base.InitSkin();
			Skin = new SkinControl(Manager.Skin.Controls["Console"]);

			PositionControls();
		}
Example #4
0
		protected internal override void InitSkin() {
			base.InitSkin();
			Skin = new SkinControl(Manager.Skin.Controls[skRadioButton]);
		}
Example #5
0
		protected internal override void InitSkin() {
			base.InitSkin();
			Skin = new SkinControl(Manager.Skin.Controls["ComboBox"]);
			AdjustMargins();
			ReadOnly = ReadOnly; // To init the right cursor
		}
Example #6
0
		protected internal override void InitSkin() {
			base.InitSkin();
			Skin = new SkinControl(Manager.Skin.Controls["ToolBarPanel"]);
		}
Example #7
0
 protected internal override void InitSkin()
 {
     base.InitSkin();
     Skin = new SkinControl(Manager.Skin.Controls[skRadioButton]);
 }
Example #8
0
		protected internal override void InitSkin() {
			base.InitSkin();
			Skin = new SkinControl(Manager.Skin.Controls["StatusBar"]);
		}
Example #9
0
		private void LoadLayers(SkinControl sc, XmlNodeList l) {
			foreach (XmlElement e in l) {
				string name = ReadAttribute(e, "Name", null, true);
				bool over = ReadAttributeBool(e, "Override", false, false);
				SkinLayer sl = sc.Layers[name];
				bool inh = true;

				if (sl == null) {
					sl = new SkinLayer();
					inh = false;
				}

				if (inh && over) {
					sl = new SkinLayer();
					sc.Layers[name] = sl;
				}

				ReadAttribute(ref sl.Name, inh, e, "Name", null, true);
				ReadAttribute(ref sl.Image.Name, inh, e, "Image", "Control", false);
				ReadAttributeInt(ref sl.Width, inh, e, "Width", 0, false);
				ReadAttributeInt(ref sl.Height, inh, e, "Height", 0, false);

				string tmp = sl.Alignment.ToString();
				ReadAttribute(ref tmp, inh, e, "Alignment", "MiddleCenter", false);
				sl.Alignment = (EAlignment)Enum.Parse(typeof(EAlignment), tmp, true);

				ReadAttributeInt(ref sl.OffsetX, inh, e, "OffsetX", 0, false);
				ReadAttributeInt(ref sl.OffsetY, inh, e, "OffsetY", 0, false);

				ReadAttributeInt(ref sl.SizingMargins.Left, inh, e["SizingMargins"], "Left", 0, false);
				ReadAttributeInt(ref sl.SizingMargins.Top, inh, e["SizingMargins"], "Top", 0, false);
				ReadAttributeInt(ref sl.SizingMargins.Right, inh, e["SizingMargins"], "Right", 0, false);
				ReadAttributeInt(ref sl.SizingMargins.Bottom, inh, e["SizingMargins"], "Bottom", 0, false);

				ReadAttributeInt(ref sl.ContentMargins.Left, inh, e["ContentMargins"], "Left", 0, false);
				ReadAttributeInt(ref sl.ContentMargins.Top, inh, e["ContentMargins"], "Top", 0, false);
				ReadAttributeInt(ref sl.ContentMargins.Right, inh, e["ContentMargins"], "Right", 0, false);
				ReadAttributeInt(ref sl.ContentMargins.Bottom, inh, e["ContentMargins"], "Bottom", 0, false);

				if (e["States"] != null) {
					ReadAttributeInt(ref sl.States.Enabled.Index, inh, e["States"]["Enabled"], "Index", 0, false);
					int di = sl.States.Enabled.Index;
					ReadAttributeInt(ref sl.States.Hovered.Index, inh, e["States"]["Hovered"], "Index", di, false);
					ReadAttributeInt(ref sl.States.Pressed.Index, inh, e["States"]["Pressed"], "Index", di, false);
					ReadAttributeInt(ref sl.States.Focused.Index, inh, e["States"]["Focused"], "Index", di, false);
					ReadAttributeInt(ref sl.States.Disabled.Index, inh, e["States"]["Disabled"], "Index", di, false);

					ReadAttributeColor(ref sl.States.Enabled.Color, inh, e["States"]["Enabled"], "Color", Color.White, false);
					Color dc = sl.States.Enabled.Color;
					ReadAttributeColor(ref sl.States.Hovered.Color, inh, e["States"]["Hovered"], "Color", dc, false);
					ReadAttributeColor(ref sl.States.Pressed.Color, inh, e["States"]["Pressed"], "Color", dc, false);
					ReadAttributeColor(ref sl.States.Focused.Color, inh, e["States"]["Focused"], "Color", dc, false);
					ReadAttributeColor(ref sl.States.Disabled.Color, inh, e["States"]["Disabled"], "Color", dc, false);

					ReadAttributeBool(ref sl.States.Enabled.Overlay, inh, e["States"]["Enabled"], "Overlay", false, false);
					bool dv = sl.States.Enabled.Overlay;
					ReadAttributeBool(ref sl.States.Hovered.Overlay, inh, e["States"]["Hovered"], "Overlay", dv, false);
					ReadAttributeBool(ref sl.States.Pressed.Overlay, inh, e["States"]["Pressed"], "Overlay", dv, false);
					ReadAttributeBool(ref sl.States.Focused.Overlay, inh, e["States"]["Focused"], "Overlay", dv, false);
					ReadAttributeBool(ref sl.States.Disabled.Overlay, inh, e["States"]["Disabled"], "Overlay", dv, false);
				}

				if (e["Overlays"] != null) {
					ReadAttributeInt(ref sl.Overlays.Enabled.Index, inh, e["Overlays"]["Enabled"], "Index", 0, false);
					int di = sl.Overlays.Enabled.Index;
					ReadAttributeInt(ref sl.Overlays.Hovered.Index, inh, e["Overlays"]["Hovered"], "Index", di, false);
					ReadAttributeInt(ref sl.Overlays.Pressed.Index, inh, e["Overlays"]["Pressed"], "Index", di, false);
					ReadAttributeInt(ref sl.Overlays.Focused.Index, inh, e["Overlays"]["Focused"], "Index", di, false);
					ReadAttributeInt(ref sl.Overlays.Disabled.Index, inh, e["Overlays"]["Disabled"], "Index", di, false);

					ReadAttributeColor(ref sl.Overlays.Enabled.Color, inh, e["Overlays"]["Enabled"], "Color", Color.White, false);
					Color dc = sl.Overlays.Enabled.Color;
					ReadAttributeColor(ref sl.Overlays.Hovered.Color, inh, e["Overlays"]["Hovered"], "Color", dc, false);
					ReadAttributeColor(ref sl.Overlays.Pressed.Color, inh, e["Overlays"]["Pressed"], "Color", dc, false);
					ReadAttributeColor(ref sl.Overlays.Focused.Color, inh, e["Overlays"]["Focused"], "Color", dc, false);
					ReadAttributeColor(ref sl.Overlays.Disabled.Color, inh, e["Overlays"]["Disabled"], "Color", dc, false);
				}

				if (e["Text"] != null) {
					ReadAttribute(ref sl.Text.Name, inh, e["Text"], "Font", null, true);
					ReadAttributeInt(ref sl.Text.OffsetX, inh, e["Text"], "OffsetX", 0, false);
					ReadAttributeInt(ref sl.Text.OffsetY, inh, e["Text"], "OffsetY", 0, false);

					tmp = sl.Text.Alignment.ToString();
					ReadAttribute(ref tmp, inh, e["Text"], "Alignment", "MiddleCenter", false);
					sl.Text.Alignment = (EAlignment)Enum.Parse(typeof(EAlignment), tmp, true);

					LoadColors(inh, e["Text"], ref sl.Text.Colors);
				}
				if (e["Attributes"] != null) {
					XmlNodeList l2 = e["Attributes"].GetElementsByTagName("Attribute");
					if (l2 != null && l2.Count > 0) {
						LoadLayerAttributes(sl, l2);
					}
				}
				if (!inh)
					sc.Layers.Add(sl);
			}
		}
Example #10
0
		private void LoadControls() {
			if (doc["Skin"]["Controls"] == null)
				return;


			XmlNodeList l = doc["Skin"]["Controls"].GetElementsByTagName("Control");

			if (l != null && l.Count > 0) {
				foreach (XmlElement e in l) {
					SkinControl sc = null;
					string parent = ReadAttribute(e, "Inherits", null, false);
					bool inh = false;

					if (parent != null) {
						sc = new SkinControl(controls[parent]);
						sc.Inherits = parent;
						inh = true;
					} else {
						sc = new SkinControl();
					}

					ReadAttribute(ref sc.Name, inh, e, "Name", null, true);

					ReadAttributeInt(ref sc.DefaultSize.Width, inh, e["DefaultSize"], "Width", 0, false);
					ReadAttributeInt(ref sc.DefaultSize.Height, inh, e["DefaultSize"], "Height", 0, false);

					ReadAttributeInt(ref sc.MinimumSize.Width, inh, e["MinimumSize"], "Width", 0, false);
					ReadAttributeInt(ref sc.MinimumSize.Height, inh, e["MinimumSize"], "Height", 0, false);

					ReadAttributeInt(ref sc.OriginMargins.Left, inh, e["OriginMargins"], "Left", 0, false);
					ReadAttributeInt(ref sc.OriginMargins.Top, inh, e["OriginMargins"], "Top", 0, false);
					ReadAttributeInt(ref sc.OriginMargins.Right, inh, e["OriginMargins"], "Right", 0, false);
					ReadAttributeInt(ref sc.OriginMargins.Bottom, inh, e["OriginMargins"], "Bottom", 0, false);

					ReadAttributeInt(ref sc.ClientMargins.Left, inh, e["ClientMargins"], "Left", 0, false);
					ReadAttributeInt(ref sc.ClientMargins.Top, inh, e["ClientMargins"], "Top", 0, false);
					ReadAttributeInt(ref sc.ClientMargins.Right, inh, e["ClientMargins"], "Right", 0, false);
					ReadAttributeInt(ref sc.ClientMargins.Bottom, inh, e["ClientMargins"], "Bottom", 0, false);

					ReadAttributeInt(ref sc.ResizerSize, inh, e["ResizerSize"], "Value", 0, false);

					if (e["Layers"] != null) {
						XmlNodeList l2 = e["Layers"].GetElementsByTagName("Layer");
						if (l2 != null && l2.Count > 0) {
							LoadLayers(sc, l2);
						}
					}
					if (e["Attributes"] != null) {
						XmlNodeList l3 = e["Attributes"].GetElementsByTagName("Attribute");
						if (l3 != null && l3.Count > 0) {
							LoadControlAttributes(sc, l3);
						}
					}
					controls.Add(sc);
				}
			}
		}
Example #11
0
		public override void Init() {
			base.Init();

			SkinControl sc = new SkinControl(btnPlus.Skin);
			sc.Layers["Control"] = new SkinLayer(Skin.Layers[strButton]);
			sc.Layers[strButton].Name = "Control";
			btnPlus.Skin = btnMinus.Skin = sc;

			SkinControl ss = new SkinControl(btnSlider.Skin);
			ss.Layers["Control"] = new SkinLayer(Skin.Layers[strSlider]);
			ss.Layers[strSlider].Name = "Control";
			btnSlider.Skin = ss;

			btnMinus.Glyph = new Glyph(Skin.Layers[strMinus].Image.Resource);
			btnMinus.Glyph.SizeMode = ESizeMode.Centered;
			btnMinus.Glyph.Color = Manager.Skin.Controls["Button"].Layers["Control"].Text.Colors.Enabled;

			btnPlus.Glyph = new Glyph(Skin.Layers[strPlus].Image.Resource);
			btnPlus.Glyph.SizeMode = ESizeMode.Centered;
			btnPlus.Glyph.Color = Manager.Skin.Controls["Button"].Layers["Control"].Text.Colors.Enabled;

			btnSlider.Glyph = new Glyph(Skin.Layers[strGlyph].Image.Resource);
			btnSlider.Glyph.SizeMode = ESizeMode.Centered;

		}
Example #12
0
 protected internal override void InitSkin()
 {
     base.InitSkin();
     Skin = new SkinControl(Manager.Skin.Controls["ToolBarPanel"]);
 }
Example #13
0
        private void LoadLayers(SkinControl sc, XmlNodeList l)
        {
            foreach (XmlElement e in l)
            {
                string    name = ReadAttribute(e, "Name", null, true);
                bool      over = ReadAttributeBool(e, "Override", false, false);
                SkinLayer sl   = sc.Layers[name];
                bool      inh  = true;

                if (sl == null)
                {
                    sl  = new SkinLayer();
                    inh = false;
                }

                if (inh && over)
                {
                    sl = new SkinLayer();
                    sc.Layers[name] = sl;
                }

                ReadAttribute(ref sl.Name, inh, e, "Name", null, true);
                ReadAttribute(ref sl.Image.Name, inh, e, "Image", "Control", false);
                ReadAttributeInt(ref sl.Width, inh, e, "Width", 0, false);
                ReadAttributeInt(ref sl.Height, inh, e, "Height", 0, false);

                string tmp = sl.Alignment.ToString();
                ReadAttribute(ref tmp, inh, e, "Alignment", "MiddleCenter", false);
                sl.Alignment = (EAlignment)Enum.Parse(typeof(EAlignment), tmp, true);

                ReadAttributeInt(ref sl.OffsetX, inh, e, "OffsetX", 0, false);
                ReadAttributeInt(ref sl.OffsetY, inh, e, "OffsetY", 0, false);

                ReadAttributeInt(ref sl.SizingMargins.Left, inh, e["SizingMargins"], "Left", 0, false);
                ReadAttributeInt(ref sl.SizingMargins.Top, inh, e["SizingMargins"], "Top", 0, false);
                ReadAttributeInt(ref sl.SizingMargins.Right, inh, e["SizingMargins"], "Right", 0, false);
                ReadAttributeInt(ref sl.SizingMargins.Bottom, inh, e["SizingMargins"], "Bottom", 0, false);

                ReadAttributeInt(ref sl.ContentMargins.Left, inh, e["ContentMargins"], "Left", 0, false);
                ReadAttributeInt(ref sl.ContentMargins.Top, inh, e["ContentMargins"], "Top", 0, false);
                ReadAttributeInt(ref sl.ContentMargins.Right, inh, e["ContentMargins"], "Right", 0, false);
                ReadAttributeInt(ref sl.ContentMargins.Bottom, inh, e["ContentMargins"], "Bottom", 0, false);

                if (e["States"] != null)
                {
                    ReadAttributeInt(ref sl.States.Enabled.Index, inh, e["States"]["Enabled"], "Index", 0, false);
                    int di = sl.States.Enabled.Index;
                    ReadAttributeInt(ref sl.States.Hovered.Index, inh, e["States"]["Hovered"], "Index", di, false);
                    ReadAttributeInt(ref sl.States.Pressed.Index, inh, e["States"]["Pressed"], "Index", di, false);
                    ReadAttributeInt(ref sl.States.Focused.Index, inh, e["States"]["Focused"], "Index", di, false);
                    ReadAttributeInt(ref sl.States.Disabled.Index, inh, e["States"]["Disabled"], "Index", di, false);

                    ReadAttributeColor(ref sl.States.Enabled.Color, inh, e["States"]["Enabled"], "Color", Color.White, false);
                    Color dc = sl.States.Enabled.Color;
                    ReadAttributeColor(ref sl.States.Hovered.Color, inh, e["States"]["Hovered"], "Color", dc, false);
                    ReadAttributeColor(ref sl.States.Pressed.Color, inh, e["States"]["Pressed"], "Color", dc, false);
                    ReadAttributeColor(ref sl.States.Focused.Color, inh, e["States"]["Focused"], "Color", dc, false);
                    ReadAttributeColor(ref sl.States.Disabled.Color, inh, e["States"]["Disabled"], "Color", dc, false);

                    ReadAttributeBool(ref sl.States.Enabled.Overlay, inh, e["States"]["Enabled"], "Overlay", false, false);
                    bool dv = sl.States.Enabled.Overlay;
                    ReadAttributeBool(ref sl.States.Hovered.Overlay, inh, e["States"]["Hovered"], "Overlay", dv, false);
                    ReadAttributeBool(ref sl.States.Pressed.Overlay, inh, e["States"]["Pressed"], "Overlay", dv, false);
                    ReadAttributeBool(ref sl.States.Focused.Overlay, inh, e["States"]["Focused"], "Overlay", dv, false);
                    ReadAttributeBool(ref sl.States.Disabled.Overlay, inh, e["States"]["Disabled"], "Overlay", dv, false);
                }

                if (e["Overlays"] != null)
                {
                    ReadAttributeInt(ref sl.Overlays.Enabled.Index, inh, e["Overlays"]["Enabled"], "Index", 0, false);
                    int di = sl.Overlays.Enabled.Index;
                    ReadAttributeInt(ref sl.Overlays.Hovered.Index, inh, e["Overlays"]["Hovered"], "Index", di, false);
                    ReadAttributeInt(ref sl.Overlays.Pressed.Index, inh, e["Overlays"]["Pressed"], "Index", di, false);
                    ReadAttributeInt(ref sl.Overlays.Focused.Index, inh, e["Overlays"]["Focused"], "Index", di, false);
                    ReadAttributeInt(ref sl.Overlays.Disabled.Index, inh, e["Overlays"]["Disabled"], "Index", di, false);

                    ReadAttributeColor(ref sl.Overlays.Enabled.Color, inh, e["Overlays"]["Enabled"], "Color", Color.White, false);
                    Color dc = sl.Overlays.Enabled.Color;
                    ReadAttributeColor(ref sl.Overlays.Hovered.Color, inh, e["Overlays"]["Hovered"], "Color", dc, false);
                    ReadAttributeColor(ref sl.Overlays.Pressed.Color, inh, e["Overlays"]["Pressed"], "Color", dc, false);
                    ReadAttributeColor(ref sl.Overlays.Focused.Color, inh, e["Overlays"]["Focused"], "Color", dc, false);
                    ReadAttributeColor(ref sl.Overlays.Disabled.Color, inh, e["Overlays"]["Disabled"], "Color", dc, false);
                }

                if (e["Text"] != null)
                {
                    ReadAttribute(ref sl.Text.Name, inh, e["Text"], "Font", null, true);
                    ReadAttributeInt(ref sl.Text.OffsetX, inh, e["Text"], "OffsetX", 0, false);
                    ReadAttributeInt(ref sl.Text.OffsetY, inh, e["Text"], "OffsetY", 0, false);

                    tmp = sl.Text.Alignment.ToString();
                    ReadAttribute(ref tmp, inh, e["Text"], "Alignment", "MiddleCenter", false);
                    sl.Text.Alignment = (EAlignment)Enum.Parse(typeof(EAlignment), tmp, true);

                    LoadColors(inh, e["Text"], ref sl.Text.Colors);
                }
                if (e["Attributes"] != null)
                {
                    XmlNodeList l2 = e["Attributes"].GetElementsByTagName("Attribute");
                    if (l2 != null && l2.Count > 0)
                    {
                        LoadLayerAttributes(sl, l2);
                    }
                }
                if (!inh)
                {
                    sc.Layers.Add(sl);
                }
            }
        }
Example #14
0
        private void LoadControls()
        {
            if (doc["Skin"]["Controls"] == null)
            {
                return;
            }


            XmlNodeList l = doc["Skin"]["Controls"].GetElementsByTagName("Control");

            if (l != null && l.Count > 0)
            {
                foreach (XmlElement e in l)
                {
                    SkinControl sc     = null;
                    string      parent = ReadAttribute(e, "Inherits", null, false);
                    bool        inh    = false;

                    if (parent != null)
                    {
                        sc          = new SkinControl(controls[parent]);
                        sc.Inherits = parent;
                        inh         = true;
                    }
                    else
                    {
                        sc = new SkinControl();
                    }

                    ReadAttribute(ref sc.Name, inh, e, "Name", null, true);

                    ReadAttributeInt(ref sc.DefaultSize.Width, inh, e["DefaultSize"], "Width", 0, false);
                    ReadAttributeInt(ref sc.DefaultSize.Height, inh, e["DefaultSize"], "Height", 0, false);

                    ReadAttributeInt(ref sc.MinimumSize.Width, inh, e["MinimumSize"], "Width", 0, false);
                    ReadAttributeInt(ref sc.MinimumSize.Height, inh, e["MinimumSize"], "Height", 0, false);

                    ReadAttributeInt(ref sc.OriginMargins.Left, inh, e["OriginMargins"], "Left", 0, false);
                    ReadAttributeInt(ref sc.OriginMargins.Top, inh, e["OriginMargins"], "Top", 0, false);
                    ReadAttributeInt(ref sc.OriginMargins.Right, inh, e["OriginMargins"], "Right", 0, false);
                    ReadAttributeInt(ref sc.OriginMargins.Bottom, inh, e["OriginMargins"], "Bottom", 0, false);

                    ReadAttributeInt(ref sc.ClientMargins.Left, inh, e["ClientMargins"], "Left", 0, false);
                    ReadAttributeInt(ref sc.ClientMargins.Top, inh, e["ClientMargins"], "Top", 0, false);
                    ReadAttributeInt(ref sc.ClientMargins.Right, inh, e["ClientMargins"], "Right", 0, false);
                    ReadAttributeInt(ref sc.ClientMargins.Bottom, inh, e["ClientMargins"], "Bottom", 0, false);

                    ReadAttributeInt(ref sc.ResizerSize, inh, e["ResizerSize"], "Value", 0, false);

                    if (e["Layers"] != null)
                    {
                        XmlNodeList l2 = e["Layers"].GetElementsByTagName("Layer");
                        if (l2 != null && l2.Count > 0)
                        {
                            LoadLayers(sc, l2);
                        }
                    }
                    if (e["Attributes"] != null)
                    {
                        XmlNodeList l3 = e["Attributes"].GetElementsByTagName("Attribute");
                        if (l3 != null && l3.Count > 0)
                        {
                            LoadControlAttributes(sc, l3);
                        }
                    }
                    controls.Add(sc);
                }
            }
        }
Example #15
0
		protected internal override void InitSkin() {
			base.InitSkin();
			Skin = new SkinControl(Manager.Skin.Controls[skCheckBox]);
		}
Example #16
0
		protected internal virtual void CheckLayer(SkinControl skin, int layer) {
			if (!(skin != null && skin.Layers != null && skin.Layers.Count > 0 && skin.Layers[layer] != null)) {
				throw new Exception("Unable to read skin layer with index \"" + layer.ToString() + "\" for control \"" + Utilities.DeriveControlName(this) + "\".");
			}
		}
Example #17
0
		protected internal override void InitSkin() {
			base.InitSkin();
			Skin = new SkinControl(Manager.Skin.Controls[skWindow]);
			AdjustMargins();
		}
Example #18
0
		private void LoadControlAttributes(SkinControl sc, XmlNodeList l) {
			foreach (XmlElement e in l) {
				string name = ReadAttribute(e, "Name", null, true);
				SkinAttribute sa = sc.Attributes[name];
				bool inh = true;

				if (sa == null) {
					sa = new SkinAttribute();
					inh = false;
				}

				sa.Name = name;
				ReadAttribute(ref sa.Value, inh, e, "Value", null, true);

				if (!inh)
					sc.Attributes.Add(sa);
			}
		}
Example #19
0
		protected internal override void InitSkin() {
			base.InitSkin();
			Skin = new SkinControl(Manager.Skin.Controls["ContextMenu"]);
		}
Example #20
0
 protected internal override void InitSkin()
 {
     base.InitSkin();
     Skin = new SkinControl(Manager.Skin.Controls[skCheckBox]);
 }