Пример #1
0
		public virtual void DrawLayer(Control control, SkinLayer layer, Rectangle rect, EControlState state) {
			Color c = Color.White;
			Color oc = Color.White;
			int i = 0;
			int oi = -1;
			SkinLayer l = layer;

			if (state == EControlState.Hovered && (layer.States.Hovered.Index != -1)) {
				c = l.States.Hovered.Color;
				i = l.States.Hovered.Index;

				if (l.States.Hovered.Overlay) {
					oc = l.Overlays.Hovered.Color;
					oi = l.Overlays.Hovered.Index;
				}
			} else if (state == EControlState.Focused || (control.Focused && state == EControlState.Hovered && layer.States.Hovered.Index == -1)) {
				c = l.States.Focused.Color;
				i = l.States.Focused.Index;

				if (l.States.Focused.Overlay) {
					oc = l.Overlays.Focused.Color;
					oi = l.Overlays.Focused.Index;
				}
			} else if (state == EControlState.Pressed) {
				c = l.States.Pressed.Color;
				i = l.States.Pressed.Index;

				if (l.States.Pressed.Overlay) {
					oc = l.Overlays.Pressed.Color;
					oi = l.Overlays.Pressed.Index;
				}
			} else if (state == EControlState.Disabled) {
				c = l.States.Disabled.Color;
				i = l.States.Disabled.Index;

				if (l.States.Disabled.Overlay) {
					oc = l.Overlays.Disabled.Color;
					oi = l.Overlays.Disabled.Index;
				}
			} else {
				c = l.States.Enabled.Color;
				i = l.States.Enabled.Index;

				if (l.States.Enabled.Overlay) {
					oc = l.Overlays.Enabled.Color;
					oi = l.Overlays.Enabled.Index;
				}
			}

			if (control.Color != Control.UndefinedColor)
				c = control.Color * (control.Color.A / 255f);
			DrawLayer(l, rect, c, i);

			if (oi != -1) {
				DrawLayer(l, rect, oc, oi);
			}
		}
Пример #2
0
		public virtual void DrawString(Control control, SkinLayer layer, string text, Rectangle rect, EControlState state, bool margins) {
			DrawString(control, layer, text, rect, state, margins, 0, 0, true);
		}
Пример #3
0
		public virtual void DrawString(Control control, SkinLayer layer, string text, Rectangle rect, EControlState state, bool margins, int ox, int oy, bool ellipsis) {
			Color col = Color.White;

			if (layer.Text != null) {
				if (margins) {
					Margins m = layer.ContentMargins;
					rect = new Rectangle(rect.Left + m.Left, rect.Top + m.Top, rect.Width - m.Horizontal, rect.Height - m.Vertical);
				}

				if (state == EControlState.Hovered && (layer.States.Hovered.Index != -1)) {
					col = layer.Text.Colors.Hovered;
				} else if (state == EControlState.Pressed) {
					col = layer.Text.Colors.Pressed;
				} else if (state == EControlState.Focused || (control.Focused && state == EControlState.Hovered && layer.States.Hovered.Index == -1)) {
					col = layer.Text.Colors.Focused;
				} else if (state == EControlState.Disabled) {
					col = layer.Text.Colors.Disabled;
				} else {
					col = layer.Text.Colors.Enabled;
				}

				if (text != null && text != "") {
					SkinText font = layer.Text;
					if (control.TextColor != Control.UndefinedColor && control.ControlState != EControlState.Disabled)
						col = control.TextColor;
					DrawString(font.Font.Resource, text, rect, col, font.Alignment, font.OffsetX + ox, font.OffsetY + oy, ellipsis);
				}
			}
		}
