This repository has been archived on 2023-07-11. You can view files and clone it, but cannot push or open issues or pull requests.
gwen-dotnet/Gwen/Control/MenuStrip.cs
Gered 10e057953e initial commit
Contains changes from "gwen-dotnet" removing dependancies on Windows,
which ultimately means certain features (e.g. file load/save dialogs)
do not work. Those classes still exist, but the code has been commented
out.
2013-03-28 18:47:01 -04:00

79 lines
2.2 KiB
C#

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