/// <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) { var specLookups = new ButtonSpecView[_specLookup.Count]; _specLookup.Values.CopyTo(specLookups, 0); var found = false; for (var i = _specLookup.Count - 1; i >= 0; i--) { ButtonSpecView specView = 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> /// Perform final steps now that the button spec has been created. /// </summary> /// <param name="buttonSpec">ButtonSpec instance.</param> /// <param name="buttonView">Associated ButtonSpecView instance.</param> /// <param name="viewDockerIndex">Index of view docker button is placed onto.</param> protected virtual void ButtonSpecCreated(ButtonSpec buttonSpec, ButtonSpecView buttonView, int viewDockerIndex) { // Cast the remapping palette to the correct type ButtonSpecRemapByContentView remapPalette = (ButtonSpecRemapByContentView)buttonView.RemapPalette; // Update button with the foreground used for colour mapping remapPalette.Foreground = GetDockerForeground(viewDockerIndex); }
/// <summary> /// Perform final steps now that the button spec has been created. /// </summary> /// <param name="buttonSpec">ButtonSpec instance.</param> /// <param name="buttonView">Associated ButtonSpecView instance.</param> /// <param name="viewDockerIndex">Index of view docker button is placed onto.</param> protected override void ButtonSpecCreated(ButtonSpec buttonSpec, ButtonSpecView buttonView, int viewDockerIndex) { // Cast the remapping palette to the correct type ButtonSpecRemapByContentCache remapPalette = (ButtonSpecRemapByContentCache)buttonView.RemapPalette; // Update button with the foreground used for color mapping remapPalette.SetPaletteContent(_paletteContent); remapPalette.SetPaletteState(_paletteState); }
/// <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) { var specLookups = new ButtonSpecView[_specLookup.Count]; _specLookup.Values.CopyTo(specLookups, 0); for (var 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> /// Perform final steps now that the button spec has been created. /// </summary> /// <param name="buttonSpec">ButtonSpec instance.</param> /// <param name="buttonView">Associated ButtonSpecView instance.</param> /// <param name="viewDockerIndex">Index of view docker button is placed onto.</param> protected override void ButtonSpecCreated(ButtonSpec buttonSpec, ButtonSpecView buttonView, int viewDockerIndex) { // Nothing extra to do }