Navigator view element for drawing a bar check button for a krypton page.
Наследование: ViewDrawNavCheckButtonBase, INavCheckItem
Пример #1
0
        private void RenderChildren(RenderContext context, bool drawChecked)
        {
            IEnumerable <ViewBase> orderedChildren;

            // Use tab style to decide what order the children are drawn in
            if (context.Renderer.RenderTabBorder.GetTabBorderLeftDrawing(TabBorderStyle))
            {
                orderedChildren = this;
            }
            else
            {
                orderedChildren = this.Reverse();
            }

            // Ask each child to render in turn
            foreach (ViewBase child in orderedChildren)
            {
                // Only render visible children that are inside the clipping rectangle
                if (child.Visible && child.ClientRectangle.IntersectsWith(context.ClipRect))
                {
                    // If this is a page representation that can overlap group border
                    ViewDrawNavCheckButtonBar buttonBar = child as ViewDrawNavCheckButtonBar;
                    ViewDrawNavRibbonTab      tab       = child as ViewDrawNavRibbonTab;
                    if ((buttonBar != null) ||
                        (tab != null))
                    {
                        bool itemChecked = buttonBar?.Checked ?? tab.Checked;

                        // Are we allowed to draw the checked item?
                        if ((!itemChecked && !drawChecked) ||
                            (itemChecked && drawChecked))
                        {
                            child.Render(context);
                        }
                    }
                    else
                    {
                        if (!drawChecked)
                        {
                            child.Render(context);
                        }
                    }
                }
            }
        }
        /// <summary>
        /// Create a new check item with initial settings.
        /// </summary>
        /// <param name="page">Page for which the check button is to be created.</param>
        /// <param name="orientation">Initial orientation of the check button.</param>
        protected virtual INavCheckItem CreateCheckItem(KryptonPage page,
                                                        VisualOrientation orientation)
        {
            // Create a check button view element
            ViewDrawNavCheckButtonBar checkButton = new ViewDrawNavCheckButtonBar(Navigator, page, orientation);

            // Convert the button orientation to the appropriate visual orientations
            VisualOrientation orientBackBorder = ConvertButtonBorderBackOrientation();
            VisualOrientation orientContent = ConvertButtonContentOrientation();

            // Set the correct initial orientation of the button
            checkButton.SetOrientation(orientBackBorder, orientContent);

            return checkButton;
        }