Positions a separator to take up space without drawing.
Inheritance: ViewLeaf
        /// <summary>
        /// Initialize a new instance of the ViewLayoutRibbonQATMini class.
        /// </summary>
        /// <param name="ribbon">Owning control instance.</param>
        /// <param name="needPaintDelegate">Delegate for notifying paint/layout changes.</param>
        public ViewLayoutRibbonQATMini(KryptonRibbon ribbon,
                                       NeedPaintHandler needPaintDelegate)
        {
            Debug.Assert(ribbon != null);
            _ribbon = ribbon;

            // Create the minibar border suitable for a caption area
            _border = new ViewDrawRibbonQATBorder(ribbon, needPaintDelegate, true);

            // Create minibar content that synchs with ribbon collection
            _borderContents = new ViewLayoutRibbonQATFromRibbon(ribbon, needPaintDelegate, false);
            _border.Add(_borderContents);

            // Separator gap before the extra button
            _extraSeparator = new ViewLayoutSeparator(SEP_GAP);

            // Need the extra button to show after the border area
            _extraButton = new ViewDrawRibbonQATExtraButtonMini(ribbon, needPaintDelegate);
            _extraButton.ClickAndFinish += new ClickAndFinishHandler(OnExtraButtonClick);

            // Add layout contents
            Add(_border, ViewDockStyle.Fill);
            Add(_extraSeparator, ViewDockStyle.Right);
            Add(_extraButton, ViewDockStyle.Right);
        }
        /// <summary>
        /// Initialize a new instance of the ViewDrawMenuImageColumn class.
        /// </summary>
        /// <param name="items">Reference to the owning collection.</param>
        /// <param name="palette">Palette for obtaining drawing values.</param>
        public ViewDrawMenuImageColumn(KryptonContextMenuItems items,
                                       PaletteDoubleRedirect palette)
            : base(items.StateNormal.Back, items.StateNormal.Border)
        {
            // Give the items collection the redirector to use when inheriting values
            items.SetPaletteRedirect(palette);

            _separator = new ViewLayoutSeparator(0);
            Add(_separator);
        }
        /// <summary>
        /// Initialize a new instance of the ViewDrawMenuImageColumn class.
        /// </summary>
        /// <param name="items">Reference to the owning collection.</param>
        /// <param name="palette">Palette for obtaining drawing values.</param>
        public ViewDrawMenuImageColumn(KryptonContextMenuItems items,
                                       PaletteDoubleRedirect palette)
            : base(items.StateNormal.Back, items.StateNormal.Border)
        {
            // Give the items collection the redirector to use when inheriting values
            items.SetPaletteRedirect(palette);

            _separator = new ViewLayoutSeparator(0);
            Add(_separator);
        }
        /// <summary>
        /// Initialize a new instance of the ViewDrawButton class.
        /// </summary>
        /// <param name="paletteDisabled">Palette source for the disabled state.</param>
        /// <param name="paletteNormal">Palette source for the normal state.</param>
        /// <param name="paletteTracking">Palette source for the tracking state.</param>
        /// <param name="palettePressed">Palette source for the pressed state.</param>
        /// <param name="paletteCheckedNormal">Palette source for the normal checked state.</param>
        /// <param name="paletteCheckedTracking">Palette source for the tracking checked state.</param>
        /// <param name="paletteCheckedPressed">Palette source for the pressed checked state.</param>
        /// <param name="paletteMetric">Palette source for metric values.</param>
        /// <param name="buttonValues">Source for content values.</param>
        /// <param name="orientation">Visual orientation of the content.</param>
        /// <param name="useMnemonic">Use mnemonics.</param>
        public ViewDrawButton(IPaletteTriple paletteDisabled,
                              IPaletteTriple paletteNormal,
                              IPaletteTriple paletteTracking,
                              IPaletteTriple palettePressed,
                              IPaletteTriple paletteCheckedNormal,
                              IPaletteTriple paletteCheckedTracking,
                              IPaletteTriple paletteCheckedPressed,
                              IPaletteMetric paletteMetric,
                              IContentValues buttonValues,
                              VisualOrientation orientation,
                              bool useMnemonic)
        {
            // Remember the source information
            _paletteDisabled        = paletteDisabled;
            _paletteNormal          = paletteNormal;
            _paletteTracking        = paletteTracking;
            _palettePressed         = palettePressed;
            _paletteCheckedNormal   = paletteCheckedNormal;
            _paletteCheckedTracking = paletteCheckedTracking;
            _paletteCheckedPressed  = paletteCheckedPressed;
            _paletteCurrent         = _paletteNormal;

            // Default to not being checked
            _checked          = false;
            _allowUncheck     = true;
            _dropDown         = false;
            _splitter         = false;
            _dropDownPosition = VisualOrientation.Right;

            // Create the drop down view
            _drawDropDown       = new ViewLayoutCenter(1);
            _drawDropDownButton = new ViewDrawDropDownButton();
            _drawDropDown.Add(_drawDropDownButton);
            _drawOuterSeparator = new ViewLayoutSeparator(1);

            // Create the view used to draw the split edge
            _edgeRedirect    = new PaletteBorderEdgeRedirect(_paletteNormal.PaletteBorder, null);
            _drawSplitBorder = new ViewDrawBorderEdge(new PaletteBorderEdge(_edgeRedirect, null), CommonHelper.VisualToOrientation(orientation));

            // Our view contains background and border with content inside
            _drawContent = new ViewDrawContent(_paletteNormal.PaletteContent, buttonValues, orientation);
            _drawCanvas  = new ViewDrawSplitCanvas(_paletteNormal.PaletteBack, _paletteNormal.PaletteBorder, paletteMetric, PaletteMetricPadding.None, orientation);

            // Use a docker layout to organize the contents of the canvas
            _layoutDocker = new ViewLayoutDocker();
            _layoutDocker.Add(_drawContent, ViewDockStyle.Fill);
            _layoutDocker.Add(_drawSplitBorder, ViewDockStyle.Right);
            _layoutDocker.Add(_drawDropDown, ViewDockStyle.Right);
            _layoutDocker.Add(_drawOuterSeparator, ViewDockStyle.Right);
            _layoutDocker.Tag = this;

            // Pass the mnemonic default to the content view
            _drawContent.UseMnemonic = useMnemonic;

            // Place the content inside the canvas
            _drawCanvas.Add(_layoutDocker);

            // Set initial view element visible states
            UpdateDropDown();

            // Place the canvas inside ourself
            Add(_drawCanvas);
        }
        /// <summary>
        /// Create the view hierarchy for this view mode.
        /// </summary>
        protected override void CreateCheckItemView()
        {
            // Create the view element that lays out the check buttons
            _layoutBar = new ViewLayoutBar(Navigator.StateCommon.Bar,
                                           PaletteMetricInt.CheckButtonGap,
                                           Navigator.Bar.ItemSizing,
                                           Navigator.Bar.ItemAlignment,
                                           Navigator.Bar.BarMultiline,
                                           Navigator.Bar.ItemMinimumSize,
                                           Navigator.Bar.ItemMaximumSize,
                                           Navigator.Bar.BarMinimumHeight,
                                           false);

            // Create the scroll spacer that restricts display
            _layoutBarViewport = new ViewLayoutViewport(Navigator.StateCommon.Bar,
                                                        PaletteMetricPadding.BarPaddingInside,
                                                        PaletteMetricInt.CheckButtonGap,
                                                        Navigator.Bar.BarOrientation,
                                                        Navigator.Bar.ItemAlignment,
                                                        Navigator.Bar.BarAnimation);
            _layoutBarViewport.Add(_layoutBar);

            // Create the button bar area docker
            _layoutBarDocker = new ViewLayoutDocker();
            _layoutBarDocker.Add(_layoutBarViewport, ViewDockStyle.Fill);

            // Add a separators for insetting items
            _layoutBarSeparatorFirst = new ViewLayoutSeparator(0);
            _layoutBarSeparatorLast = new ViewLayoutSeparator(0);
            _layoutBarDocker.Add(_layoutBarSeparatorFirst, ViewDockStyle.Left);
            _layoutBarDocker.Add(_layoutBarSeparatorLast, ViewDockStyle.Right);

            // Create the docker used to layout contents of main panel and fill with group
            _layoutPanelDocker = new ViewLayoutDocker();
            _layoutPanelDocker.Add(_oldRoot, ViewDockStyle.Fill);
            _layoutPanelDocker.Add(_layoutBarDocker, ViewDockStyle.Top);

            // Create a canvas for containing the selected page and put old root inside it
            _drawGroup = new ViewDrawCanvas(Navigator.StateNormal.HeaderGroup.Back, Navigator.StateNormal.HeaderGroup.Border, VisualOrientation.Top);
            _drawGroup.Add(_layoutPanelDocker);
            _newRoot = _drawGroup;

            // Must call the base class to perform common actions
            base.CreateCheckItemView();
        }
        /// <summary>
        /// Create the view hierarchy for this view mode.
        /// </summary>
        protected override void CreateCheckItemView()
        {
            // Create a canvas for containing the selected page and put old root inside it
            _drawGroup = new ViewDrawCanvas(Navigator.StateNormal.HeaderGroup.Back,
                                            Navigator.StateNormal.HeaderGroup.Border,
                                            VisualOrientation.Top);

            _drawGroup.Add(_oldRoot);

            // Create the view element that lays out the check/tab buttons
            ViewLayoutBarForTabs layoutBar = new ViewLayoutBarForTabs(Navigator.Bar.ItemSizing,
                                                                      Navigator.Bar.ItemAlignment,
                                                                      Navigator.Bar.BarMultiline,
                                                                      Navigator.Bar.ItemMinimumSize,
                                                                      Navigator.Bar.ItemMaximumSize,
                                                                      Navigator.Bar.BarMinimumHeight,
                                                                      Navigator.Bar.TabBorderStyle,
                                                                      true);
            _layoutBar = layoutBar;

            // Create the scroll spacer that restricts display
            _layoutBarViewport = new ViewLayoutViewport(Navigator.StateCommon.Bar,
                                                        PaletteMetricPadding.BarPaddingTabs,
                                                        PaletteMetricInt.CheckButtonGap,
                                                        Navigator.Bar.BarOrientation,
                                                        Navigator.Bar.ItemAlignment,
                                                        Navigator.Bar.BarAnimation);
            _layoutBarViewport.Add(_layoutBar);

            // Create the button bar area docker
            _layoutBarDocker = new ViewLayoutDocker();
            _layoutBarDocker.Add(_layoutBarViewport, ViewDockStyle.Fill);

            // Add a separators for insetting items
            _layoutBarSeparatorFirst = new ViewLayoutSeparator(0);
            _layoutBarSeparatorLast = new ViewLayoutSeparator(0);
            _layoutBarDocker.Add(_layoutBarSeparatorFirst, ViewDockStyle.Left);
            _layoutBarDocker.Add(_layoutBarSeparatorLast, ViewDockStyle.Right);

            // Create the layout that insets the contents to allow for rounding of the group border
            _layoutOverlap = new ViewLayoutInsetOverlap(_drawGroup);
            _layoutOverlap.Add(_layoutBarDocker);

            // Create the docker used to layout contents of main panel and fill with group
            _layoutPanelDocker = new ViewLayoutDockerOverlap(_drawGroup, _layoutOverlap, layoutBar);
            _layoutPanelDocker.Add(_layoutOverlap, ViewDockStyle.Top);
            _layoutPanelDocker.Add(_drawGroup, ViewDockStyle.Fill);

            // Create the top level panel and put a layout docker inside it
            _drawPanel = new ViewDrawPanel(Navigator.StateNormal.Back);
            _drawPanel.Add(_layoutPanelDocker);
            _newRoot = _drawPanel;

            // Set the correct tab style
            UpdateTabStyle();

            // Must call the base class to perform common actions
            base.CreateCheckItemView();
        }
