ComponentFactory.Krypton.Ribbon.ViewDrawRibbonGroupTextBox.UpdateVisible C# (CSharp) Method

UpdateVisible() private method

private UpdateVisible ( Control c ) : void
c System.Windows.Forms.Control
return void
        private void UpdateVisible(Control c)
        {
            if (c != null)
            {
                // Start with the visible state of the group element
                bool visible = _ribbonTextBox.Visible;

                // If we have an associated designer setup...
                if (!_ribbon.InDesignHelperMode && (_ribbonTextBox.TextBoxDesigner != null))
                {
                    // And we are not using the design helpers, then use the design specified value
                    visible = _ribbonTextBox.TextBoxDesigner.DesignVisible;
                }

                if (visible)
                {
                    // Only visible if on the currently selected page
                    if ((_ribbonTextBox.RibbonTab == null) ||
                        (_ribbon.SelectedTab != _ribbonTextBox.RibbonTab))
                        visible = false;
                    else
                    {
                        // Check the owning group is visible
                        if ((_ribbonTextBox.RibbonContainer != null) &&
                            (_ribbonTextBox.RibbonContainer.RibbonGroup != null) &&
                            !_ribbonTextBox.RibbonContainer.RibbonGroup.Visible &&
                            !_ribbon.InDesignMode)
                            visible = false;
                        else
                        {
                            // Check that the group is not collapsed
                            if ((_ribbonTextBox.RibbonContainer.RibbonGroup.IsCollapsed) &&
                                ((_ribbon.GetControllerControl(_ribbonTextBox.TextBox) is KryptonRibbon) ||
                                 (_ribbon.GetControllerControl(_ribbonTextBox.TextBox) is VisualPopupMinimized)))
                                visible = false;
                            else
                            {
                                // Check that the hierarchy of containers are all visible
                                KryptonRibbonGroupContainer container = _ribbonTextBox.RibbonContainer;

                                // Keep going until we have searched the entire parent chain of containers
                                while (container != null)
                                {
                                    // If any parent container is not visible, then we are not visible
                                    if (!container.Visible)
                                    {
                                        visible = false;
                                        break;
                                    }

                                    // Move up a level
                                    container = container.RibbonContainer;
                                }
                            }
                        }
                    }
                }

                c.Visible = visible;
            }
        }