Пример #4
0
        public virtual void DrawLayer(Control control, SkinLayer layer, Rectangle rect, EControlState state)
        {
            Color     c  = Color.White;
            Color     oc = Color.White;
            int       i  = 0;
            int       oi = -1;
            SkinLayer l  = layer;

            if (state == EControlState.Hovered && (layer.States.Hovered.Index != -1))
            {
                c = l.States.Hovered.Color;
                i = l.States.Hovered.Index;

                if (l.States.Hovered.Overlay)
                {
                    oc = l.Overlays.Hovered.Color;
                    oi = l.Overlays.Hovered.Index;
                }
            }
            else if (state == EControlState.Focused || (control.Focused && state == EControlState.Hovered && layer.States.Hovered.Index == -1))
            {
                c = l.States.Focused.Color;
                i = l.States.Focused.Index;

                if (l.States.Focused.Overlay)
                {
                    oc = l.Overlays.Focused.Color;
                    oi = l.Overlays.Focused.Index;
                }
            }
            else if (state == EControlState.Pressed)
            {
                c = l.States.Pressed.Color;
                i = l.States.Pressed.Index;

                if (l.States.Pressed.Overlay)
                {
                    oc = l.Overlays.Pressed.Color;
                    oi = l.Overlays.Pressed.Index;
                }
            }
            else if (state == EControlState.Disabled)
            {
                c = l.States.Disabled.Color;
                i = l.States.Disabled.Index;

                if (l.States.Disabled.Overlay)
                {
                    oc = l.Overlays.Disabled.Color;
                    oi = l.Overlays.Disabled.Index;
                }
            }
            else
            {
                c = l.States.Enabled.Color;
                i = l.States.Enabled.Index;

                if (l.States.Enabled.Overlay)
                {
                    oc = l.Overlays.Enabled.Color;
                    oi = l.Overlays.Enabled.Index;
                }
            }

            if (control.Color != Control.UndefinedColor)
            {
                c = control.Color * (control.Color.A / 255f);
            }
            DrawLayer(l, rect, c, i);

            if (oi != -1)
            {
                DrawLayer(l, rect, oc, oi);
            }
        }
Пример #5
0
        public virtual void DrawString(Control control, SkinLayer layer, string text, Rectangle rect, EControlState state, bool margins, int ox, int oy, bool ellipsis)
        {
            Color col = Color.White;

            if (layer.Text != null)
            {
                if (margins)
                {
                    Margins m = layer.ContentMargins;
                    rect = new Rectangle(rect.Left + m.Left, rect.Top + m.Top, rect.Width - m.Horizontal, rect.Height - m.Vertical);
                }

                if (state == EControlState.Hovered && (layer.States.Hovered.Index != -1))
                {
                    col = layer.Text.Colors.Hovered;
                }
                else if (state == EControlState.Pressed)
                {
                    col = layer.Text.Colors.Pressed;
                }
                else if (state == EControlState.Focused || (control.Focused && state == EControlState.Hovered && layer.States.Hovered.Index == -1))
                {
                    col = layer.Text.Colors.Focused;
                }
                else if (state == EControlState.Disabled)
                {
                    col = layer.Text.Colors.Disabled;
                }
                else
                {
                    col = layer.Text.Colors.Enabled;
                }

                if (text != null && text != "")
                {
                    SkinText font = layer.Text;
                    if (control.TextColor != Control.UndefinedColor && control.ControlState != EControlState.Disabled)
                    {
                        col = control.TextColor;
                    }
                    DrawString(font.Font.Resource, text, rect, col, font.Alignment, font.OffsetX + ox, font.OffsetY + oy, ellipsis);
                }
            }
        }
Пример #6
0
 public virtual void DrawString(Control control, SkinLayer layer, string text, Rectangle rect, EControlState state, bool margins, int ox, int oy)
 {
     DrawString(control, layer, text, rect, state, margins, ox, oy, true);
 }
Пример #7
0
 public virtual void DrawString(Control control, SkinLayer layer, string text, Rectangle rect, EControlState state)
 {
     DrawString(control, layer, text, rect, state, true, 0, 0, true);
 }