/// <summary> /// Ensure the correct state palettes are being used. /// </summary> public override void UpdateStatePalettes() { IPaletteBack back; // If whole navigator is disabled then all of view is disabled bool enabled = Navigator.Enabled; // If there is no selected page if (Navigator.SelectedPage == null) { // Then use the state defined in the navigator itself if (Navigator.Enabled) { back = Navigator.StateNormal.Back; } else { back = Navigator.StateDisabled.Back; } } else { // Use state defined in the selected page if (Navigator.SelectedPage.Enabled) { back = Navigator.SelectedPage.StateNormal.Back; } else { back = Navigator.SelectedPage.StateDisabled.Back; // If page is disabled then all of view should look disabled enabled = false; } } // Update the view canvas with correct palette source _drawPanel.SetPalettes(back); _drawPanel.Enabled = enabled; // Let base class perform common actions base.UpdateStatePalettes(); }
/// <summary> /// Initialize a new instance of the KryptonGroupPanel class. /// </summary> /// <param name="alignControl">Container control for alignment.</param> /// <param name="stateCommon">Common appearance state to inherit from.</param> /// <param name="stateDisabled">Disabled appearance state.</param> /// <param name="stateNormal">Normal appearance state.</param> /// <param name="layoutHandler">Callback delegate for layout processing.</param> public KryptonGroupPanel(Control alignControl, PaletteDoubleRedirect stateCommon, PaletteDouble stateDisabled, PaletteDouble stateNormal, NeedPaintHandler layoutHandler) : base(stateCommon, stateDisabled, stateNormal) { // Remember the delegate used to notify layouts _layoutHandler = layoutHandler; // Create the forced overrides to enforce the graphics option we want _forcedDisabled = new PaletteBackInheritForced(stateDisabled.Back); _forcedNormal = new PaletteBackInheritForced(stateNormal.Back); // We never allow the anti alias option as it prevent transparent background working _forcedDisabled.ForceGraphicsHint = PaletteGraphicsHint.None; _forcedNormal.ForceGraphicsHint = PaletteGraphicsHint.None; // Set the correct initial palettes ViewDrawPanel.SetPalettes(Enabled ? _forcedNormal : _forcedDisabled); // Make sure the alignment of the group panel is as that of the parent ViewManager.AlignControl = alignControl; }