public ViewLayoutRibbonScrollPort(KryptonRibbon ribbon,
Orientation orientation,
ViewBase viewFiller,
bool insetForTabs,
int scrollSpeed,
NeedPaintHandler needPaintDelegate)
{
Debug.Assert(ribbon != null);
Debug.Assert(viewFiller != null);
Debug.Assert(needPaintDelegate != null);
// Remember initial settings
_ribbon = ribbon;
_orientation = orientation;
_viewFiller = viewFiller;
_needPaintDelegate = needPaintDelegate;
_scrollSpeed = scrollSpeed;
_ribbonTabs = viewFiller as ViewLayoutRibbonTabs;
// Default to left hand scroll position
_scrollOffset = 0;
// Place the child view inside a actual control, so that the contents of the
// filler are clipped to the control size. This is needed if the child view
// contains controls and need clipping inside this area and so prevent them
// from drawing over the end scrollers.
_viewControlContent = new RibbonViewControl(ribbon);
_viewControlContent.PaintBackground += new PaintEventHandler(OnViewControlPaintBackground);
_viewControl = new ViewLayoutControl(_viewControlContent, ribbon, _viewFiller);
// For ribbon tabs we want to monitor and intercept the WM_NCHITTEST so that the remainder of the
// tabs area acts like the application title bar and can be used to manipulate the application
if (_ribbonTabs != null)
_viewControl.ChildControl.WndProcHitTest += new EventHandler<ViewControlHitTestArgs>(OnChildWndProcHitTest);
// Create the two scrollers used when not enough space for filler
_nearScroller = new ViewLayoutRibbonScroller(ribbon, NearOrientation, insetForTabs, needPaintDelegate);
_farScroller = new ViewLayoutRibbonScroller(ribbon, FarOrientation, insetForTabs, needPaintDelegate);
// Hook into scroller events
_nearScroller.Click += new EventHandler(OnNearClick);
_farScroller.Click += new EventHandler(OnFarClick);
// Add elements in correct order
Add(_viewControl);
Add(_nearScroller);
Add(_farScroller);
}