using System;
namespace Gwen.Control
{
///
/// Menu strip.
///
public class MenuStrip : Menu
{
///
/// Initializes a new instance of the class.
///
/// Parent control.
public MenuStrip(Base parent)
: base(parent)
{
SetBounds(0, 0, 200, 22);
Dock = Pos.Top;
m_InnerPanel.Padding = new Padding(5, 0, 0, 0);
}
///
/// Closes the current menu.
///
public override void Close()
{
}
///
/// Renders under the actual control (shadows etc).
///
/// Skin to use.
protected override void RenderUnder(Skin.Base skin)
{
}
///
/// Renders the control using specified skin.
///
/// Skin to use.
protected override void Render(Skin.Base skin)
{
skin.DrawMenuStrip(this);
}
///
/// Lays out the control's interior according to alignment, padding, dock etc.
///
/// Skin to use.
protected override void Layout(Skin.Base skin)
{
//TODO: We don't want to do vertical sizing the same as Menu, do nothing for now
}
///
/// Determines whether the menu should open on mouse hover.
///
protected override bool ShouldHoverOpenMenu
{
get { return IsMenuOpen(); }
}
///
/// Add item handler.
///
/// Item added.
protected override void OnAddItem(MenuItem item)
{
item.Dock = Pos.Left;
item.TextPadding = new Padding(5, 0, 5, 0);
item.Padding = new Padding(10, 0, 10, 0);
item.SizeToContents();
item.IsOnStrip = true;
item.HoverEnter += OnHoverItem;
}
}
}