Exemple #7
0
        /// <summary>
        /// Initialize a new instance of the ViewDrawButton class.
        /// </summary>
        /// <param name="paletteDisabled">Palette source for the disabled state.</param>
        /// <param name="paletteNormal">Palette source for the normal state.</param>
        /// <param name="paletteTracking">Palette source for the tracking state.</param>
        /// <param name="palettePressed">Palette source for the pressed state.</param>
        /// <param name="paletteCheckedNormal">Palette source for the normal checked state.</param>
        /// <param name="paletteCheckedTracking">Palette source for the tracking checked state.</param>
        /// <param name="paletteCheckedPressed">Palette source for the pressed checked state.</param>
        /// <param name="paletteMetric">Palette source for metric values.</param>
        /// <param name="buttonValues">Source for content values.</param>
        /// <param name="orientation">Visual orientation of the content.</param>
        /// <param name="useMnemonic">Use mnemonics.</param>
        public ViewDrawButton(IPaletteTriple paletteDisabled,
							  IPaletteTriple paletteNormal,
							  IPaletteTriple paletteTracking,
							  IPaletteTriple palettePressed,
                              IPaletteTriple paletteCheckedNormal,
                              IPaletteTriple paletteCheckedTracking,
                              IPaletteTriple paletteCheckedPressed,
                              IPaletteMetric paletteMetric,
                              IContentValues buttonValues,
							  VisualOrientation orientation,
							  bool useMnemonic)
        {
            // Remember the source information
            _paletteDisabled = paletteDisabled;
            _paletteNormal = paletteNormal;
            _paletteTracking = paletteTracking;
            _palettePressed = palettePressed;
            _paletteCheckedNormal = paletteCheckedNormal;
            _paletteCheckedTracking = paletteCheckedTracking;
            _paletteCheckedPressed = paletteCheckedPressed;
            _paletteCurrent = _paletteNormal;

            // Default to not being checked
            _checked = false;
            _allowUncheck = true;
            _dropDown = false;
            _splitter = false;
            _dropDownPosition = VisualOrientation.Right;

            // Create the drop down view
            _drawDropDown = new ViewLayoutCenter(1);
            _drawDropDownButton = new ViewDrawDropDownButton();
            _drawDropDown.Add(_drawDropDownButton);
            _drawOuterSeparator = new ViewLayoutSeparator(1);

            // Create the view used to draw the split edge
            _edgeRedirect = new PaletteBorderEdgeRedirect(_paletteNormal.PaletteBorder, null);
            _drawSplitBorder = new ViewDrawBorderEdge(new PaletteBorderEdge(_edgeRedirect, null), CommonHelper.VisualToOrientation(orientation));

            // Our view contains background and border with content inside
            _drawContent = new ViewDrawContent(_paletteNormal.PaletteContent, buttonValues, orientation);
            _drawCanvas = new ViewDrawSplitCanvas(_paletteNormal.PaletteBack, _paletteNormal.PaletteBorder, paletteMetric, PaletteMetricPadding.None, orientation);

            // Use a docker layout to organize the contents of the canvas
            _layoutDocker = new ViewLayoutDocker();
            _layoutDocker.Add(_drawContent, ViewDockStyle.Fill);
            _layoutDocker.Add(_drawSplitBorder, ViewDockStyle.Right);
            _layoutDocker.Add(_drawDropDown, ViewDockStyle.Right);
            _layoutDocker.Add(_drawOuterSeparator, ViewDockStyle.Right);
            _layoutDocker.Tag = this;

            // Pass the mnemonic default to the content view
            _drawContent.UseMnemonic = useMnemonic;

            // Place the content inside the canvas
            _drawCanvas.Add(_layoutDocker);

            // Set initial view element visible states
            UpdateDropDown();

            // Place the canvas inside ourself
            Add(_drawCanvas);
        }
        /// <summary>
        /// Create the view hierarchy for this view mode.
        /// </summary>
        protected override void CreateCheckItemView()
        {
            // Create the two headers and header content
            _viewContentPrimary = new ViewDrawContent(Navigator.StateNormal.HeaderGroup.HeaderPrimary.Content,
                                                      Navigator.Header.HeaderValuesPrimary,
                                                      VisualOrientation.Top);

            _viewHeadingPrimary = new ViewDrawDocker(Navigator.StateNormal.HeaderGroup.HeaderPrimary.Back,
                                                     Navigator.StateNormal.HeaderGroup.HeaderPrimary.Border,
                                                     Navigator.StateNormal.HeaderGroup.HeaderPrimary,
                                                     PaletteMetricBool.None,
                                                     PaletteMetricPadding.HeaderGroupPaddingPrimary,
                                                     VisualOrientation.Top);

            _viewContentSecondary = new ViewDrawContent(Navigator.StateNormal.HeaderGroup.HeaderSecondary.Content,
                                                        Navigator.Header.HeaderValuesSecondary,
                                                        VisualOrientation.Top);

            _viewHeadingSecondary = new ViewDrawDocker(Navigator.StateNormal.HeaderGroup.HeaderSecondary.Back,
                                                       Navigator.StateNormal.HeaderGroup.HeaderSecondary.Border,
                                                       Navigator.StateNormal.HeaderGroup.HeaderSecondary,
                                                       PaletteMetricBool.None,
                                                       PaletteMetricPadding.HeaderGroupPaddingSecondary,
                                                       VisualOrientation.Top);

            // Place the the content as fillers in the headers
            _viewHeadingPrimary.Add(_viewContentPrimary, ViewDockStyle.Fill);
            _viewHeadingSecondary.Add(_viewContentSecondary, ViewDockStyle.Fill);

            // Create a canvas for containing the selected page and put old root inside it
            _drawGroup = new ViewDrawCanvas(Navigator.StateNormal.HeaderGroup.Back,
                                            Navigator.StateNormal.HeaderGroup.Border,
                                            VisualOrientation.Top);

            _drawGroup.ApplyIncludeBorderEdge = true;
            _drawGroup.Add(_oldRoot);

            // Create the view element that lays out the check/tab buttons
            ViewLayoutBarForTabs layoutBar = new ViewLayoutBarForTabs(Navigator.Bar.ItemSizing,
                                                                      Navigator.Bar.ItemAlignment,
                                                                      Navigator.Bar.BarMultiline,
                                                                      Navigator.Bar.ItemMinimumSize,
                                                                      Navigator.Bar.ItemMaximumSize,
                                                                      Navigator.Bar.BarMinimumHeight,
                                                                      Navigator.Bar.TabBorderStyle,
                                                                      true);
            _layoutBar = layoutBar;

            // Create the scroll spacer that restricts display
            _layoutBarViewport = new ViewLayoutViewport(Navigator.StateCommon.Bar,
                                                        PaletteMetricPadding.BarPaddingTabs,
                                                        PaletteMetricInt.CheckButtonGap,
                                                        Navigator.Bar.BarOrientation,
                                                        Navigator.Bar.ItemAlignment,
                                                        Navigator.Bar.BarAnimation);
            _layoutBarViewport.Add(_layoutBar);

            // Create the button bar area docker
            _layoutBarDocker = new ViewLayoutDocker();
            _layoutBarDocker.Add(_layoutBarViewport, ViewDockStyle.Fill);

            // Add a separators for insetting items
            _layoutBarSeparatorFirst = new ViewLayoutSeparator(0);
            _layoutBarSeparatorLast = new ViewLayoutSeparator(0);
            _layoutBarDocker.Add(_layoutBarSeparatorFirst, ViewDockStyle.Left);
            _layoutBarDocker.Add(_layoutBarSeparatorLast, ViewDockStyle.Right);

            // Create the layout that insets the contents to allow for rounding of the group border
            _layoutOverlap = new ViewLayoutInsetOverlap(_drawGroup);
            _layoutOverlap.Add(_layoutBarDocker);

            // Create the docker used to layout contents of main panel and fill with group
            _layoutPanelDocker = new ViewLayoutDockerOverlap(_drawGroup, _layoutOverlap, layoutBar);
            _layoutPanelDocker.Add(_layoutOverlap, ViewDockStyle.Top);
            _layoutPanelDocker.Add(_drawGroup, ViewDockStyle.Fill);

            // Place the headers and page holding area into the group
            _topGroup = new ViewLayoutDocker();
            _topGroup.Add(_viewHeadingSecondary, ViewDockStyle.Bottom);
            _topGroup.Add(_viewHeadingPrimary, ViewDockStyle.Top);
            _topGroup.Add(_layoutPanelDocker, ViewDockStyle.Fill);

            // Prevent adjacent headers from having two borders
            _topGroup.RemoveChildBorders = true;

            // Create the top level panel and put a layout docker inside it
            _drawPanel = new ViewDrawPanel(Navigator.StateNormal.Back);
            _drawPanel.Add(_topGroup);
            _newRoot = _drawPanel;

            // Set initial visible state of headers
            _viewHeadingPrimary.Visible = Navigator.Header.HeaderVisiblePrimary;
            _viewHeadingSecondary.Visible = Navigator.Header.HeaderVisibleSecondary;

            // Set the correct tab style
            UpdateTabStyle();

            // Must call the base class to perform common actions
            base.CreateCheckItemView();
        }
        /// <summary>
        /// Create the view hierarchy for this view mode.
        /// </summary>
        protected override void CreateCheckItemView()
        {
            // Create the view element that lays out the check buttons
            _layoutBar = new ViewLayoutBar(Navigator.StateCommon.Bar,
                                           PaletteMetricInt.RibbonTabGap,
                                           Navigator.Bar.ItemSizing,
                                           Navigator.Bar.ItemAlignment,
                                           Navigator.Bar.BarMultiline,
                                           Navigator.Bar.ItemMinimumSize,
                                           Navigator.Bar.ItemMaximumSize,
                                           Navigator.Bar.BarMinimumHeight,
                                           Navigator.Bar.TabBorderStyle,
                                           true);

            // Create the scroll spacer that restricts display
            _layoutBarViewport = new ViewLayoutViewport(Navigator.StateCommon.Bar,
                                                        PaletteMetricPadding.BarPaddingTabs,
                                                        PaletteMetricInt.RibbonTabGap,
                                                        Navigator.Bar.BarOrientation,
                                                        Navigator.Bar.ItemAlignment,
                                                        Navigator.Bar.BarAnimation);
            _layoutBarViewport.Add(_layoutBar);

            // Create the button bar area docker
            _layoutBarDocker = new ViewLayoutDocker();
            _layoutBarDocker.Add(_layoutBarViewport, ViewDockStyle.Fill);

            // Add a separators for insetting items
            _layoutBarSeparatorFirst = new ViewLayoutSeparator(0);
            _layoutBarSeparatorLast = new ViewLayoutSeparator(0);
            _layoutBarDocker.Add(_layoutBarSeparatorFirst, ViewDockStyle.Left);
            _layoutBarDocker.Add(_layoutBarSeparatorLast, ViewDockStyle.Right);

            // Create the docker used to layout contents of main panel and fill with group
            _layoutPanelDocker = new ViewLayoutDocker();
            _layoutPanelDocker.Add(_layoutBarDocker, ViewDockStyle.Fill);
            _layoutPanelDocker.Add(new ViewLayoutPageHide(Navigator), ViewDockStyle.Top);

            // Create the top level panel and put a layout docker inside it
            _drawPanel = new ViewDrawPanel(Navigator.StateNormal.Back);
            _drawPanel.Add(_layoutPanelDocker);
            _newRoot = _drawPanel;

            // Must call the base class to perform common actions
            base.CreateCheckItemView();
        }
