public VisualPopupPage(KryptonNavigator navigator,
KryptonPage page,
IRenderer renderer)
: base(renderer, true)
{
Debug.Assert(navigator != null);
Debug.Assert(page != null);
// Remember references needed later
_navigator = navigator;
_page = page;
// Always create the layout that positions the actual page
ViewLayoutPopupPage layoutPage = new ViewLayoutPopupPage(navigator, page);
// Create the internal panel used for containing content
ViewDrawCanvas drawGroup = new ViewDrawCanvas(navigator.StateNormal.HeaderGroup.Back,
navigator.StateNormal.HeaderGroup.Border,
VisualOrientation.Top);
// Add the layout inside the draw group
drawGroup.Add(layoutPage);
// Do we need to add a border area around the page group
if (_navigator.PopupPages.Border > 0)
{
// Grab the actual border values
int border = _navigator.PopupPages.Border;
// Put the page group inside a layout that has separators
// to pad out the sizing to the border size we need
ViewLayoutDocker layoutDocker = new ViewLayoutDocker();
layoutDocker.Add(drawGroup, ViewDockStyle.Fill);
layoutDocker.Add(new ViewLayoutSeparator(border), ViewDockStyle.Top);
layoutDocker.Add(new ViewLayoutSeparator(border), ViewDockStyle.Bottom);
layoutDocker.Add(new ViewLayoutSeparator(border), ViewDockStyle.Left);
layoutDocker.Add(new ViewLayoutSeparator(border), ViewDockStyle.Right);
// Create a new top level group that contains the layout
drawGroup = new ViewDrawCanvas(navigator.StateNormal.Back,
navigator.StateNormal.HeaderGroup.Border,
VisualOrientation.Top);
drawGroup.Add(layoutDocker);
}
ViewManager = new ViewManager(this, drawGroup);
// Borrow the child panel that contains all the pages from
// the navigator and add it inside as a child of ourself
navigator.BorrowChildPanel();
Controls.Add(navigator.ChildPanel);
}