#if FRAMEWORK20
using System.Drawing;
using System.Drawing.Drawing2D;
using DevComponents.DotNetBar.Rendering;
namespace DevComponents.DotNetBar
{
public class VS2008DockSuperTabItem : SuperTabItemBaseDisplay
{
public VS2008DockSuperTabItem(SuperTabItem tabItem)
: base(tabItem)
{
}
#region TabItemPath
///
/// Creates the tab item GraphicsPath
///
/// Tab path
internal override GraphicsPath TabItemPath()
{
// Check to see if the user is supplying a path
GraphicsPath path = base.TabItemPath();
if (path != null)
return (path);
// Supply the default path based upon
// the current tab alignment
switch (TabItem.TabAlignment)
{
case eTabStripAlignment.Top:
return (TopTabPath());
case eTabStripAlignment.Bottom:
return (BottomTabPath());
case eTabStripAlignment.Left:
return (LeftTabPath());
default:
return (RightTabPath());
}
}
#region TopTabPath
///
/// Create the Top tab path
///
/// GraphicsPath
private GraphicsPath TopTabPath()
{
GraphicsPath path = new GraphicsPath();
Rectangle r = TabItem.DisplayRectangle;
r.Width -= 1;
r.Height -= 1;
// Allow for the TabStrip border
if (TabItem.IsSelected == true)
r.Height += 2;
// Create the path
path.AddLines(new Point[]
{
new Point(r.X, r.Bottom),
new Point(r.X, r.Top),
new Point(r.Right, r.Top),
new Point(r.Right, r.Bottom),
});
return (path);
}
#endregion
#region BottomTabPath
///
/// Creates the Bottom tab path
///
/// GraphicsPath
private GraphicsPath BottomTabPath()
{
GraphicsPath path = new GraphicsPath();
Rectangle r = TabItem.DisplayRectangle;
r.Width -= 1;
r.Height -= 1;
// Allow for the TabStrip border
if (TabItem.IsSelected == true)
{
r.Y -= 2;
r.Height += 2;
}
// Create the path
path.AddLines(new Point[]
{
new Point(r.Right, r.Top),
new Point(r.Right, r.Bottom),
new Point(r.X, r.Bottom),
new Point(r.X, r.Top),
});
return (path);
}
#endregion
#region LeftTabPath
///
/// Creates the Left tab path
///
/// GraphicsPath
private GraphicsPath LeftTabPath()
{
GraphicsPath path = new GraphicsPath();
Rectangle r = TabItem.DisplayRectangle;
r.Width -= 1;
r.Height -= 1;
// Allow for the TabStrip border
if (TabItem.IsSelected == true)
r.Width += 2;
// Create the tab path
path.AddLines(new Point[]
{
new Point(r.Right, r.Bottom),
new Point(r.X, r.Bottom),
new Point(r.X, r.Top),
new Point(r.Right, r.Top),
});
return (path);
}
#endregion
#region RightTabPath
///
/// Create the Right tab path
///
/// GraphicsPath
private GraphicsPath RightTabPath()
{
GraphicsPath path = new GraphicsPath();
Rectangle r = TabItem.DisplayRectangle;
r.Width -= 1;
r.Height -= 1;
// Allow for the TabStrip border
if (TabItem.IsSelected == true)
{
r.X -= 2;
r.Width += 2;
}
// Create the tab path
path.AddLines(new Point[]
{
new Point(r.X, r.Top),
new Point(r.Right, r.Top),
new Point(r.Right, r.Bottom),
new Point(r.X, r.Bottom),
});
return (path);
}
#endregion
#endregion
#region ApplyPredefinedColor
///
/// Applies the predefined tab color to the color table
///
///
///
internal override void ApplyPredefinedColor(eTabState tabState, SuperTabItemStateColorTable sct)
{
if (TabItem.PredefinedColor != eTabItemColor.Default)
{
SuperTabItemColorTable ct =
SuperTabStyleColorFactory.GetPredefinedTabColors(TabItem.PredefinedColor, ColorFactory.Empty);
SuperTabItemStateColorTable ict = ct.Default.Normal;
switch (tabState)
{
case eTabState.SelectedMouseOver:
ict = ct.Default.SelectedMouseOver;
break;
case eTabState.MouseOver:
ict = ct.Default.MouseOver;
break;
case eTabState.Selected:
ict = ct.Default.Selected;
ict.InnerBorder = Color.Empty;
break;
}
sct.InnerBorder = ict.InnerBorder;
sct.OuterBorder = ict.OuterBorder;
sct.Background = ict.Background;
}
}
#endregion
#region ApplyPredefinedColor
///
/// Applies the predefined color to the panel color table
///
///
internal override void ApplyPredefinedColor(SuperTabPanelItemColorTable pct)
{
if (TabItem.PredefinedColor != eTabItemColor.Default)
{
SuperTabPanelItemColorTable ct =
SuperTabStyleColorFactory.GetPredefinedPanelColors(TabItem.PredefinedColor, ColorFactory.Empty);
pct.Background = ct.Background;
pct.InnerBorder = pct.Background.Colors[pct.Background.Colors.Length - 1];
pct.OuterBorder = ct.OuterBorder;
}
}
#endregion
}
}
#endif