Exemple #10
0
        public KryptonTreeView()
        {
            // Contains another control and needs marking as such for validation to work
            SetStyle(ControlStyles.ContainerControl, true);

            // Cannot select this control, only the child tree view and does not generate a click event
            SetStyle(ControlStyles.Selectable | ControlStyles.StandardClick, false);

            // Default fields
            _alwaysActive = true;
            _style = ButtonStyle.ListItem;
            _itemHeightDefault = true;
            _plusMinusImages = new TreeViewImages();
            _checkBoxImages = new CheckBoxImages();
            base.Padding = new Padding(1);

            // Create the palette storage
            _redirectImages = new PaletteRedirectTreeView(Redirector, _plusMinusImages, _checkBoxImages);
            PaletteBackInheritRedirect backInherit = new PaletteBackInheritRedirect(Redirector, PaletteBackStyle.InputControlStandalone);
            PaletteBorderInheritRedirect borderInherit = new PaletteBorderInheritRedirect(Redirector, PaletteBorderStyle.InputControlStandalone);
            PaletteBackColor1 commonBack = new PaletteBackColor1(backInherit, NeedPaintDelegate);
            PaletteBorder commonBorder = new PaletteBorder(borderInherit, NeedPaintDelegate);
            _stateCommon = new PaletteTreeStateRedirect(Redirector, commonBack, backInherit, commonBorder, borderInherit, NeedPaintDelegate);

            PaletteBackColor1 disabledBack = new PaletteBackColor1(_stateCommon.PaletteBack, NeedPaintDelegate);
            PaletteBorder disabledBorder = new PaletteBorder(_stateCommon.PaletteBorder, NeedPaintDelegate);
            _stateDisabled = new PaletteTreeState(_stateCommon, disabledBack, disabledBorder, NeedPaintDelegate);

            PaletteBackColor1 normalBack = new PaletteBackColor1(_stateCommon.PaletteBack, NeedPaintDelegate);
            PaletteBorder normalBorder = new PaletteBorder(_stateCommon.PaletteBorder, NeedPaintDelegate);
            _stateNormal = new PaletteTreeState(_stateCommon, normalBack, normalBorder, NeedPaintDelegate);

            PaletteBackColor1 activeBack = new PaletteBackColor1(_stateCommon.PaletteBack, NeedPaintDelegate);
            PaletteBorder activeBorder = new PaletteBorder(_stateCommon.PaletteBorder, NeedPaintDelegate);
            _stateActive = new PaletteDouble(_stateCommon, activeBack, activeBorder, NeedPaintDelegate);

            _stateFocus = new PaletteTreeNodeTripleRedirect(Redirector, PaletteBackStyle.ButtonListItem, PaletteBorderStyle.ButtonListItem, PaletteContentStyle.ButtonListItem, NeedPaintDelegate);
            _stateTracking = new PaletteTreeNodeTriple(_stateCommon.Node, NeedPaintDelegate);
            _statePressed = new PaletteTreeNodeTriple(_stateCommon.Node, NeedPaintDelegate);
            _stateCheckedNormal = new PaletteTreeNodeTriple(_stateCommon.Node, NeedPaintDelegate);
            _stateCheckedTracking = new PaletteTreeNodeTriple(_stateCommon.Node, NeedPaintDelegate);
            _stateCheckedPressed = new PaletteTreeNodeTriple(_stateCommon.Node, NeedPaintDelegate);

            // Create the override handling classes
            _overrideNormal = new PaletteTripleOverride(_stateFocus.Node, _stateNormal.Node, PaletteState.FocusOverride);
            _overrideTracking = new PaletteTripleOverride(_stateFocus.Node, _stateTracking.Node, PaletteState.FocusOverride);
            _overridePressed = new PaletteTripleOverride(_stateFocus.Node, _statePressed.Node, PaletteState.FocusOverride);
            _overrideCheckedNormal = new PaletteTripleOverride(_stateFocus.Node, _stateCheckedNormal.Node, PaletteState.FocusOverride);
            _overrideCheckedTracking = new PaletteTripleOverride(_stateFocus.Node, _stateCheckedTracking.Node, PaletteState.FocusOverride);
            _overrideCheckedPressed = new PaletteTripleOverride(_stateFocus.Node, _stateCheckedPressed.Node, PaletteState.FocusOverride);
            _overrideNormalNode = new PaletteNodeOverride(_overrideNormal);

            // Create the check box image drawer and place inside element so it is always centered
            _drawCheckBox = new ViewDrawCheckBox(_redirectImages);
            _layoutCheckBox = new ViewLayoutCenter();
            _layoutCheckBox.Add(_drawCheckBox);

            // Stack used to layout the location of the node image
            _layoutImage = new ViewLayoutSeparator(0, 0);
            _layoutImageAfter = new ViewLayoutSeparator(3, 0);
            _layoutImageCenter = new ViewLayoutCenter(_layoutImage);
            _layoutImageStack = new ViewLayoutStack(true);
            _layoutImageStack.Add(_layoutImageCenter);
            _layoutImageStack.Add(_layoutImageAfter);
            _layoutImageState = new ViewLayoutSeparator(16, 16);
            _layoutImageCenterState = new ViewLayoutCenter(_layoutImageState);

            // Create the draw element for owner drawing individual items
            _contentValues = new FixedContentValue();
            _drawButton = new ViewDrawButton(StateDisabled.Node, _overrideNormalNode,
                                             _overrideTracking, _overridePressed,
                                             _overrideCheckedNormal, _overrideCheckedTracking,
                                             _overrideCheckedPressed,
                                             new PaletteMetricRedirect(Redirector),
                                             _contentValues, VisualOrientation.Top, false);

            // Place check box on the left and the label in the remainder
            _layoutDocker = new ViewLayoutDocker();
            _layoutDocker.Add(_layoutImageStack, ViewDockStyle.Left);
            _layoutDocker.Add(_layoutImageCenterState, ViewDockStyle.Left);
            _layoutDocker.Add(_layoutCheckBox, ViewDockStyle.Left);
            _layoutDocker.Add(_drawButton, ViewDockStyle.Fill);

            // Create the internal tree view used for containing content
            _treeView = new InternalTreeView(this);
            _treeView.TrackMouseEnter += new EventHandler(OnTreeViewMouseChange);
            _treeView.TrackMouseLeave += new EventHandler(OnTreeViewMouseChange);
            _treeView.GotFocus += new EventHandler(OnTreeViewGotFocus);
            _treeView.LostFocus += new EventHandler(OnTreeViewLostFocus);
            _treeView.KeyDown += new KeyEventHandler(OnTreeViewKeyDown);
            _treeView.KeyUp += new KeyEventHandler(OnTreeViewKeyUp);
            _treeView.KeyPress += new KeyPressEventHandler(OnTreeViewKeyPress);
            _treeView.PreviewKeyDown += new PreviewKeyDownEventHandler(OnTreeViewPreviewKeyDown);
            _treeView.Validating += new CancelEventHandler(OnTreeViewValidating);
            _treeView.Validated += new EventHandler(OnTreeViewValidated);
            _treeView.AfterCheck += new TreeViewEventHandler(OnTreeViewAfterCheck);
            _treeView.AfterCollapse += new TreeViewEventHandler(OnTreeViewAfterCollapse);
            _treeView.AfterExpand += new TreeViewEventHandler(OnTreeViewAfterExpand);
            _treeView.AfterLabelEdit += new NodeLabelEditEventHandler(OnTreeViewAfterLabelEdit);
            _treeView.AfterSelect += new TreeViewEventHandler(OnTreeViewAfterSelect);
            _treeView.BeforeCheck += new TreeViewCancelEventHandler(OnTreeViewBeforeCheck);
            _treeView.BeforeCollapse += new TreeViewCancelEventHandler(OnTreeViewBeforeCollapse);
            _treeView.BeforeExpand += new TreeViewCancelEventHandler(OnTreeViewBeforeExpand);
            _treeView.BeforeLabelEdit += new NodeLabelEditEventHandler(OnTreeViewBeforeLabelEdit);
            _treeView.BeforeSelect += new TreeViewCancelEventHandler(OnTreeViewBeforeSelect);
            _treeView.ItemDrag += new ItemDragEventHandler(OnTreeViewItemDrag);
            _treeView.NodeMouseClick += new TreeNodeMouseClickEventHandler(OnTreeViewNodeMouseClick);
            _treeView.NodeMouseDoubleClick += new TreeNodeMouseClickEventHandler(OnTreeViewNodeMouseDoubleClick);
            _treeView.NodeMouseHover += new TreeNodeMouseHoverEventHandler(OnTreeViewNodeMouseHover);
            _treeView.DrawNode += new DrawTreeNodeEventHandler(OnTreeViewDrawNode);
            _treeView.DrawMode = TreeViewDrawMode.OwnerDrawAll;

            // Create the element that fills the remainder space and remembers fill rectange
            _layoutFill = new ViewLayoutFill(_treeView);
            _layoutFill.DisplayPadding = new Padding(1);

            // Create inner view for placing inside the drawing docker
            _drawDockerInner = new ViewLayoutDocker();
            _drawDockerInner.Add(_layoutFill, ViewDockStyle.Fill);

            // Create view for the control border and background
            _drawDockerOuter = new ViewDrawDocker(_stateNormal.Back, _stateNormal.Border);
            _drawDockerOuter.Add(_drawDockerInner, ViewDockStyle.Fill);

            // Create the view manager instance
            ViewManager = new ViewManager(this, _drawDockerOuter);

            // We need to create and cache a device context compatible with the display
            _screenDC = PI.CreateCompatibleDC(IntPtr.Zero);

            // Add tree view to the controls collection
            ((KryptonReadOnlyControls)Controls).AddInternal(_treeView);
        }
        private void CreateViewElements()
        {
            // Create redirector for the accessing the background palette
            _redirectCaption =  new PaletteDoubleRedirect(_redirect, PaletteBackStyle.HeaderForm, PaletteBorderStyle.HeaderForm, NeedPaintDelegate);

            // Create a top half for use in KryptonForm and another for use inside this caption area
            _captionAppButton = new ViewLayoutRibbonAppButton(_ribbon, false);
            _otherAppButton = new ViewLayoutRibbonAppButton(_ribbon, false);

            // Connect up the application button controller to the two button elements
            _appButtonController = new AppButtonController(_ribbon);
            _appButtonController.Target1 = _captionAppButton.AppButton;
            _appButtonController.Target2 = _otherAppButton.AppButton;
            _appButtonController.NeedPaint += new NeedPaintHandler(OnAppButtonNeedPaint);
            _captionAppButton.MouseController = _appButtonController;
            _otherAppButton.MouseController = _appButtonController;
            _appTabController = new AppTabController(_ribbon);
            _appTabController.NeedPaint += new NeedPaintHandler(OnAppButtonNeedPaint);

            // When not showing the app button we show this spacer instead
            _spaceInsteadOfAppButton = new ViewLayoutSeparator(0);
            _spaceInsteadOfAppButton.Visible = false;

            // Quick access toolbar, minibar versions
            _captionQAT = new ViewLayoutRibbonQATMini(_ribbon, _needIntegratedDelegate);
            _nonCaptionQAT = new ViewLayoutRibbonQATMini(_ribbon, NeedPaintDelegate);

            // Layout needed to position and draw the context titles
            _contextTiles = new ViewLayoutRibbonContextTitles(_ribbon, this);
            _contextTiles.ReverseRenderOrder = true;

            // Create composition right border and attach to composition area
            _compRightBorder = new ViewDrawRibbonCompoRightBorder();
            _compositionArea.CompRightBorder = _compRightBorder;

            // Place app button on left side and fill remainder with context titles
            Add(_contextTiles, ViewDockStyle.Fill);
            Add(_nonCaptionQAT, ViewDockStyle.Left);
            Add(_otherAppButton, ViewDockStyle.Left);

            // Update base class to use correct palette interface
            base.SetPalettes(_redirectCaption.PaletteBack, _redirectCaption.PaletteBorder);
        }