using System;
using System.Collections.Generic;
namespace Dragablz.Dockablz
{
///
/// Provides information about the instance.
///
public class LayoutAccessor
{
private readonly Layout _layout;
private readonly BranchAccessor _branchAccessor;
private readonly TabablzControl _tabablzControl;
public LayoutAccessor(Layout layout)
{
if (layout == null) throw new ArgumentNullException("layout");
_layout = layout;
var branch = Layout.Content as Branch;
if (branch != null)
_branchAccessor = new BranchAccessor(branch);
else
_tabablzControl = Layout.Content as TabablzControl;
}
public Layout Layout
{
get { return _layout; }
}
public IEnumerable FloatingItems
{
get { return _layout.FloatingDragablzItems(); }
}
///
/// and are mutually exclusive, according to whether the layout has been split, or just contains a tab control.
///
public BranchAccessor BranchAccessor
{
get { return _branchAccessor; }
}
///
/// and are mutually exclusive, according to whether the layout has been split, or just contains a tab control.
///
public TabablzControl TabablzControl
{
get { return _tabablzControl; }
}
///
/// Visits the content of the layout, according to its content type. No more than one of the provided
/// callbacks will be called.
///
public LayoutAccessor Visit(
Action branchVisitor = null,
Action tabablzControlVisitor = null,
Action