// Copyright Epic Games, Inc. All Rights Reserved. using System; using System.Collections.Generic; using System.Text; using System.Windows.Forms; using System.Drawing; using System.ComponentModel; namespace UnrealControls { /// /// A VS.NET style tab page. /// public class DynamicTabPage : UserControl { Brush mTabForeColorBrush = SystemBrushes.ControlText; Brush mTabBackgroundColorBrush = SystemBrushes.Window; EventHandler mTabSelected; EventHandler mTabDeselected; /// /// Event for when the tab has been selected. /// public event EventHandler TabSelected { add { mTabSelected += value; } remove { mTabSelected -= value; } } /// /// Event for when the tab has been deselected. /// public event EventHandler TabDeselected { add { mTabDeselected += value; } remove { mTabDeselected -= value; } } /// /// Gets/Sets the foreground color for this tab pages tab. /// public Brush TabForegroundColor { get { return mTabForeColorBrush; } set { if(value != null && value != mTabForeColorBrush) { mTabForeColorBrush = value; if(Parent != null) { Parent.Invalidate(); } } } } /// /// Gets/Sets the background color for this tab pages tab. /// public Brush TabBackgroundColor { get { return mTabBackgroundColorBrush; } set { if(value != null && value != mTabBackgroundColorBrush) { mTabBackgroundColorBrush = value; if(Parent != null) { Parent.Invalidate(); } } } } /// /// The dock style of the tab. /// [Browsable(false)] public override DockStyle Dock { get { return base.Dock; } set { base.Dock = value; } } /// /// Constructor. /// public DynamicTabPage() { this.BackColor = SystemColors.Window; } /// /// Constructor. /// /// Name of the tab. public DynamicTabPage(string text) { this.BackColor = SystemColors.Window; this.Text = text; } /// /// Called when the tab has been selected. /// /// Event args. protected virtual void OnTabSelected(EventArgs e) { if(mTabSelected != null) { mTabSelected(this, e); } } /// /// Called when the tab has been deselected. /// /// protected virtual void OnTabDeselected(EventArgs e) { if(mTabDeselected != null) { mTabDeselected(this, e); } } /// /// Called to select a tab. /// internal void SelectTab() { OnTabSelected(new EventArgs()); } /// /// Deselects the tab. /// internal void DeselectTab() { OnTabDeselected(new EventArgs()); } } }