/// <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> /// Update cached remapping values and update active views. /// </summary> /// <param name="paletteContent">Palette used to recover remapping colors.</param> /// <param name="paletteState">Palette state to use for remapping.</param> public void UpdateRemapping(IPaletteContent paletteContent, PaletteState paletteState) { // Cache new values _paletteContent = paletteContent; _paletteState = paletteState; // Update each remapping instance in turn foreach (ButtonSpecView view in ButtonSpecViews) { // Cast the remapping palette to the correct type ButtonSpecRemapByContentCache remapPalette = (ButtonSpecRemapByContentCache)view.RemapPalette; remapPalette.SetPaletteContent(_paletteContent); remapPalette.SetPaletteState(_paletteState); } }