protected override void DrawControl(Renderer renderer, Rectangle rect, GameTime gameTime) { SkinLayer l1 = Skin.Layers["Control"]; SkinLayer l2 = Skin.Layers["Selection"]; rs = new Rectangle[Items.Count]; renderer.DrawLayer(this, l1, rect, EControlState.Enabled); int prev = l1.ContentMargins.Left; for (int i = 0; i < Items.Count; i++) { MenuItem mi = Items[i]; int tw = (int)l1.Text.Font.Resource.MeasureString(mi.Text).X + l1.ContentMargins.Horizontal; rs[i] = new Rectangle(rect.Left + prev, rect.Top + l1.ContentMargins.Top, tw, Height - l1.ContentMargins.Vertical); prev += tw; if (ItemIndex != i) { if (mi.Enabled && Enabled) { renderer.DrawString(this, l1, mi.Text, rs[i], EControlState.Enabled, false); } else { renderer.DrawString(this, l1, mi.Text, rs[i], EControlState.Disabled, false); } } else { if (Items[i].Enabled && Enabled) { renderer.DrawLayer(this, l2, rs[i], EControlState.Enabled); renderer.DrawString(this, l2, mi.Text, rs[i], EControlState.Enabled, false); } else { renderer.DrawLayer(this, l2, rs[i], EControlState.Disabled); renderer.DrawString(this, l2, mi.Text, rs[i], EControlState.Disabled, false); } } } }
protected override void DrawControl(Renderer renderer, Rectangle rect, GameTime gameTime) { SkinLayer l1 = Skin.Layers["Control"]; SkinLayer l2 = Skin.Layers["Header"]; Color col = this.Color != UndefinedColor ? this.Color : Color.White; Rectangle r1 = new Rectangle(rect.Left, rect.Top + l1.OffsetY, rect.Width, rect.Height - l1.OffsetY); if (tabPages.Count <= 0) { r1 = rect; } base.DrawControl(renderer, r1, gameTime); if (tabPages.Count > 0) { Rectangle prev = new Rectangle(rect.Left, rect.Top + l2.OffsetY, 0, l2.Height); for (int i = 0; i < tabPages.Count; i++) { SpriteFont font = l2.Text.Font.Resource; Margins margins = l2.ContentMargins; Point offset = new Point(l2.OffsetX, l2.OffsetY); if (i > 0) { prev = tabPages[i - 1].HeaderRect; } tabPages[i].CalcRect(prev, font, margins, offset, i == 0); } for (int i = tabPages.Count - 1; i >= 0; i--) { int li = tabPages[i].Enabled ? l2.States.Enabled.Index : l2.States.Disabled.Index; Color lc = tabPages[i].Enabled ? l2.Text.Colors.Enabled : l2.Text.Colors.Disabled; if (i == hoveredIndex) { li = l2.States.Hovered.Index; lc = l2.Text.Colors.Hovered; } Margins m = l2.ContentMargins; Rectangle rx = tabPages[i].HeaderRect; Rectangle sx = new Rectangle(rx.Left + m.Left, rx.Top + m.Top, rx.Width - m.Horizontal, rx.Height - m.Vertical); if (i != selectedIndex) { renderer.DrawLayer(l2, rx, col, li); renderer.DrawString(l2.Text.Font.Resource, tabPages[i].Text, sx, lc, l2.Text.Alignment); } } Margins mi = l2.ContentMargins; Rectangle ri = tabPages[selectedIndex].HeaderRect; Rectangle si = new Rectangle(ri.Left + mi.Left, ri.Top + mi.Top, ri.Width - mi.Horizontal, ri.Height - mi.Vertical); renderer.DrawLayer(l2, ri, col, l2.States.Focused.Index); renderer.DrawString(l2.Text.Font.Resource, tabPages[selectedIndex].Text, si, l2.Text.Colors.Focused, l2.Text.Alignment, l2.Text.OffsetX, l2.Text.OffsetY, false); } }
protected override void DrawControl(Renderer renderer, Rectangle rect, GameTime gameTime) { //base.DrawControl(renderer, rect, gameTime); SkinLayer s = new SkinLayer(Skin.Layers[0]); s.Text.Alignment = alignment; renderer.DrawString(this, s, Text, rect, true, 0, 0, ellipsis); }
protected override void DrawControl(Renderer renderer, Rectangle rect, GameTime gameTime) { SkinLayer l1 = Skin.Layers["Control"]; SkinLayer l2 = Skin.Layers["Selection"]; rs = new Rectangle[Items.Count]; renderer.DrawLayer(this, l1, rect, EControlState.Enabled); int prev = l1.ContentMargins.Left; for (int i = 0; i < Items.Count; i++) { MenuItem mi = Items[i]; int tw = (int)l1.Text.Font.Resource.MeasureString(mi.Text).X + l1.ContentMargins.Horizontal; rs[i] = new Rectangle(rect.Left + prev, rect.Top + l1.ContentMargins.Top, tw, Height - l1.ContentMargins.Vertical); prev += tw; if (ItemIndex != i) { if (mi.Enabled && Enabled) { renderer.DrawString(this, l1, mi.Text, rs[i], EControlState.Enabled, false); } else { renderer.DrawString(this, l1, mi.Text, rs[i], EControlState.Disabled, false); } } else { if (Items[i].Enabled && Enabled) { renderer.DrawLayer(this, l2, rs[i], EControlState.Enabled); renderer.DrawString(this, l2, mi.Text, rs[i], EControlState.Enabled, false); } else { renderer.DrawLayer(this, l2, rs[i], EControlState.Disabled); renderer.DrawString(this, l2, mi.Text, rs[i], EControlState.Disabled, false); } } } }
protected override void DrawControl(Renderer renderer, Rectangle rect, GameTime gameTime) { //base.DrawControl(renderer, rect, gameTime); SkinLayer s = new SkinLayer(Skin.Layers[0]); s.Text.Alignment = alignment; renderer.DrawString(this, s, Text, rect, true, 0, 0, ellipsis); }
protected override void DrawControl(Renderer renderer, Rectangle rect, GameTime gameTime) { SkinLayer layer = Skin.Layers["Control"]; SpriteFont font = (layer.Text != null && layer.Text.Font != null) ? layer.Text.Font.Resource : null; Color col = (layer.Text != null) ? layer.Text.Colors.Enabled : Color.White; Point offset = new Point(layer.Text.OffsetX, layer.Text.OffsetY); renderer.DrawLayer(this, layer, rect); if (font != null && Text != null && Text != "") { renderer.DrawString(this, layer, Text, new Rectangle(rect.Left, rect.Top + layer.ContentMargins.Top, rect.Width, Skin.ClientMargins.Top - layer.ContentMargins.Horizontal), false, offset.X, offset.Y, false); } }
protected override void DrawControl(Renderer renderer, Rectangle rect, GameTime gameTime) { SkinLayer layer = Skin.Layers["Control"]; SpriteFont font = (layer.Text != null && layer.Text.Font != null) ? layer.Text.Font.Resource : null; Color col = (layer.Text != null) ? layer.Text.Colors.Enabled : Color.White; Point offset = new Point(layer.Text.OffsetX, layer.Text.OffsetY); renderer.DrawLayer(this, layer, rect); if (font != null && Text != null && Text != "") { renderer.DrawString(this, layer, Text, new Rectangle(rect.Left, rect.Top + layer.ContentMargins.Top, rect.Width, Skin.ClientMargins.Top - layer.ContentMargins.Horizontal), false, offset.X, offset.Y, false); } }
protected override void DrawControl(Renderer renderer, Rectangle rect, GameTime gameTime) { SkinLayer layer = Skin.Layers[lrChecked]; SkinText font = Skin.Layers[lrChecked].Text; if (!state) { layer = Skin.Layers[lrCheckBox]; font = Skin.Layers[lrCheckBox].Text; } rect.Width = layer.Width; rect.Height = layer.Height; Rectangle rc = new Rectangle(rect.Left + rect.Width + 4, rect.Y, Width - (layer.Width + 4), rect.Height); renderer.DrawLayer(this, layer, rect); renderer.DrawString(this, layer, Text, rc, false, 0, 0); }
protected override void DrawControl(Renderer renderer, Rectangle rect, GameTime gameTime) { SkinLayer layer = type == EGroupBoxType.Normal ? Skin.Layers["Control"] : Skin.Layers["Flat"]; SpriteFont font = (layer.Text != null && layer.Text.Font != null) ? layer.Text.Font.Resource : null; Color col = (layer.Text != null) ? layer.Text.Colors.Enabled : Color.White; Point offset = new Point(layer.Text.OffsetX, layer.Text.OffsetY); Vector2 size = font.MeasureString(Text); size.Y = font.LineSpacing; Rectangle r = new Rectangle(rect.Left, rect.Top + (int)(size.Y / 2), rect.Width, rect.Height - (int)(size.Y / 2)); renderer.DrawLayer(this, layer, r); if (font != null && Text != null && Text != "") { Rectangle bg = new Rectangle(r.Left + offset.X, (r.Top - (int)(size.Y / 2)) + offset.Y, (int)size.X + layer.ContentMargins.Horizontal, (int)size.Y); renderer.DrawLayer(Manager.Skin.Controls["Control"].Layers[0], bg, new Color(64, 64, 64), 0); renderer.DrawString(this, layer, Text, new Rectangle(r.Left, r.Top - (int)(size.Y / 2), (int)(size.X), (int)size.Y), true, 0, 0, false); } }
protected override void DrawControl(Renderer renderer, Rectangle rect, GameTime gameTime) { if (mode == EButtonMode.PushButton && pushed) { SkinLayer l = Skin.Layers[lrButton]; renderer.DrawLayer(l, rect, l.States.Pressed.Color, l.States.Pressed.Index); if (l.States.Pressed.Overlay) { renderer.DrawLayer(l, rect, l.Overlays.Pressed.Color, l.Overlays.Pressed.Index); } } else { base.DrawControl(renderer, rect, gameTime); } SkinLayer layer = Skin.Layers[lrButton]; SpriteFont font = (layer.Text != null && layer.Text.Font != null) ? layer.Text.Font.Resource : null; Color col = Color.White; int ox = 0; int oy = 0; if (ControlState == EControlState.Pressed) { if (layer.Text != null) { col = layer.Text.Colors.Pressed; } ox = 1; oy = 1; } if (glyph != null) { Margins cont = layer.ContentMargins; Rectangle r = new Rectangle(rect.Left + cont.Left, rect.Top + cont.Top, rect.Width - cont.Horizontal, rect.Height - cont.Vertical); renderer.DrawGlyph(glyph, r); } else { renderer.DrawString(this, layer, Text, rect, true, ox, oy); } }
protected override void DrawControl(Renderer renderer, Rectangle rect, GameTime gameTime) { SkinLayer layer = Skin.Layers[lrChecked]; SkinText font = Skin.Layers[lrChecked].Text; if (!state) { layer = Skin.Layers[lrCheckBox]; font = Skin.Layers[lrCheckBox].Text; } rect.Width = layer.Width; rect.Height = layer.Height; Rectangle rc = new Rectangle(rect.Left + rect.Width + 4, rect.Y, Width - (layer.Width + 4), rect.Height); renderer.DrawLayer(this, layer, rect); renderer.DrawString(this, layer, Text, rc, false, 0, 0); }
protected override void DrawControl(Renderer renderer, Rectangle rect, GameTime gameTime) { SkinLayer layer = type == EGroupBoxType.Normal ? Skin.Layers["Control"] : Skin.Layers["Flat"]; SpriteFont font = (layer.Text != null && layer.Text.Font != null) ? layer.Text.Font.Resource : null; Color col = (layer.Text != null) ? layer.Text.Colors.Enabled : Color.White; Point offset = new Point(layer.Text.OffsetX, layer.Text.OffsetY); Vector2 size = font.MeasureString(Text); size.Y = font.LineSpacing; Rectangle r = new Rectangle(rect.Left, rect.Top + (int)(size.Y / 2), rect.Width, rect.Height - (int)(size.Y / 2)); renderer.DrawLayer(this, layer, r); if (font != null && Text != null && Text != "") { Rectangle bg = new Rectangle(r.Left + offset.X, (r.Top - (int)(size.Y / 2)) + offset.Y, (int)size.X + layer.ContentMargins.Horizontal, (int)size.Y); renderer.DrawLayer(Manager.Skin.Controls["Control"].Layers[0], bg, new Color(64, 64, 64), 0); renderer.DrawString(this, layer, Text, new Rectangle(r.Left, r.Top - (int)(size.Y / 2), (int)(size.X), (int)size.Y), true, 0, 0, false); } }
protected override void DrawControl(Renderer renderer, Rectangle rect, GameTime gameTime) { base.DrawControl(renderer, rect, gameTime); SkinLayer l1 = Skin.Layers["Control"]; SkinLayer l2 = Skin.Layers["Selection"]; int vsize = LineHeight(); Color col = Color.White; for (int i = 0; i < Items.Count; i++) { int mod = i > 0 ? 2 : 0; int left = rect.Left + l1.ContentMargins.Left + vsize; int h = vsize - mod - (i < (Items.Count - 1) ? 1 : 0); int top = rect.Top + l1.ContentMargins.Top + (i * vsize) + mod; if (Items[i].Separated && i > 0) { Rectangle r = new Rectangle(left, rect.Top + l1.ContentMargins.Top + (i * vsize), LineWidth() - vsize + 4, 1); renderer.Draw(Manager.Skin.Controls["Control"].Layers[0].Image.Resource, r, l1.Text.Colors.Enabled); } if (ItemIndex != i) { if (Items[i].Enabled) { Rectangle r = new Rectangle(left, top, LineWidth() - vsize, h); renderer.DrawString(this, l1, Items[i].Text, r, false); col = l1.Text.Colors.Enabled; } else { Rectangle r = new Rectangle(left + l1.Text.OffsetX, top + l1.Text.OffsetY, LineWidth() - vsize, h); renderer.DrawString(l1.Text.Font.Resource, Items[i].Text, r, l1.Text.Colors.Disabled, l1.Text.Alignment); col = l1.Text.Colors.Disabled; } } else { if (Items[i].Enabled) { Rectangle rs = new Rectangle(rect.Left + l1.ContentMargins.Left, top, Width - (l1.ContentMargins.Horizontal - Skin.OriginMargins.Horizontal), h); renderer.DrawLayer(this, l2, rs); Rectangle r = new Rectangle(left, top, LineWidth() - vsize, h); renderer.DrawString(this, l2, Items[i].Text, r, false); col = l2.Text.Colors.Enabled; } else { Rectangle rs = new Rectangle(rect.Left + l1.ContentMargins.Left, top, Width - (l1.ContentMargins.Horizontal - Skin.OriginMargins.Horizontal), vsize); renderer.DrawLayer(l2, rs, l2.States.Disabled.Color, l2.States.Disabled.Index); Rectangle r = new Rectangle(left + l1.Text.OffsetX, top + l1.Text.OffsetY, LineWidth() - vsize, h); renderer.DrawString(l2.Text.Font.Resource, Items[i].Text, r, l2.Text.Colors.Disabled, l2.Text.Alignment); col = l2.Text.Colors.Disabled; } } if (Items[i].Image != null) { Rectangle r = new Rectangle(rect.Left + l1.ContentMargins.Left + 3, rect.Top + top + 3, LineHeight() - 6, LineHeight() - 6); renderer.Draw(Items[i].Image, r, Color.White); } if (Items[i].Items != null && Items[i].Items.Count > 0) { renderer.Draw(Manager.Skin.Images["Shared.ArrowRight"].Resource, rect.Left + LineWidth() - 4, rect.Top + l1.ContentMargins.Top + (i * vsize) + 8, col); } } }
protected override void DrawControl(Renderer renderer, Rectangle rect, GameTime gameTime) { SkinLayer l1 = captionVisible ? Skin.Layers[lrCaption] : Skin.Layers[lrFrameTop]; SkinLayer l2 = Skin.Layers[lrFrameLeft]; SkinLayer l3 = Skin.Layers[lrFrameRight]; SkinLayer l4 = Skin.Layers[lrFrameBottom]; SkinLayer l5 = Skin.Layers[lrIcon]; LayerStates s1, s2, s3, s4; SpriteFont f1 = l1.Text.Font.Resource; Color c1 = l1.Text.Colors.Enabled; if ((Focused || (Manager.FocusedControl != null && Manager.FocusedControl.Root == this.Root)) && ControlState != EControlState.Disabled) { s1 = l1.States.Focused; s2 = l2.States.Focused; s3 = l3.States.Focused; s4 = l4.States.Focused; c1 = l1.Text.Colors.Focused; } else if (ControlState == EControlState.Disabled) { s1 = l1.States.Disabled; s2 = l2.States.Disabled; s3 = l3.States.Disabled; s4 = l4.States.Disabled; c1 = l1.Text.Colors.Disabled; } else { s1 = l1.States.Enabled; s2 = l2.States.Enabled; s3 = l3.States.Enabled; s4 = l4.States.Enabled; c1 = l1.Text.Colors.Enabled; } renderer.DrawLayer(Skin.Layers[lrWindow], rect, Skin.Layers[lrWindow].States.Enabled.Color, Skin.Layers[lrWindow].States.Enabled.Index); if (borderVisible) { renderer.DrawLayer(l1, new Rectangle(rect.Left, rect.Top, rect.Width, l1.Height), s1.Color, s1.Index); renderer.DrawLayer(l2, new Rectangle(rect.Left, rect.Top + l1.Height, l2.Width, rect.Height - l1.Height - l4.Height), s2.Color, s2.Index); renderer.DrawLayer(l3, new Rectangle(rect.Right - l3.Width, rect.Top + l1.Height, l3.Width, rect.Height - l1.Height - l4.Height), s3.Color, s3.Index); renderer.DrawLayer(l4, new Rectangle(rect.Left, rect.Bottom - l4.Height, rect.Width, l4.Height), s4.Color, s4.Index); if (iconVisible && (icon != null || l5 != null) && captionVisible) { Texture2D i = (icon != null) ? icon : l5.Image.Resource; renderer.Draw(i, GetIconRect(), Color.White); } int icosize = 0; if (l5 != null && iconVisible && captionVisible) { icosize = l1.Height - l1.ContentMargins.Vertical + 4 + l5.OffsetX; } int closesize = 0; if (btnClose.Visible) { closesize = btnClose.Width - (btnClose.Skin.Layers[lrButton].OffsetX); } Rectangle r = new Rectangle(rect.Left + l1.ContentMargins.Left + icosize, rect.Top + l1.ContentMargins.Top, rect.Width - l1.ContentMargins.Horizontal - closesize - icosize, l1.Height - l1.ContentMargins.Top - l1.ContentMargins.Bottom); int ox = l1.Text.OffsetX; int oy = l1.Text.OffsetY; renderer.DrawString(f1, Text, r, c1, l1.Text.Alignment, ox, oy, true); } }
void ClientArea_Draw(object sender, DrawEventArgs e) { SkinLayer layer = Skin.Layers[lrTextBox]; Color col = Skin.Layers[lrTextBox].Text.Colors.Enabled; SkinLayer cursor = Skin.Layers[lrCursor]; EAlignment al = mode == ETextBoxMode.Multiline ? EAlignment.TopLeft : EAlignment.MiddleLeft; Renderer renderer = e.Renderer; Rectangle r = e.Rectangle; bool drawsel = !selection.IsEmpty; string tmpText = ""; font = (Skin.Layers[lrTextBox].Text != null) ? Skin.Layers[lrTextBox].Text.Font.Resource : null; if (Text != null && font != null) { DeterminePages(); if (mode == ETextBoxMode.Multiline) { shownText = Text; tmpText = Lines[PosY]; } else if (mode == ETextBoxMode.Password) { shownText = ""; for (int i = 0; i < Text.Length; i++) { shownText = shownText + passwordChar; } tmpText = shownText; } else { shownText = Text; tmpText = Lines[PosY]; } if (TextColor != UndefinedColor && ControlState != EControlState.Disabled) { col = TextColor; } if (mode != ETextBoxMode.Multiline) { linesDrawn = 0; vert.Value = 0; } if (drawsel) { DrawSelection(e.Renderer, r); /* * renderer.End(); * renderer.SpriteBatch.Begin(SpriteBlendMode.AlphaBlend, SpriteSortMode.Immediate, SaveStateMode.None); * renderer.SpriteBatch.GraphicsDevice.RenderState.SeparateAlphaBlendEnabled = true; * renderer.SpriteBatch.GraphicsDevice.RenderState.SourceBlend = Blend.DestinationColor; * renderer.SpriteBatch.GraphicsDevice.RenderState.DestinationBlend = Blend.SourceColor; * renderer.SpriteBatch.GraphicsDevice.RenderState.BlendFunction = BlendFunction.Subtract; * //renderer.SpriteBatch.GraphicsDevice.RenderState.AlphaFunction = CompareFunction.Equal; * //renderer.SpriteBatch.GraphicsDevice.RenderState.AlphaSourceBlend = Blend.One; * //renderer.SpriteBatch.GraphicsDevice.RenderState.AlphaDestinationBlend = Blend.DestinationAlpha; */ } int sizey = (int)font.LineSpacing; if (showCursor && caretVisible) { Vector2 size = Vector2.Zero; if (PosX > 0 && PosX <= tmpText.Length) { size = font.MeasureString(tmpText.Substring(0, PosX)); } if (size.Y == 0) { size = font.MeasureString(" "); size.X = 0; } int m = r.Height - font.LineSpacing; Rectangle rc = new Rectangle(r.Left - horz.Value + (int)size.X, r.Top + m / 2, cursor.Width, font.LineSpacing); if (mode == ETextBoxMode.Multiline) { rc = new Rectangle(r.Left + (int)size.X - horz.Value, r.Top + (int)((PosY - vert.Value) * font.LineSpacing), cursor.Width, font.LineSpacing); } cursor.Alignment = al; renderer.DrawLayer(cursor, rc, col, 0); } for (int i = 0; i < linesDrawn + 1; i++) { int ii = i + vert.Value; if (ii >= Lines.Count || ii < 0) { break; } if (Lines[ii] != "") { if (mode == ETextBoxMode.Multiline) { renderer.DrawString(font, Lines[ii], r.Left - horz.Value, r.Top + (i * sizey), col); } else { Rectangle rx = new Rectangle(r.Left - horz.Value, r.Top, r.Width, r.Height); renderer.DrawString(font, shownText, rx, col, al, false); } } } /* if (drawsel) * { * renderer.End(); * renderer.Begin(BlendingMode.Premultiplied); * }*/ } }
protected override void DrawControl(Renderer renderer, Rectangle rect, GameTime gameTime) { SkinLayer l1 = captionVisible ? Skin.Layers[lrCaption] : Skin.Layers[lrFrameTop]; SkinLayer l2 = Skin.Layers[lrFrameLeft]; SkinLayer l3 = Skin.Layers[lrFrameRight]; SkinLayer l4 = Skin.Layers[lrFrameBottom]; SkinLayer l5 = Skin.Layers[lrIcon]; LayerStates s1, s2, s3, s4; SpriteFont f1 = l1.Text.Font.Resource; Color c1 = l1.Text.Colors.Enabled; if ((Focused || (Manager.FocusedControl != null && Manager.FocusedControl.Root == this.Root)) && ControlState != EControlState.Disabled) { s1 = l1.States.Focused; s2 = l2.States.Focused; s3 = l3.States.Focused; s4 = l4.States.Focused; c1 = l1.Text.Colors.Focused; } else if (ControlState == EControlState.Disabled) { s1 = l1.States.Disabled; s2 = l2.States.Disabled; s3 = l3.States.Disabled; s4 = l4.States.Disabled; c1 = l1.Text.Colors.Disabled; } else { s1 = l1.States.Enabled; s2 = l2.States.Enabled; s3 = l3.States.Enabled; s4 = l4.States.Enabled; c1 = l1.Text.Colors.Enabled; } renderer.DrawLayer(Skin.Layers[lrWindow], rect, Skin.Layers[lrWindow].States.Enabled.Color, Skin.Layers[lrWindow].States.Enabled.Index); if (borderVisible) { renderer.DrawLayer(l1, new Rectangle(rect.Left, rect.Top, rect.Width, l1.Height), s1.Color, s1.Index); renderer.DrawLayer(l2, new Rectangle(rect.Left, rect.Top + l1.Height, l2.Width, rect.Height - l1.Height - l4.Height), s2.Color, s2.Index); renderer.DrawLayer(l3, new Rectangle(rect.Right - l3.Width, rect.Top + l1.Height, l3.Width, rect.Height - l1.Height - l4.Height), s3.Color, s3.Index); renderer.DrawLayer(l4, new Rectangle(rect.Left, rect.Bottom - l4.Height, rect.Width, l4.Height), s4.Color, s4.Index); if (iconVisible && (icon != null || l5 != null) && captionVisible) { Texture2D i = (icon != null) ? icon : l5.Image.Resource; renderer.Draw(i, GetIconRect(), Color.White); } int icosize = 0; if (l5 != null && iconVisible && captionVisible) { icosize = l1.Height - l1.ContentMargins.Vertical + 4 + l5.OffsetX; } int closesize = 0; if (btnClose.Visible) { closesize = btnClose.Width - (btnClose.Skin.Layers[lrButton].OffsetX); } Rectangle r = new Rectangle(rect.Left + l1.ContentMargins.Left + icosize, rect.Top + l1.ContentMargins.Top, rect.Width - l1.ContentMargins.Horizontal - closesize - icosize, l1.Height - l1.ContentMargins.Top - l1.ContentMargins.Bottom); int ox = l1.Text.OffsetX; int oy = l1.Text.OffsetY; renderer.DrawString(f1, Text, r, c1, l1.Text.Alignment, ox, oy, true); } }
protected override void DrawControl(Renderer renderer, Rectangle rect, GameTime gameTime) { renderer.DrawLayer(this, Skin.Layers[0], rect); renderer.DrawString(this, Skin.Layers[0], Text, rect, true); }
protected override void DrawControl(Renderer renderer, Rectangle rect, GameTime gameTime) { SkinLayer l1 = Skin.Layers["Control"]; SkinLayer l2 = Skin.Layers["Header"]; Color col = this.Color != UndefinedColor ? this.Color : Color.White; Rectangle r1 = new Rectangle(rect.Left, rect.Top + l1.OffsetY, rect.Width, rect.Height - l1.OffsetY); if (tabPages.Count <= 0) { r1 = rect; } base.DrawControl(renderer, r1, gameTime); if (tabPages.Count > 0) { Rectangle prev = new Rectangle(rect.Left, rect.Top + l2.OffsetY, 0, l2.Height); for (int i = 0; i < tabPages.Count; i++) { SpriteFont font = l2.Text.Font.Resource; Margins margins = l2.ContentMargins; Point offset = new Point(l2.OffsetX, l2.OffsetY); if (i > 0) prev = tabPages[i - 1].HeaderRect; tabPages[i].CalcRect(prev, font, margins, offset, i == 0); } for (int i = tabPages.Count - 1; i >= 0; i--) { int li = tabPages[i].Enabled ? l2.States.Enabled.Index : l2.States.Disabled.Index; Color lc = tabPages[i].Enabled ? l2.Text.Colors.Enabled : l2.Text.Colors.Disabled; if (i == hoveredIndex) { li = l2.States.Hovered.Index; lc = l2.Text.Colors.Hovered; } Margins m = l2.ContentMargins; Rectangle rx = tabPages[i].HeaderRect; Rectangle sx = new Rectangle(rx.Left + m.Left, rx.Top + m.Top, rx.Width - m.Horizontal, rx.Height - m.Vertical); if (i != selectedIndex) { renderer.DrawLayer(l2, rx, col, li); renderer.DrawString(l2.Text.Font.Resource, tabPages[i].Text, sx, lc, l2.Text.Alignment); } } Margins mi = l2.ContentMargins; Rectangle ri = tabPages[selectedIndex].HeaderRect; Rectangle si = new Rectangle(ri.Left + mi.Left, ri.Top + mi.Top, ri.Width - mi.Horizontal, ri.Height - mi.Vertical); renderer.DrawLayer(l2, ri, col, l2.States.Focused.Index); renderer.DrawString(l2.Text.Font.Resource, tabPages[selectedIndex].Text, si, l2.Text.Colors.Focused, l2.Text.Alignment, l2.Text.OffsetX, l2.Text.OffsetY, false); } }
protected override void DrawControl(Renderer renderer, Rectangle rect, GameTime gameTime) { if (mode == EButtonMode.PushButton && pushed) { SkinLayer l = Skin.Layers[lrButton]; renderer.DrawLayer(l, rect, l.States.Pressed.Color, l.States.Pressed.Index); if (l.States.Pressed.Overlay) { renderer.DrawLayer(l, rect, l.Overlays.Pressed.Color, l.Overlays.Pressed.Index); } } else { base.DrawControl(renderer, rect, gameTime); } SkinLayer layer = Skin.Layers[lrButton]; SpriteFont font = (layer.Text != null && layer.Text.Font != null) ? layer.Text.Font.Resource : null; Color col = Color.White; int ox = 0; int oy = 0; if (ControlState == EControlState.Pressed) { if (layer.Text != null) col = layer.Text.Colors.Pressed; ox = 1; oy = 1; } if (glyph != null) { Margins cont = layer.ContentMargins; Rectangle r = new Rectangle(rect.Left + cont.Left, rect.Top + cont.Top, rect.Width - cont.Horizontal, rect.Height - cont.Vertical); renderer.DrawGlyph(glyph, r); } else { renderer.DrawString(this, layer, Text, rect, true, ox, oy); } }
protected override void DrawControl(Renderer renderer, Rectangle rect, GameTime gameTime) { base.DrawControl(renderer, rect, gameTime); SkinLayer l1 = Skin.Layers["Control"]; SkinLayer l2 = Skin.Layers["Selection"]; int vsize = LineHeight(); Color col = Color.White; for (int i = 0; i < Items.Count; i++) { int mod = i > 0 ? 2 : 0; int left = rect.Left + l1.ContentMargins.Left + vsize; int h = vsize - mod - (i < (Items.Count - 1) ? 1 : 0); int top = rect.Top + l1.ContentMargins.Top + (i * vsize) + mod; if (Items[i].Separated && i > 0) { Rectangle r = new Rectangle(left, rect.Top + l1.ContentMargins.Top + (i * vsize), LineWidth() - vsize + 4, 1); renderer.Draw(Manager.Skin.Controls["Control"].Layers[0].Image.Resource, r, l1.Text.Colors.Enabled); } if (ItemIndex != i) { if (Items[i].Enabled) { Rectangle r = new Rectangle(left, top, LineWidth() - vsize, h); renderer.DrawString(this, l1, Items[i].Text, r, false); col = l1.Text.Colors.Enabled; } else { Rectangle r = new Rectangle(left + l1.Text.OffsetX, top + l1.Text.OffsetY, LineWidth() - vsize, h); renderer.DrawString(l1.Text.Font.Resource, Items[i].Text, r, l1.Text.Colors.Disabled, l1.Text.Alignment); col = l1.Text.Colors.Disabled; } } else { if (Items[i].Enabled) { Rectangle rs = new Rectangle(rect.Left + l1.ContentMargins.Left, top, Width - (l1.ContentMargins.Horizontal - Skin.OriginMargins.Horizontal), h); renderer.DrawLayer(this, l2, rs); Rectangle r = new Rectangle(left, top, LineWidth() - vsize, h); renderer.DrawString(this, l2, Items[i].Text, r, false); col = l2.Text.Colors.Enabled; } else { Rectangle rs = new Rectangle(rect.Left + l1.ContentMargins.Left, top, Width - (l1.ContentMargins.Horizontal - Skin.OriginMargins.Horizontal), vsize); renderer.DrawLayer(l2, rs, l2.States.Disabled.Color, l2.States.Disabled.Index); Rectangle r = new Rectangle(left + l1.Text.OffsetX, top + l1.Text.OffsetY, LineWidth() - vsize, h); renderer.DrawString(l2.Text.Font.Resource, Items[i].Text, r, l2.Text.Colors.Disabled, l2.Text.Alignment); col = l2.Text.Colors.Disabled; } } if (Items[i].Image != null) { Rectangle r = new Rectangle(rect.Left + l1.ContentMargins.Left + 3, rect.Top + top + 3, LineHeight() - 6, LineHeight() - 6); renderer.Draw(Items[i].Image, r, Color.White); } if (Items[i].Items != null && Items[i].Items.Count > 0) { renderer.Draw(Manager.Skin.Images["Shared.ArrowRight"].Resource, rect.Left + LineWidth() - 4, rect.Top + l1.ContentMargins.Top + (i * vsize) + 8, col); } } }
protected override void DrawControl(Renderer renderer, Rectangle rect, GameTime gameTime) { renderer.DrawLayer(this, Skin.Layers[0], rect); renderer.DrawString(this, Skin.Layers[0], Text, rect, true); }