/// <summary> /// Gets the view for the previous visible and enabled button spec of the defined edge. /// </summary> /// <param name="align">Edge of buttons caller is interested in searching.</param> /// <param name="current">Current button that is the marker for searching.</param> /// <returns>ViewDrawButton reference; otherwise false.</returns> public virtual ViewDrawButton GetPreviousVisibleViewButton(PaletteRelativeEdgeAlign align, ViewDrawButton current) { ButtonSpecView[] specLookups = new ButtonSpecView[_specLookup.Count]; _specLookup.Values.CopyTo(specLookups, 0); bool found = false; for (int i = _specLookup.Count - 1; i >= 0; i--) { ButtonSpecView specView = (ButtonSpecView)specLookups[i]; if (!found) { found = (specView.ViewButton == current); } else { // Is the button actually visible/enabled if (specView.ViewCenter.Visible && specView.ViewButton.Enabled) { if (specView.ButtonSpec.Edge == align) { return(specView.ViewButton); } } } } return(null); }
/// <summary> /// Gets the view for the next visible and enabled button spec of the defined edge. /// </summary> /// <param name="align">Edge of buttons caller is interested in searching.</param> /// <param name="current">Current button that is the marker for searching.</param> /// <returns>ViewDrawButton reference; otherwise false.</returns> public virtual ViewDrawButton GetNextVisibleViewButton(PaletteRelativeEdgeAlign align, ViewDrawButton current) { bool found = false; foreach (ButtonSpecView specView in _specLookup.Values) { if (!found) { found = (specView.ViewButton == current); } else { // Is the button actually visible/enabled if (specView.ViewCenter.Visible && specView.ViewButton.Enabled) { if (specView.ButtonSpec.Edge == align) { return(specView.ViewButton); } } } } return(null); }
/// <summary> /// Initialize a new instance of the ButtonSpec class. /// </summary> public ButtonSpec() { _image = null; _toolTipImage = null; _colorMap = Color.Empty; _imageTransparentColor = Color.Empty; _toolTipImageTransparentColor = Color.Empty; _text = string.Empty; _extraText = string.Empty; UniqueName = CommonHelper.UniqueString; _toolTipTitle = string.Empty; _toolTipBody = string.Empty; _allowInheritImage = true; _allowInheritText = true; _allowInheritExtraText = true; _allowInheritToolTipTitle = true; ToolTipStyle = LabelStyle.ToolTip; _style = PaletteButtonStyle.Inherit; _orientation = PaletteButtonOrientation.Inherit; ProtectedType = PaletteButtonSpecStyle.Generic; _edge = PaletteRelativeEdgeAlign.Inherit; _imageStates = new CheckButtonImageStates { NeedPaint = OnImageStateChanged }; ContextMenuStrip = null; KryptonContextMenu = null; _buttonSpecView = null; }
/// <summary> /// Initialize a new instance of the KryptonPaletteButtonSpecBase class. /// </summary> /// <param name="redirector">Palette redirector for sourcing inherited values.</param> internal KryptonPaletteButtonSpecBase(PaletteRedirect redirector) { Debug.Assert(redirector != null); // Remember reference to redirector Redirector = redirector; // Default the generic overridable values _style = PaletteButtonStyle.Inherit; _orientation = PaletteButtonOrientation.Inherit; _edge = PaletteRelativeEdgeAlign.Inherit; }
/// <summary> /// Initialize a new instance of the KryptonPaletteButtonSpecBase class. /// </summary> /// <param name="redirector">Palette redirector for sourcing inherited values.</param> internal KryptonPaletteButtonSpecBase(PaletteRedirect redirector) { Debug.Assert(redirector != null); // Remember reference to redirector _redirector = redirector; // Default the generic overridable values _style = PaletteButtonStyle.Inherit; _orientation = PaletteButtonOrientation.Inherit; _edge = PaletteRelativeEdgeAlign.Inherit; }
/// <summary> /// Convert from palette specific edge alignment to resolved edge alignment. /// </summary> /// <param name="paletteRelativeEdgeAlign">Palette specific edge alignment.</param> /// <returns>Resolved edge alignment.</returns> protected RelativeEdgeAlign ConvertToRelativeEdgeAlign(PaletteRelativeEdgeAlign paletteRelativeEdgeAlign) { switch (paletteRelativeEdgeAlign) { case PaletteRelativeEdgeAlign.Near: return(RelativeEdgeAlign.Near); case PaletteRelativeEdgeAlign.Far: return(RelativeEdgeAlign.Far); default: // Should never happen! Debug.Assert(false); return(RelativeEdgeAlign.Far); } }
/// <summary> /// Gets the view for the first visible and enabled button spec of the defined edge. /// </summary> /// <param name="align">Edge of buttons caller is interested in searching.</param> /// <returns>ViewDrawButton reference; otherwise false.</returns> public virtual ViewDrawButton GetFirstVisibleViewButton(PaletteRelativeEdgeAlign align) { foreach (ButtonSpecView specView in _specLookup.Values) { // Is the button actually visible/enabled if (specView.ViewCenter.Visible && specView.ViewButton.Enabled) { if (specView.ButtonSpec.Edge == align) { return(specView.ViewButton); } } } return(null); }
/// <summary> /// Gets the view for the last visible and enabled button spec of the defined edge. /// </summary> /// <param name="align">Edge of buttons caller is interested in searching.</param> /// <returns>ViewDrawButton reference; otherwise false.</returns> public virtual ViewDrawButton GetLastVisibleViewButton(PaletteRelativeEdgeAlign align) { ButtonSpecView[] specLookups = new ButtonSpecView[_specLookup.Count]; _specLookup.Values.CopyTo(specLookups, 0); for (int i = _specLookup.Count - 1; i >= 0; i--) { ButtonSpecView specView = specLookups[i]; // Is the button actually visible/enabled if (specView.ViewCenter.Visible && specView.ViewButton.Enabled) { if (specView.ButtonSpec.Edge == align) { return(specView.ViewButton); } } } return(null); }
/// <summary> /// Resets the Edge property to its default value. /// </summary> public void ResetEdge() { Edge = PaletteRelativeEdgeAlign.Inherit; }
private void ResetEdge() { Edge = PaletteRelativeEdgeAlign.Inherit; }
/// <summary> /// Initialize a new instance of the ButtonSpec class. /// </summary> public ButtonSpec() { _image = null; _toolTipImage = null; _colorMap = Color.Empty; _imageTransparentColor = Color.Empty; _toolTipImageTransparentColor = Color.Empty; _text = string.Empty; _extraText = string.Empty; _uniqueName = CommonHelper.UniqueString; _toolTipTitle = string.Empty; _toolTipBody = string.Empty; _allowInheritImage = true; _allowInheritText = true; _allowInheritExtraText = true; _allowInheritToolTipTitle = true; _toolTipStyle = LabelStyle.ToolTip; _style = PaletteButtonStyle.Inherit; _orientation = PaletteButtonOrientation.Inherit; _type = PaletteButtonSpecStyle.Generic; _edge = PaletteRelativeEdgeAlign.Inherit; _imageStates = new CheckButtonImageStates(); _imageStates.NeedPaint = new NeedPaintHandler(OnImageStateChanged); _contextMenuStrip = null; _kryptonContextMenu = null; _buttonSpecView = null; }
/// <summary> /// Convert from palette specific edge alignment to resolved edge alignment. /// </summary> /// <param name="paletteRelativeEdgeAlign">Palette specific edge alignment.</param> /// <returns>Resolved edge alignment.</returns> protected RelativeEdgeAlign ConvertToRelativeEdgeAlign(PaletteRelativeEdgeAlign paletteRelativeEdgeAlign) { switch (paletteRelativeEdgeAlign) { case PaletteRelativeEdgeAlign.Near: return RelativeEdgeAlign.Near; case PaletteRelativeEdgeAlign.Far: return RelativeEdgeAlign.Far; default: // Should never happen! Debug.Assert(false); return RelativeEdgeAlign.Far; } }