/// <summary> /// Initialize a new instance of the ViewDrawRibbonTab class. /// </summary> /// <param name="ribbon">Reference to owning ribbon control.</param> /// <param name="layoutTabs">Reference to view used for layout out tabs.</param> /// <param name="needPaint">Delegate for notifying paint requests.</param> public ViewDrawRibbonTab(KryptonRibbon ribbon, ViewLayoutRibbonTabs layoutTabs, NeedPaintHandler needPaint) { Debug.Assert(ribbon != null); Debug.Assert(layoutTabs != null); Debug.Assert(needPaint != null); // Cache incoming values Ribbon = ribbon; ViewLayoutRibbonTabs = layoutTabs; _needPaint = needPaint; // Create overrides for handling a focus state _paletteGeneral = ribbon.StateCommon.RibbonGeneral; _overrideStateNormal = new PaletteRibbonDoubleInheritOverride(Ribbon.OverrideFocus.RibbonTab, Ribbon.OverrideFocus.RibbonTab, Ribbon.StateNormal.RibbonTab, Ribbon.StateNormal.RibbonTab, PaletteState.FocusOverride); _overrideStateTracking = new PaletteRibbonDoubleInheritOverride(Ribbon.OverrideFocus.RibbonTab, Ribbon.OverrideFocus.RibbonTab, Ribbon.StateTracking.RibbonTab, Ribbon.StateTracking.RibbonTab, PaletteState.FocusOverride); _overrideStateCheckedNormal = new PaletteRibbonDoubleInheritOverride(Ribbon.OverrideFocus.RibbonTab, Ribbon.OverrideFocus.RibbonTab, Ribbon.StateCheckedNormal.RibbonTab, Ribbon.StateCheckedNormal.RibbonTab, PaletteState.FocusOverride); _overrideStateCheckedTracking = new PaletteRibbonDoubleInheritOverride(Ribbon.OverrideFocus.RibbonTab, Ribbon.OverrideFocus.RibbonTab, Ribbon.StateCheckedTracking.RibbonTab, Ribbon.StateCheckedTracking.RibbonTab, PaletteState.FocusOverride); _overrideStateContextTracking = new PaletteRibbonDoubleInheritOverride(Ribbon.OverrideFocus.RibbonTab, Ribbon.OverrideFocus.RibbonTab, Ribbon.StateContextTracking.RibbonTab, Ribbon.StateContextTracking.RibbonTab, PaletteState.FocusOverride); _overrideStateContextCheckedNormal = new PaletteRibbonDoubleInheritOverride(Ribbon.OverrideFocus.RibbonTab, Ribbon.OverrideFocus.RibbonTab, Ribbon.StateContextCheckedNormal.RibbonTab, Ribbon.StateContextCheckedNormal.RibbonTab, PaletteState.FocusOverride); _overrideStateContextCheckedTracking = new PaletteRibbonDoubleInheritOverride(Ribbon.OverrideFocus.RibbonTab, Ribbon.OverrideFocus.RibbonTab, Ribbon.StateContextCheckedTracking.RibbonTab, Ribbon.StateContextCheckedTracking.RibbonTab, PaletteState.FocusOverride); _overrideCurrent = _overrideStateNormal; // Create and default the setup of the context colors provider _paletteContextCurrent = new PaletteRibbonContextDouble(Ribbon); _paletteContextCurrent.SetInherit(_overrideCurrent); // Use a class to convert from ribbon tab to content interface _contentProvider = new RibbonTabToContent(_paletteGeneral, _paletteContextCurrent); // Use a controller to change state because of mouse movement RibbonTabController controller = new(Ribbon, this, _needPaint); controller.Click += OnTabClicked; controller.ContextClick += OnTabContextClicked; MouseController = controller; SourceController = controller; KeyController = controller; // Associate this view with the source component (required for design time selection) Component = _ribbonTab; // Create and add the draw content for display inside the tab Add(new ViewDrawContent(_contentProvider, this, VisualOrientation.Top, true, false)); // Create the state specific memento array _mementos = new IDisposable[Enum.GetValues(typeof(PaletteState)).Length]; _preferredBorder2007 = new Padding((int)(12 * FactorDpiX), (int)(3 * FactorDpiY), (int)(12 * FactorDpiX), (int)(1 * FactorDpiY)); _preferredBorder2010 = new Padding((int)(8 * FactorDpiX), (int)(4 * FactorDpiY), (int)(8 * FactorDpiX), (int)(3 * FactorDpiY)); _layoutBorder2007 = new Padding((int)(4 * FactorDpiX), (int)(3 * FactorDpiY), (int)(4 * FactorDpiX), (int)(1 * FactorDpiY)); _layoutBorder2010 = new Padding((int)(1 * FactorDpiX), (int)(4 * FactorDpiY), (int)(0 * FactorDpiX), (int)(3 * FactorDpiY)); }
/// <summary> /// Initialize a new instance of the ViewLayoutRibbonScrollPort class. /// </summary> /// <param name="ribbon">Reference to owning ribbon control.</param> /// <param name="orientation">Viewport orientation.</param> /// <param name="viewFiller">View to size and position.</param> /// <param name="insetForTabs">Should scoller be inset for use in tabs area.</param> /// <param name="scrollSpeed">Scrolling speed.</param> /// <param name="needPaintDelegate">Delegate for notifying paint/layout requests.</param> 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 += OnViewControlPaintBackground; ViewLayoutControl = new ViewLayoutControl(_viewControlContent, ribbon, _viewFiller); // Removed because of this // https://github.com/Krypton-Suite/Standard-Toolkit/issues/372 // And the statement below does not make sense, and it didn;t do what it states ! //// 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) //{ // ViewLayoutControl.ChildControl.WndProcHitTest += 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 += OnNearClick; _farScroller.Click += OnFarClick; // Add elements in correct order Add(ViewLayoutControl); Add(_nearScroller); Add(_farScroller); }
/// <summary> /// Initialize a new instance of the ViewLayoutRibbonScrollPort class. /// </summary> /// <param name="ribbon">Reference to owning ribbon control.</param> /// <param name="orientation">Viewport orientation.</param> /// <param name="viewFiller">View to size and position.</param> /// <param name="insetForTabs">Should scoller be inset for use in tabs area.</param> /// <param name="scrollSpeed">Scrolling speed.</param> /// <param name="needPaintDelegate">Delegate for notifying paint/layout requests.</param> 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); }
/// <summary> /// Initialize a new instance of the ViewDrawRibbonTab class. /// </summary> /// <param name="ribbon">Reference to owning ribbon control.</param> /// <param name="layoutTabs">Reference to view used for layout out tabs.</param> /// <param name="needPaint">Delegate for notifying paint requests.</param> public ViewDrawRibbonTab(KryptonRibbon ribbon, ViewLayoutRibbonTabs layoutTabs, NeedPaintHandler needPaint) { Debug.Assert(ribbon != null); Debug.Assert(layoutTabs != null); Debug.Assert(needPaint != null); // Cache incoming values _ribbon = ribbon; _layoutTabs = layoutTabs; _needPaint = needPaint; // Create overrides for handling a focus state _paletteGeneral = ribbon.StateCommon.RibbonGeneral; _overrideStateNormal = new PaletteRibbonDoubleInheritOverride(_ribbon.OverrideFocus.RibbonTab, _ribbon.OverrideFocus.RibbonTab, _ribbon.StateNormal.RibbonTab, _ribbon.StateNormal.RibbonTab, PaletteState.FocusOverride); _overrideStateTracking = new PaletteRibbonDoubleInheritOverride(_ribbon.OverrideFocus.RibbonTab, _ribbon.OverrideFocus.RibbonTab, _ribbon.StateTracking.RibbonTab, _ribbon.StateTracking.RibbonTab, PaletteState.FocusOverride); _overrideStateCheckedNormal = new PaletteRibbonDoubleInheritOverride(_ribbon.OverrideFocus.RibbonTab, _ribbon.OverrideFocus.RibbonTab, _ribbon.StateCheckedNormal.RibbonTab, _ribbon.StateCheckedNormal.RibbonTab, PaletteState.FocusOverride); _overrideStateCheckedTracking = new PaletteRibbonDoubleInheritOverride(_ribbon.OverrideFocus.RibbonTab, _ribbon.OverrideFocus.RibbonTab, _ribbon.StateCheckedTracking.RibbonTab, _ribbon.StateCheckedTracking.RibbonTab, PaletteState.FocusOverride); _overrideStateContextTracking = new PaletteRibbonDoubleInheritOverride(_ribbon.OverrideFocus.RibbonTab, _ribbon.OverrideFocus.RibbonTab, _ribbon.StateContextTracking.RibbonTab, _ribbon.StateContextTracking.RibbonTab, PaletteState.FocusOverride); _overrideStateContextCheckedNormal = new PaletteRibbonDoubleInheritOverride(_ribbon.OverrideFocus.RibbonTab, _ribbon.OverrideFocus.RibbonTab, _ribbon.StateContextCheckedNormal.RibbonTab, _ribbon.StateContextCheckedNormal.RibbonTab, PaletteState.FocusOverride); _overrideStateContextCheckedTracking = new PaletteRibbonDoubleInheritOverride(_ribbon.OverrideFocus.RibbonTab, _ribbon.OverrideFocus.RibbonTab, _ribbon.StateContextCheckedTracking.RibbonTab, _ribbon.StateContextCheckedTracking.RibbonTab, PaletteState.FocusOverride); _overrideCurrent = _overrideStateNormal; // Create and default the setup of the context colors provider _paletteContextCurrent = new PaletteRibbonContextDouble(_ribbon); _paletteContextCurrent.SetInherit(_overrideCurrent); // Use a class to convert from ribbon tab to content interface _contentProvider = new RibbonTabToContent(_paletteGeneral, _paletteContextCurrent); // Use a controller to change state because of mouse movement RibbonTabController controller = new RibbonTabController(_ribbon, this, _needPaint); controller.Click += new MouseEventHandler(OnTabClicked); controller.ContextClick += new MouseEventHandler(OnTabContextClicked); MouseController = controller; SourceController = controller; KeyController = controller; // Associate this view with the source component (required for design time selection) Component = _ribbonTab; // Create and add the draw content for display inside the tab Add(new ViewDrawContent(_contentProvider, this, VisualOrientation.Top, true, false)); // Create the state specific memento array _mementos = new IDisposable[Enum.GetValues(typeof(PaletteState)).Length]; }