using System; using System.ComponentModel; using System.Drawing; using System.Xml; namespace DevComponents.DotNetBar { /// /// Represents class that is a bar container for document docking. /// [DesignTimeVisible(false),ToolboxItem(false),TypeConverter(typeof(DocumentBarContainerConverter))] public class DocumentBarContainer:DocumentBaseContainer { #region Private Variables and Constructor private Bar m_Bar=null; /// /// Creates new instance of the class. /// public DocumentBarContainer(){} /// /// Creates new instance of the class and initializes it with the Bar object. /// /// Bar to contain on document. public DocumentBarContainer(Bar bar) { m_Bar=bar; if(m_Bar.SplitDockHeight>0 || m_Bar.SplitDockWidth>0) this.SetLayoutBounds(new Rectangle(0,0,m_Bar.SplitDockWidth,m_Bar.SplitDockHeight)); } /// /// Creates new instance of the class and initializes it with the bar and propesed width and height. /// /// Bar to contain on document. /// Proposed width of the document in pixels /// Proposed height of the document in pixels public DocumentBarContainer(Bar bar, int proposedWidth, int proposedHeight) { m_Bar=bar; this.SetLayoutBounds(new Rectangle(0,0,proposedWidth,proposedHeight)); } #endregion #region Internal Implementation /// /// Gets or sets the bar that is contained by this document. /// [Browsable(false),DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public Bar Bar { get {return m_Bar;} set {m_Bar=value;} } /// /// Resizes document object. /// /// Available bounds for the document. public override void Layout(Rectangle bounds) { if (m_Bar != null) { m_Bar.SplitDockHeight = 0; m_Bar.SplitDockWidth = 0; m_Bar.MinHeight = 0; m_Bar.RecalcSize(bounds.Size); m_Bar.Location = bounds.Location; } SetDisplayBounds(bounds); } /// /// Gets whether document is visible. /// public override bool Visible { get { if (m_Bar == null) return false; if(m_Bar.GetDesignMode()) return true; return m_Bar.IsVisible; } } /// /// Gets the minimum size of the document. /// protected internal override System.Drawing.Size MinimumSize { get {return m_Bar.GetAdjustedFullSize(m_Bar.MinimumDockSize(eOrientation.Horizontal));} } #endregion } }