Example #1
0
        internal override void Render(Renderer renderer, GameTime gameTime)
        {
            if (Visible && Shadow)
            {
                SkinControl c = Manager.Skin.Controls[skShadow];
                SkinLayer   l = c.Layers[lrShadow];

                Color cl = Color.FromNonPremultiplied(l.States.Enabled.Color.R, l.States.Enabled.Color.G, l.States.Enabled.Color.B, Alpha);

                renderer.Begin(EBlendingMode.Default);
                renderer.DrawLayer(l, new Rectangle(Left - c.OriginMargins.Left, Top - c.OriginMargins.Top, Width + c.OriginMargins.Horizontal, Height + c.OriginMargins.Vertical), cl, 0);
                renderer.End();
            }
            base.Render(renderer, gameTime);
        }
Example #2
0
		internal override void Render(Renderer renderer, GameTime gameTime) {
			if (Visible && Shadow) {
				SkinControl c = Manager.Skin.Controls[skShadow];
				SkinLayer l = c.Layers[lrShadow];

				Color cl = Color.FromNonPremultiplied(l.States.Enabled.Color.R, l.States.Enabled.Color.G, l.States.Enabled.Color.B, Alpha);

				renderer.Begin(EBlendingMode.Default);
				renderer.DrawLayer(l, new Rectangle(Left - c.OriginMargins.Left, Top - c.OriginMargins.Top, Width + c.OriginMargins.Horizontal, Height + c.OriginMargins.Vertical), cl, 0);
				renderer.End();
			}
			base.Render(renderer, gameTime);
		}
Example #3
0
		private void DrawOutline(Renderer renderer, bool child) {
			if (!OutlineRect.IsEmpty) {
				Rectangle r = OutlineRect;
				if (child) {
					r = new Rectangle(OutlineRect.Left + (parent.AbsoluteLeft - root.AbsoluteLeft), OutlineRect.Top + (parent.AbsoluteTop - root.AbsoluteTop), OutlineRect.Width, OutlineRect.Height);
				}

				Texture2D t = Manager.Skin.Controls["Control.Outline"].Layers[0].Image.Resource;

				int s = resizerSize;
				Rectangle r1 = new Rectangle(r.Left + leftModifier, r.Top + topModifier, r.Width, s);
				Rectangle r2 = new Rectangle(r.Left + leftModifier, r.Top + s + topModifier, resizerSize, r.Height - (2 * s));
				Rectangle r3 = new Rectangle(r.Right - s + leftModifier, r.Top + s + topModifier, s, r.Height - (2 * s));
				Rectangle r4 = new Rectangle(r.Left + leftModifier, r.Bottom - s + topModifier, r.Width, s);

				Color c = Manager.Skin.Controls["Control.Outline"].Layers[0].States.Enabled.Color;

				renderer.Begin(EBlendingMode.Default);
				if ((ResizeEdge & EAnchors.Top) == EAnchors.Top || !partialOutline)
					renderer.Draw(t, r1, c);
				if ((ResizeEdge & EAnchors.Left) == EAnchors.Left || !partialOutline)
					renderer.Draw(t, r2, c);
				if ((ResizeEdge & EAnchors.Right) == EAnchors.Right || !partialOutline)
					renderer.Draw(t, r3, c);
				if ((ResizeEdge & EAnchors.Bottom) == EAnchors.Bottom || !partialOutline)
					renderer.Draw(t, r4, c);
				renderer.End();
			} else if (DesignMode && Focused) {
				Rectangle r = ControlRect;
				if (child) {
					r = new Rectangle(r.Left + (parent.AbsoluteLeft - root.AbsoluteLeft), r.Top + (parent.AbsoluteTop - root.AbsoluteTop), r.Width, r.Height);
				}

				Texture2D t = Manager.Skin.Controls["Control.Outline"].Layers[0].Image.Resource;

				int s = resizerSize;
				Rectangle r1 = new Rectangle(r.Left + leftModifier, r.Top + topModifier, r.Width, s);
				Rectangle r2 = new Rectangle(r.Left + leftModifier, r.Top + s + topModifier, resizerSize, r.Height - (2 * s));
				Rectangle r3 = new Rectangle(r.Right - s + leftModifier, r.Top + s + topModifier, s, r.Height - (2 * s));
				Rectangle r4 = new Rectangle(r.Left + leftModifier, r.Bottom - s + topModifier, r.Width, s);

				Color c = Manager.Skin.Controls["Control.Outline"].Layers[0].States.Enabled.Color;

				renderer.Begin(EBlendingMode.Default);
				renderer.Draw(t, r1, c);
				renderer.Draw(t, r2, c);
				renderer.Draw(t, r3, c);
				renderer.Draw(t, r4, c);
				renderer.End();
			}
		}
Example #4
0
		internal virtual void Render(Renderer renderer, GameTime gameTime) {
			if (visible && target != null) {
				bool draw = true;

				if (draw) {
					renderer.Begin(EBlendingMode.Default);
					renderer.Draw(target, OriginLeft, OriginTop, new Rectangle(0, 0, OriginWidth, OriginHeight), Color.FromNonPremultiplied(255, 255, 255, Alpha));
					renderer.End();

					DrawDetached(this, renderer, gameTime);

					DrawOutline(renderer, false);
				}
			}
		}
Example #5
0
		private void DrawControls(Renderer renderer, Rectangle rect, GameTime gameTime, bool firstDetach) {
			renderer.Begin(EBlendingMode.Default);

			DrawingRect = rect;
			DrawControl(renderer, rect, gameTime);

			DrawEventArgs args = new DrawEventArgs();
			args.Rectangle = rect;
			args.Renderer = renderer;
			args.GameTime = gameTime;
			OnDraw(args);

			renderer.End();

			DrawChildControls(renderer, gameTime, firstDetach);
		}
Example #6
0
		private void DrawChildControls(Renderer renderer, GameTime gameTime, bool firstDetachedLevel) {
			if (controls != null) {
				foreach (Control c in controls) {
					// We skip detached controls for first level after root (they are rendered separately in Draw() method)
					if (((c.Root == c.Parent && !c.Detached) || c.Root != c.Parent) && AbsoluteRect.Intersects(c.AbsoluteRect) && c.visible) {
						Manager.GraphicsDevice.ScissorRectangle = GetClippingRect(c);

						Rectangle rect = new Rectangle(c.OriginLeft - root.AbsoluteLeft, c.OriginTop - root.AbsoluteTop, c.OriginWidth, c.OriginHeight);
						if (c.Root != c.Parent && ((!c.Detached && CheckDetached(c)) || firstDetachedLevel)) {
							rect = new Rectangle(c.OriginLeft, c.OriginTop, c.OriginWidth, c.OriginHeight);
							Manager.GraphicsDevice.ScissorRectangle = rect;
						}

						renderer.Begin(EBlendingMode.Default);
						c.DrawingRect = rect;
						c.DrawControl(renderer, rect, gameTime);

						DrawEventArgs args = new DrawEventArgs();
						args.Rectangle = rect;
						args.Renderer = renderer;
						args.GameTime = gameTime;
						c.OnDraw(args);
						renderer.End();

						c.DrawChildControls(renderer, gameTime, firstDetachedLevel);

						c.DrawOutline(renderer, true);
					}
				}
			}
		}