/// <summary> /// Gets the image to display for the button. /// </summary> /// <param name="style">Style of button spec.</param> /// <param name="state">State for which image is required.</param> /// <returns>Image value.</returns> public override Image GetButtonSpecImage(PaletteButtonSpecStyle style, PaletteState state) { switch (style) { case PaletteButtonSpecStyle.FormClose: switch (state) { case PaletteState.Tracking: case PaletteState.Pressed: return(_formCloseH); default: return(_formClose); } case PaletteButtonSpecStyle.FormMin: return(_formMin); case PaletteButtonSpecStyle.FormMax: return(_formMax); case PaletteButtonSpecStyle.FormRestore: return(_formRestore); default: return(base.GetButtonSpecImage(style, state)); } }
/// <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> /// Gets the button style used for drawing the button. /// </summary> /// <param name="style">Style of button spec.</param> /// <returns>PaletteButtonStyle value.</returns> public virtual PaletteButtonStyle GetButtonSpecStyle(PaletteButtonSpecStyle style) { if (Style != PaletteButtonStyle.Inherit) { return(Style); } else { return(_redirector.GetButtonSpecStyle(style)); } }
/// <summary> /// Gets the edge to positon the button against. /// </summary> /// <param name="style">Style of button spec.</param> /// <returns>PaletteRelativeEdgeAlign value.</returns> public virtual PaletteRelativeEdgeAlign GetButtonSpecEdge(PaletteButtonSpecStyle style) { if (Edge != PaletteRelativeEdgeAlign.Inherit) { return(Edge); } else { return(_redirector.GetButtonSpecEdge(style)); } }
/// <summary> /// Gets the button orientation. /// </summary> /// <param name="style">Style of button spec.</param> /// <returns>PaletteButtonOrientation value.</returns> public virtual PaletteButtonOrientation GetButtonSpecOrientation(PaletteButtonSpecStyle style) { if (Orientation != PaletteButtonOrientation.Inherit) { return(Orientation); } else { return(_redirector.GetButtonSpecOrientation(style)); } }
/// <summary> /// Initialize a new instance of the ButtonSpecFormFixed class. /// </summary> /// <param name="form">Reference to owning krypton form.</param> /// <param name="fixedStyle">Fixed style to use.</param> public ButtonSpecFormFixed(KryptonForm form, PaletteButtonSpecStyle fixedStyle) { Debug.Assert(form != null); // Remember back reference to owning navigator. _form = form; // Fix the type ProtectedType = fixedStyle; }
/// <summary> /// Gets the image to display for the button. /// </summary> /// <param name="style">Style of button spec.</param> /// <param name="state">State for which image is required.</param> /// <returns> /// Image value. /// </returns> public override Image GetButtonSpecImage(PaletteButtonSpecStyle style, PaletteState state) { return(style switch { PaletteButtonSpecStyle.FormClose => state switch { PaletteState.Tracking => _formCloseHover, PaletteState.Normal => _formCloseNormal, PaletteState.Pressed => _formClosePressed, _ => _formCloseDisabled },
/// <summary> /// Gets the long text to display for the button. /// </summary> /// <param name="style">Style of button spec.</param> /// <returns>String value.</returns> public override string GetButtonSpecLongText(PaletteButtonSpecStyle style) { if ((ExtraText.Length > 0) || !AllowInheritExtraText) { return(ExtraText); } else { return(base.GetButtonSpecLongText(style)); } }
/// <summary> /// Gets the tooltip title text to display for the button. /// </summary> /// <param name="style">Style of button spec.</param> /// <returns>String value.</returns> public override string GetButtonSpecToolTipTitle(PaletteButtonSpecStyle style) { if ((ToolTipTitle.Length > 0) || !AllowInheritToolTipTitle) { return(ToolTipTitle); } else { return(base.GetButtonSpecToolTipTitle(style)); } }
/// <summary> /// Gets the color to remap from the image to the container foreground. /// </summary> /// <param name="style">Style of button spec.</param> /// <returns>Color value.</returns> public override Color GetButtonSpecColorMap(PaletteButtonSpecStyle style) { if (ColorMap != Color.Empty) { return(ColorMap); } else { return(base.GetButtonSpecColorMap(style)); } }
/// <summary> /// Initialize a new instance of the ButtonSpecFormFixed class. /// </summary> /// <param name="form">Reference to owning krypton form.</param> /// <param name="fixedStyle">Fixed style to use.</param> public ButtonSpecFormFixed(KryptonFormWithDropShadow form, PaletteButtonSpecStyle fixedStyle) { Debug.Assert(form != null); // Remember back reference to owning navigator. KryptonForm = form; // Fix the type ProtectedType = fixedStyle; }
/// <summary> /// Initialize a new instance of the ButtonSpecCalendar class. /// </summary> /// <param name="month">Reference to owning view.</param> /// <param name="fixedStyle">Fixed style to use.</param> /// <param name="edge">Alignment edge.</param> public ButtonSpecCalendar(ViewDrawMonth month, PaletteButtonSpecStyle fixedStyle, RelativeEdgeAlign edge) { // Remember back reference to owning navigator. _edge = edge; Enabled = true; Visible = true; // Fix the type ProtectedType = fixedStyle; }
/// <summary> /// Initialize a new instance of the ButtonSpecNavFixed class. /// </summary> /// <param name="navigator">Reference to owning navigator instance.</param> /// <param name="fixedStyle">Fixed style to use.</param> public ButtonSpecNavFixed(KryptonNavigator navigator, PaletteButtonSpecStyle fixedStyle) { Debug.Assert(navigator != null); // Remember back reference to owning navigator. _navigator = navigator; // Fix the type ProtectedType = fixedStyle; // Default other properties _location = HeaderLocation.PrimaryHeader; }
/// <summary> /// Gets the image to display for the button. /// </summary> /// <param name="style">Style of button spec.</param> /// <param name="state">State for which image is required.</param> /// <returns>Image value.</returns> public override Image GetButtonSpecImage(PaletteButtonSpecStyle style, PaletteState state) { Image image = null; // Try and recover a state specific image switch (state) { case PaletteState.Disabled: image = ImageStates.ImageDisabled; break; case PaletteState.Normal: image = ImageStates.ImageNormal; break; case PaletteState.Pressed: image = ImageStates.ImagePressed; break; case PaletteState.Tracking: image = ImageStates.ImageTracking; break; case PaletteState.CheckedNormal: image = ImageStates.ImageCheckedNormal; break; case PaletteState.CheckedPressed: image = ImageStates.ImageCheckedPressed; break; case PaletteState.CheckedTracking: image = ImageStates.ImageCheckedTracking; break; } // Default to the image if no state specific image is found if (image == null) { image = Image; } if ((image != null) || !AllowInheritImage) { return(image); } return(base.GetButtonSpecImage(style, state)); }
/// <summary> /// Initialize a new instance of the ButtonSpecNavFixed class. /// </summary> /// <param name="navigator">Reference to owning navigator instance.</param> /// <param name="fixedStyle">Fixed style to use.</param> public ButtonSpecNavFixed(KryptonNavigator navigator, PaletteButtonSpecStyle fixedStyle) { Debug.Assert(navigator != null); // Remember back reference to owning navigator. _navigator = navigator; // Fix the type ProtectedType = fixedStyle; // Default other properties _location = HeaderLocation.PrimaryHeader; }
/// <summary> /// Gets the image to display for the button. /// </summary> /// <param name="style">Style of button spec.</param> /// <param name="state">State for which image is required.</param> /// <returns>Image value.</returns> public override Image GetButtonSpecImage(PaletteButtonSpecStyle style, PaletteState state) { switch (style) { case PaletteButtonSpecStyle.FormClose: if (state == PaletteState.Disabled) { return(_blueCloseI); } else { return(_blueCloseA); } case PaletteButtonSpecStyle.FormMin: if (state == PaletteState.Disabled) { return(_blueMinI); } else { return(_blueMinA); } case PaletteButtonSpecStyle.FormMax: if (state == PaletteState.Disabled) { return(_blueMaxI); } else { return(_blueMaxA); } case PaletteButtonSpecStyle.FormRestore: if (state == PaletteState.Disabled) { return(_blueRestoreI); } else { return(_blueRestoreA); } default: return(base.GetButtonSpecImage(style, state)); } }
/// <summary> /// Initialize a new instance of the ButtonSpecCalendar class. /// </summary> /// <param name="month">Reference to owning view.</param> /// <param name="fixedStyle">Fixed style to use.</param> /// <param name="edge">Alignment edge.</param> public ButtonSpecCalendar(ViewDrawMonth month, PaletteButtonSpecStyle fixedStyle, RelativeEdgeAlign edge) { Debug.Assert(month != null); // Remember back reference to owning navigator. _month = month; _edge = edge; _enabled = true; _visible = true; // Fix the type ProtectedType = fixedStyle; }
/// <summary> /// Populate values from the base palette. /// </summary> /// <param name="style">The style of the button spec instance.</param> public override void PopulateFromBase(PaletteButtonSpecStyle style) { base.PopulateFromBase(style); Image = Redirector.GetButtonSpecImage(style, PaletteState.Normal); ImageStates.ImageDisabled = Redirector.GetButtonSpecImage(style, PaletteState.Disabled); ImageStates.ImageNormal = Redirector.GetButtonSpecImage(style, PaletteState.Normal); ImageStates.ImageTracking = Redirector.GetButtonSpecImage(style, PaletteState.Tracking); ImageStates.ImagePressed = Redirector.GetButtonSpecImage(style, PaletteState.Pressed); ImageStates.ImageCheckedNormal = Redirector.GetButtonSpecImage(style, PaletteState.CheckedNormal); ImageStates.ImageCheckedTracking = Redirector.GetButtonSpecImage(style, PaletteState.CheckedTracking); ImageStates.ImageCheckedPressed = Redirector.GetButtonSpecImage(style, PaletteState.CheckedPressed); Text = Redirector.GetButtonSpecShortText(style); ExtraText = Redirector.GetButtonSpecLongText(style); ColorMap = Redirector.GetButtonSpecColorMap(style); }
/// <summary> /// Initialize a new instance of the ButtonSpecCalendar class. /// </summary> /// <param name="month">Reference to owning view.</param> /// <param name="fixedStyle">Fixed style to use.</param> /// <param name="edge">Alignment edge.</param> public ButtonSpecCalendar(ViewDrawMonth month, PaletteButtonSpecStyle fixedStyle, RelativeEdgeAlign edge) { Debug.Assert(month != null); // Remember back reference to owning navigator. _month = month; _edge = edge; _enabled = true; _visible = true; // Fix the type ProtectedType = fixedStyle; }
/// <summary> /// Gets the button style used for drawing the button. /// </summary> /// <param name="style">Style of button spec.</param> /// <returns>PaletteButtonStyle value.</returns> public override PaletteButtonStyle GetButtonSpecStyle(PaletteButtonSpecStyle style) { return(_inherit.GetButtonSpecStyle(style)); }
/// <summary> /// Gets the long text to display for the button. /// </summary> /// <param name="style">Style of button spec.</param> /// <returns>String value.</returns> public override string GetButtonSpecLongText(PaletteButtonSpecStyle style) { return(_inherit.GetButtonSpecLongText(style)); }
/// <summary> /// Gets the button orientation. /// </summary> /// <param name="style">Style of button spec.</param> /// <returns>PaletteButtonOrientation value.</returns> public override PaletteButtonOrientation GetButtonSpecOrientation(PaletteButtonSpecStyle style) { return(_inherit.GetButtonSpecOrientation(style)); }
/// <summary> /// Gets the color to remap from the image to the container foreground. /// </summary> /// <param name="style">Style of button spec.</param> /// <returns>Color value.</returns> public override Color GetButtonSpecColorMap(PaletteButtonSpecStyle style) { return _inherit.GetButtonSpecColorMap(style); }
/// <summary> /// Gets the image to display for the button. /// </summary> /// <param name="style">Style of button spec.</param> /// <param name="state">State for which image is required.</param> /// <returns>Image value.</returns> public override Image GetButtonSpecImage(PaletteButtonSpecStyle style, PaletteState state) { return _inherit.GetButtonSpecImage(style, state); }
private PaletteNavButtonSpecStyle PaletteTypeToNavigator(PaletteButtonSpecStyle type) { switch (type) { case PaletteButtonSpecStyle.Generic: return PaletteNavButtonSpecStyle.Generic; case PaletteButtonSpecStyle.ArrowUp: return PaletteNavButtonSpecStyle.ArrowUp; case PaletteButtonSpecStyle.ArrowRight: return PaletteNavButtonSpecStyle.ArrowRight; case PaletteButtonSpecStyle.ArrowLeft: return PaletteNavButtonSpecStyle.ArrowLeft; case PaletteButtonSpecStyle.ArrowDown: return PaletteNavButtonSpecStyle.ArrowDown; case PaletteButtonSpecStyle.DropDown: return PaletteNavButtonSpecStyle.DropDown; case PaletteButtonSpecStyle.PinVertical: return PaletteNavButtonSpecStyle.PinVertical; case PaletteButtonSpecStyle.PinHorizontal: return PaletteNavButtonSpecStyle.PinHorizontal; case PaletteButtonSpecStyle.FormClose: return PaletteNavButtonSpecStyle.FormClose; case PaletteButtonSpecStyle.FormMax: return PaletteNavButtonSpecStyle.FormMax; case PaletteButtonSpecStyle.FormMin: return PaletteNavButtonSpecStyle.FormMin; case PaletteButtonSpecStyle.FormRestore: return PaletteNavButtonSpecStyle.FormRestore; case PaletteButtonSpecStyle.PendantClose: return PaletteNavButtonSpecStyle.PendantClose; case PaletteButtonSpecStyle.PendantMin: return PaletteNavButtonSpecStyle.PendantMin; case PaletteButtonSpecStyle.PendantRestore: return PaletteNavButtonSpecStyle.PendantRestore; case PaletteButtonSpecStyle.WorkspaceMaximize: return PaletteNavButtonSpecStyle.WorkspaceMaximize; case PaletteButtonSpecStyle.WorkspaceRestore: return PaletteNavButtonSpecStyle.WorkspaceRestore; case PaletteButtonSpecStyle.RibbonMinimize: return PaletteNavButtonSpecStyle.RibbonMinimize; case PaletteButtonSpecStyle.RibbonExpand: return PaletteNavButtonSpecStyle.RibbonExpand; default: // Should never happen! Debug.Assert(false); return PaletteNavButtonSpecStyle.Generic; } }
/// <summary> /// Gets the short text to display for the button. /// </summary> /// <param name="style">Style of button spec.</param> /// <returns>String value.</returns> public virtual string GetButtonSpecShortText(PaletteButtonSpecStyle style) { return _redirector.GetButtonSpecShortText(style); }
/// <summary> /// Get the location for the button. /// </summary> /// <param name="style">Style of button spec.</param> /// <returns>HeaderLocation value.</returns> public virtual HeaderLocation GetButtonSpecLocation(PaletteButtonSpecStyle style) { return _redirector.GetButtonSpecLocation(style); }
/// <summary> /// Gets the image to display for the button. /// </summary> /// <param name="style">Style of button spec.</param> /// <param name="state">State for which image is required.</param> /// <returns>Image value.</returns> public override Image GetButtonSpecImage(PaletteButtonSpecStyle style, PaletteState state) { Image image = null; // Try and recover a state specific image switch (state) { case PaletteState.Disabled: image = ImageStates.ImageDisabled; break; case PaletteState.Normal: image = ImageStates.ImageNormal; break; case PaletteState.Pressed: image = ImageStates.ImagePressed; break; case PaletteState.Tracking: image = ImageStates.ImageTracking; break; case PaletteState.CheckedNormal: image = ImageStates.ImageCheckedNormal; break; case PaletteState.CheckedPressed: image = ImageStates.ImageCheckedPressed; break; case PaletteState.CheckedTracking: image = ImageStates.ImageCheckedTracking; break; } // Default to the image if no state specific image is found if (image == null) image = Image; if ((image != null) || !AllowInheritImage) return image; return base.GetButtonSpecImage(style, state); }
/// <summary> /// Gets the color to remap from the image to the container foreground. /// </summary> /// <param name="style">Style of button spec.</param> /// <returns>Color value.</returns> public override Color GetButtonSpecColorMap(PaletteButtonSpecStyle style) { if (ColorMap != Color.Empty) return ColorMap; else return base.GetButtonSpecColorMap(style); }
/// <summary> /// Gets the image to display for the button. /// </summary> /// <param name="style">Style of button spec.</param> /// <param name="state">State for which image is required.</param> /// <returns>Image value.</returns> public override Image GetButtonSpecImage(PaletteButtonSpecStyle style, PaletteState state) { switch (style) { case PaletteButtonSpecStyle.FormClose: if (state == PaletteState.Disabled) return _silverCloseI; else return _silverCloseA; case PaletteButtonSpecStyle.FormMin: if (state == PaletteState.Disabled) return _silverMinI; else return _silverMinA; case PaletteButtonSpecStyle.FormMax: if (state == PaletteState.Disabled) return _silverMaxI; else return _silverMaxA; case PaletteButtonSpecStyle.FormRestore: if (state == PaletteState.Disabled) return _silverRestoreI; else return _silverRestoreA; default: return base.GetButtonSpecImage(style, state); } }
/// <summary> /// Populate values from the base palette. /// </summary> /// <param name="style">The style of the button spec instance.</param> public virtual void PopulateFromBase(PaletteButtonSpecStyle style) { Style = _redirector.GetButtonSpecStyle(style); Orientation = _redirector.GetButtonSpecOrientation(style); Edge = _redirector.GetButtonSpecEdge(style); }
/// <summary> /// Gets the tooltip title text to display for the button. /// </summary> /// <param name="style">Style of button spec.</param> /// <returns>String value.</returns> public virtual string GetButtonSpecToolTipTitle(PaletteButtonSpecStyle style) { return _redirector.GetButtonSpecToolTipTitle(style); }
/// <summary> /// Gets the button style used for drawing the button. /// </summary> /// <param name="style">Style of button spec.</param> /// <returns>PaletteButtonStyle value.</returns> public virtual PaletteButtonStyle GetButtonSpecStyle(PaletteButtonSpecStyle style) { if (Style != PaletteButtonStyle.Inherit) return Style; else return _redirector.GetButtonSpecStyle(style); }
/// <summary> /// Gets the image to display for the button. /// </summary> /// <param name="style">Style of button spec.</param> /// <param name="state">State for which image is required.</param> /// <returns>Image value.</returns> public override Image GetButtonSpecImage(PaletteButtonSpecStyle style, PaletteState state) { switch (style) { case PaletteButtonSpecStyle.FormClose: switch (state) { case PaletteState.Tracking: case PaletteState.Pressed: return _formCloseH; default: return _formClose; } case PaletteButtonSpecStyle.FormMin: return _formMin; case PaletteButtonSpecStyle.FormMax: return _formMax; case PaletteButtonSpecStyle.FormRestore: return _formRestore; default: return base.GetButtonSpecImage(style, state); } }
/// <summary> /// Gets the long text to display for the button. /// </summary> /// <param name="style">Style of button spec.</param> /// <returns>String value.</returns> public override string GetButtonSpecLongText(PaletteButtonSpecStyle style) { if ((ExtraText.Length > 0) || !AllowInheritExtraText) return ExtraText; else return base.GetButtonSpecLongText(style); }
/// <summary> /// Gets the button orientation. /// </summary> /// <param name="style">Style of button spec.</param> /// <returns>PaletteButtonOrientation value.</returns> public virtual PaletteButtonOrientation GetButtonSpecOrientation(PaletteButtonSpecStyle style) { if (Orientation != PaletteButtonOrientation.Inherit) return Orientation; else return _redirector.GetButtonSpecOrientation(style); }
/// <summary> /// Initialize a new instance of the ButtonSpecMdiChildFixed class. /// </summary> /// <param name="fixedStyle">Fixed style to use.</param> public ButtonSpecMdiChildFixed(PaletteButtonSpecStyle fixedStyle) { // Fix the type ProtectedType = fixedStyle; }
/// <summary> /// Gets the short text to display for the button. /// </summary> /// <param name="style">Style of button spec.</param> /// <returns>String value.</returns> public override string GetButtonSpecShortText(PaletteButtonSpecStyle style) { if ((Text.Length > 0) || !AllowInheritText) return Text; else return base.GetButtonSpecShortText(style); }
/// <summary> /// Initialize a new instance of the ButtonSpecMdiChildFixed class. /// </summary> /// <param name="fixedStyle">Fixed style to use.</param> public ButtonSpecMdiChildFixed(PaletteButtonSpecStyle fixedStyle) { // Fix the type ProtectedType = fixedStyle; }
/// <summary> /// Gets the image to display for the button. /// </summary> /// <param name="style">Style of button spec.</param> /// <param name="state">State for which image is required.</param> /// <returns>Image value.</returns> public virtual Image GetButtonSpecImage(PaletteButtonSpecStyle style, PaletteState state) { return _redirector.GetButtonSpecImage(style, state); }
/// <summary> /// Get the location for the button. /// </summary> /// <param name="style">Style of button spec.</param> /// <returns>HeaderLocation value.</returns> public override HeaderLocation GetButtonSpecLocation(PaletteButtonSpecStyle style) { return _inherit.GetButtonSpecLocation(style); }
/// <summary> /// Gets the image to display for the button. /// </summary> /// <param name="style">Style of button spec.</param> /// <param name="state">State for which image is required.</param> /// <returns>Image value.</returns> public override Image GetButtonSpecImage(PaletteButtonSpecStyle style, PaletteState state) { switch (style) { case PaletteButtonSpecStyle.FormClose: switch (state) { case PaletteState.Disabled: return(_blackCloseI); case PaletteState.Tracking: return(_blackCloseAH); default: return(_blackCloseA); } case PaletteButtonSpecStyle.FormMin: switch (state) { case PaletteState.Disabled: return(_blackMinI); case PaletteState.Tracking: return(_blackMinAH); default: return(_blackMinA); } case PaletteButtonSpecStyle.FormMax: switch (state) { case PaletteState.Disabled: return(_blackMaxI); case PaletteState.Tracking: return(_blackMaxAH); default: return(_blackMaxA); } case PaletteButtonSpecStyle.FormRestore: switch (state) { case PaletteState.Disabled: return(_blackRestoreI); case PaletteState.Tracking: return(_blackRestoreAH); default: return(_blackRestoreA); } case PaletteButtonSpecStyle.RibbonMinimize: return(_blackRibbonMinimize); case PaletteButtonSpecStyle.RibbonExpand: return(_blackRibbonExpand); default: return(base.GetButtonSpecImage(style, state)); } }
/// <summary> /// Gets the edge to positon the button against. /// </summary> /// <param name="style">Style of button spec.</param> /// <returns>PaletteRelativeEdgeAlign value.</returns> public override PaletteRelativeEdgeAlign GetButtonSpecEdge(PaletteButtonSpecStyle style) { return _inherit.GetButtonSpecEdge(style); }
/// <summary> /// Gets the icon to display for the button. /// </summary> /// <param name="style">Style of button spec.</param> /// <returns>Icon value.</returns> public virtual Icon GetButtonSpecIcon(PaletteButtonSpecStyle style) { return _redirector.GetButtonSpecIcon(style); }
/// <summary> /// Gets the edge to positon the button against. /// </summary> /// <param name="style">Style of button spec.</param> /// <returns>PaletteRelativeEdgeAlign value.</returns> public override PaletteRelativeEdgeAlign GetButtonSpecEdge(PaletteButtonSpecStyle style) { return(_inherit.GetButtonSpecEdge(style)); }
/// <summary> /// Gets the button style used for drawing the button. /// </summary> /// <param name="style">Style of button spec.</param> /// <returns>PaletteButtonStyle value.</returns> public override PaletteButtonStyle GetButtonSpecStyle(PaletteButtonSpecStyle style) { switch (style) { case PaletteButtonSpecStyle.FormMin: case PaletteButtonSpecStyle.FormMax: case PaletteButtonSpecStyle.FormRestore: return PaletteButtonStyle.Form; case PaletteButtonSpecStyle.FormClose: return PaletteButtonStyle.FormClose; case PaletteButtonSpecStyle.Generic: case PaletteButtonSpecStyle.Close: case PaletteButtonSpecStyle.Context: case PaletteButtonSpecStyle.Next: case PaletteButtonSpecStyle.Previous: case PaletteButtonSpecStyle.ArrowLeft: case PaletteButtonSpecStyle.ArrowRight: case PaletteButtonSpecStyle.ArrowUp: case PaletteButtonSpecStyle.ArrowDown: case PaletteButtonSpecStyle.DropDown: case PaletteButtonSpecStyle.PinVertical: case PaletteButtonSpecStyle.PinHorizontal: case PaletteButtonSpecStyle.PendantClose: case PaletteButtonSpecStyle.PendantMin: case PaletteButtonSpecStyle.PendantRestore: case PaletteButtonSpecStyle.WorkspaceMaximize: case PaletteButtonSpecStyle.WorkspaceRestore: case PaletteButtonSpecStyle.RibbonMinimize: case PaletteButtonSpecStyle.RibbonExpand: return PaletteButtonStyle.ButtonSpec; default: // Should never happen! Debug.Assert(false); return PaletteButtonStyle.ButtonSpec; } }
/// <summary> /// Gets the image to display for the button. /// </summary> /// <param name="style">Style of button spec.</param> /// <param name="state">State for which image is required.</param> /// <returns>Image value.</returns> public override Image GetButtonSpecImage(PaletteButtonSpecStyle style, PaletteState state) { return(_inherit.GetButtonSpecImage(style, state)); }
/// <summary> /// Gets the edge to positon the button against. /// </summary> /// <param name="style">Style of button spec.</param> /// <returns>PaletteRelativeEdgeAlign value.</returns> public virtual PaletteRelativeEdgeAlign GetButtonSpecEdge(PaletteButtonSpecStyle style) { if (Edge != PaletteRelativeEdgeAlign.Inherit) return Edge; else return _redirector.GetButtonSpecEdge(style); }
/// <summary> /// Gets the color to remap from the image to the container foreground. /// </summary> /// <param name="style">Style of button spec.</param> /// <returns>Color value.</returns> public override Color GetButtonSpecColorMap(PaletteButtonSpecStyle style) { return(_inherit.GetButtonSpecColorMap(style)); }
/// <summary> /// Gets the tooltip title text to display for the button. /// </summary> /// <param name="style">Style of button spec.</param> /// <returns>String value.</returns> public virtual string GetButtonSpecToolTipTitle(PaletteButtonSpecStyle style) { return(_redirector.GetButtonSpecToolTipTitle(style)); }
/// <summary> /// Get the location for the button. /// </summary> /// <param name="style">Style of button spec.</param> /// <returns>HeaderLocation value.</returns> public override HeaderLocation GetButtonSpecLocation(PaletteButtonSpecStyle style) { return(_inherit.GetButtonSpecLocation(style)); }
/// <summary> /// Gets the color to remap from the image to the container foreground. /// </summary> /// <param name="style">Style of button spec.</param> /// <returns>Color value.</returns> public virtual Color GetButtonSpecColorMap(PaletteButtonSpecStyle style) { return(_redirector.GetButtonSpecColorMap(style)); }
/// <summary> /// Gets the color to remap from the image to the container foreground. /// </summary> /// <param name="style">Style of button spec.</param> /// <returns>Color value.</returns> public virtual Color GetButtonSpecColorMap(PaletteButtonSpecStyle style) { return _redirector.GetButtonSpecColorMap(style); }
/// <summary> /// Get the location for the button. /// </summary> /// <param name="style">Style of button spec.</param> /// <returns>HeaderLocation value.</returns> public virtual HeaderLocation GetButtonSpecLocation(PaletteButtonSpecStyle style) { return(_redirector.GetButtonSpecLocation(style)); }
/// <summary> /// Gets the tooltip title text to display for the button. /// </summary> /// <param name="style">Style of button spec.</param> /// <returns>String value.</returns> public override string GetButtonSpecToolTipTitle(PaletteButtonSpecStyle style) { if ((ToolTipTitle.Length > 0) || !AllowInheritToolTipTitle) return ToolTipTitle; else return base.GetButtonSpecToolTipTitle(style); }
/// <summary> /// Gets the image transparent color. /// </summary> /// <param name="style">Style of button spec.</param> /// <returns>Color value.</returns> public virtual Color GetButtonSpecImageTransparentColor(PaletteButtonSpecStyle style) { return _redirector.GetButtonSpecImageTransparentColor(style); }
/// <summary> /// Raises the RenderItemImage event. /// </summary> /// <param name="e">An ToolStripItemImageRenderEventArgs containing the event data.</param> protected override void OnRenderItemImage(ToolStripItemImageRenderEventArgs e) { // Is this a min/restore/close pendant button if (e.Item.GetType().ToString() == "System.Windows.Forms.MdiControlStrip+ControlBoxMenuItem") { // Get access to the owning form of the mdi control strip if (e.ToolStrip.Parent.TopLevelControl is Form f) { // Get the mdi control strip instance PropertyInfo piMCS = typeof(Form).GetProperty("MdiControlStrip", BindingFlags.Instance | BindingFlags.NonPublic | BindingFlags.GetField); if (piMCS != null) { object mcs = piMCS.GetValue(f, null); if (mcs != null) { // Get the min/restore/close internal menu items Type mcsType = mcs.GetType(); FieldInfo fiM = mcsType.GetField("minimize", BindingFlags.Instance | BindingFlags.NonPublic | BindingFlags.GetField); FieldInfo fiR = mcsType.GetField("restore", BindingFlags.Instance | BindingFlags.NonPublic | BindingFlags.GetField); FieldInfo fiC = mcsType.GetField("close", BindingFlags.Instance | BindingFlags.NonPublic | BindingFlags.GetField); if ((fiM != null) && (fiR != null) && (fiC != null)) { ToolStripMenuItem m = fiM.GetValue(mcs) as ToolStripMenuItem; ToolStripMenuItem r = fiR.GetValue(mcs) as ToolStripMenuItem; ToolStripMenuItem c = fiC.GetValue(mcs) as ToolStripMenuItem; if ((m != null) && (r != null) && (c != null)) { // Compare the event provided image with the internal cached ones to discover the type of pendant button we are drawing PaletteButtonSpecStyle specStyle = PaletteButtonSpecStyle.Generic; if (m.Image == e.Image) { specStyle = PaletteButtonSpecStyle.PendantMin; } else if (r.Image == e.Image) { specStyle = PaletteButtonSpecStyle.PendantRestore; } else if (c.Image == e.Image) { specStyle = PaletteButtonSpecStyle.PendantClose; } // A match, means we have a known pendant button if (specStyle != PaletteButtonSpecStyle.Generic) { // Grab the palette pendant details needed for drawing Image paletteImage = KCT.Palette.GetButtonSpecImage(specStyle, PaletteState.Normal); Color transparentColor = KCT.Palette.GetButtonSpecImageTransparentColor(specStyle); // Finally we actually have an image to draw! if (paletteImage != null) { using (ImageAttributes attribs = new ImageAttributes()) { // Setup mapping to make required color transparent ColorMap remap = new ColorMap { OldColor = transparentColor, NewColor = Color.Transparent }; attribs.SetRemapTable(new ColorMap[] { remap }); // Phew, actually draw the darn thing e.Graphics.DrawImage(paletteImage, e.ImageRectangle, 0, 0, e.Image.Width, e.Image.Height, GraphicsUnit.Pixel, attribs); // Do not let base class draw system defined image return; } } } } } } } } } base.OnRenderItemImage(e); }
/// <summary> /// Populate values from the base palette. /// </summary> /// <param name="style">The style of the button spec instance.</param> public override void PopulateFromBase(PaletteButtonSpecStyle style) { base.PopulateFromBase(style); Image = Redirector.GetButtonSpecImage(style, PaletteState.Normal); ImageStates.ImageDisabled = Redirector.GetButtonSpecImage(style, PaletteState.Disabled); ImageStates.ImageNormal = Redirector.GetButtonSpecImage(style, PaletteState.Normal); ImageStates.ImageTracking = Redirector.GetButtonSpecImage(style, PaletteState.Tracking); ImageStates.ImagePressed = Redirector.GetButtonSpecImage(style, PaletteState.Pressed); ImageStates.ImageCheckedNormal = Redirector.GetButtonSpecImage(style, PaletteState.CheckedNormal); ImageStates.ImageCheckedTracking = Redirector.GetButtonSpecImage(style, PaletteState.CheckedTracking); ImageStates.ImageCheckedPressed = Redirector.GetButtonSpecImage(style, PaletteState.CheckedPressed); Text = Redirector.GetButtonSpecShortText(style); ExtraText = Redirector.GetButtonSpecLongText(style); ColorMap = Redirector.GetButtonSpecColorMap(style); }
/// <summary> /// Populate values from the base palette. /// </summary> /// <param name="style">The style of the button spec instance.</param> public virtual void PopulateFromBase(PaletteButtonSpecStyle style) { Style = Redirector.GetButtonSpecStyle(style); Orientation = Redirector.GetButtonSpecOrientation(style); Edge = Redirector.GetButtonSpecEdge(style); }
/// <summary> /// Gets the image to display for the button. /// </summary> /// <param name="style">Style of button spec.</param> /// <param name="state">State for which image is required.</param> /// <returns>Image value.</returns> public override Image GetButtonSpecImage(PaletteButtonSpecStyle style, PaletteState state) { switch (style) { case PaletteButtonSpecStyle.Close: return _buttonSpecClose; case PaletteButtonSpecStyle.Context: return _buttonSpecContext; case PaletteButtonSpecStyle.Next: return _buttonSpecNext; case PaletteButtonSpecStyle.Previous: return _buttonSpecPrevious; case PaletteButtonSpecStyle.ArrowLeft: return _buttonSpecArrowLeft; case PaletteButtonSpecStyle.ArrowRight: return _buttonSpecArrowRight; case PaletteButtonSpecStyle.ArrowUp: return _buttonSpecArrowUp; case PaletteButtonSpecStyle.ArrowDown: return _buttonSpecArrowDown; case PaletteButtonSpecStyle.DropDown: return _buttonSpecDropDown; case PaletteButtonSpecStyle.PinVertical: return _buttonSpecPinVertical; case PaletteButtonSpecStyle.PinHorizontal: return _buttonSpecPinHorizontal; case PaletteButtonSpecStyle.PendantClose: return _buttonSpecPendantClose; case PaletteButtonSpecStyle.PendantMin: return _buttonSpecPendantMin; case PaletteButtonSpecStyle.PendantRestore: return _buttonSpecPendantRestore; case PaletteButtonSpecStyle.WorkspaceMaximize: return _buttonSpecWorkspaceMaximize; case PaletteButtonSpecStyle.WorkspaceRestore: return _buttonSpecWorkspaceRestore; case PaletteButtonSpecStyle.RibbonMinimize: return _buttonSpecRibbonMinimize; case PaletteButtonSpecStyle.RibbonExpand: return _buttonSpecRibbonExpand; case PaletteButtonSpecStyle.Generic: return null; default: // Should never happen! Debug.Assert(false); return null; } }