/// <summary> /// Initialize a new instance of the KryptonContextMenuCheckBox class. /// </summary> /// <param name="initialText">Initial text for display.</param> public KryptonContextMenuCheckBox(string initialText) { // Default fields _enabled = true; _autoClose = false; _text = initialText; _extraText = string.Empty; _image = null; _imageTransparentColor = Color.Empty; _checkState = CheckState.Unchecked; _checked = false; _threeState = false; _autoCheck = true; _style = LabelStyle.NormalControl; Images = new CheckBoxImages(); // Create the redirectors _stateCommonRedirect = new PaletteContentInheritRedirect(PaletteContentStyle.LabelNormalControl); StateCheckBoxImages = new PaletteRedirectCheckBox(Images); // Create the states StateCommon = new PaletteContent(_stateCommonRedirect); StateDisabled = new PaletteContent(StateCommon); StateNormal = new PaletteContent(StateCommon); OverrideFocus = new PaletteContent(_stateCommonRedirect); // Override the normal/disabled values with the focus, when the control has focus OverrideNormal = new PaletteContentInheritOverride(OverrideFocus, StateNormal, PaletteState.FocusOverride, false); OverrideDisabled = new PaletteContentInheritOverride(OverrideFocus, StateDisabled, PaletteState.FocusOverride, false); }
/// <summary> /// Initialize a new instance of the KryptonContextMenuLinkLabel class. /// </summary> /// <param name="initialText">Initial text for display.</param> public KryptonContextMenuLinkLabel(string initialText) { // Default fields _text = initialText; _extraText = string.Empty; _image = null; _imageTransparentColor = Color.Empty; _style = LabelStyle.NormalControl; _autoClose = true; // Create the redirectors _stateNormalRedirect = new PaletteContentInheritRedirect(PaletteContentStyle.LabelNormalControl); _stateVisitedRedirect = new PaletteContentInheritRedirect(PaletteContentStyle.LabelNormalControl); _stateNotVisitedRedirect = new PaletteContentInheritRedirect(PaletteContentStyle.LabelNormalControl); _statePressedRedirect = new PaletteContentInheritRedirect(PaletteContentStyle.LabelNormalControl); _stateFocusRedirect = new PaletteContentInheritRedirect(PaletteContentStyle.LabelNormalControl); // Create the states _stateNormal = new PaletteContent(_stateNormalRedirect); _stateVisited = new PaletteContent(_stateVisitedRedirect); _stateNotVisited = new PaletteContent(_stateNotVisitedRedirect); _stateFocus = new PaletteContent(_stateFocusRedirect); _statePressed = new PaletteContent(_statePressedRedirect); // Override the normal state to implement the underling logic _inheritBehavior = new LinkLabelBehaviorInherit(_stateNormal, KryptonLinkBehavior.AlwaysUnderline); // Create the override handling classes _overrideVisited = new PaletteContentInheritOverride(_stateVisited, _inheritBehavior, PaletteState.LinkVisitedOverride, false); _overrideNotVisited = new PaletteContentInheritOverride(_stateNotVisited, _overrideVisited, PaletteState.LinkNotVisitedOverride, true); _overrideFocusNotVisited = new PaletteContentInheritOverride(_stateFocus, _overrideNotVisited, PaletteState.FocusOverride, false); _overridePressed = new PaletteContentInheritOverride(_statePressed, _inheritBehavior, PaletteState.LinkPressedOverride, true); _overridePressedFocus = new PaletteContentInheritOverride(_stateFocus, _overridePressed, PaletteState.FocusOverride, false); }
/// <summary> /// Initialize a new instance of the KryptonLabel class. /// </summary> public KryptonLabel() { // The label cannot take the focus SetStyle(ControlStyles.Selectable, false); // Set default properties _style = LabelStyle.NormalControl; _useMnemonic = true; _orientation = VisualOrientation.Top; _target = null; _enabledTarget = true; // Create content storage _labelValues = new LabelValues(NeedPaintDelegate); _labelValues.TextChanged += new EventHandler(OnLabelTextChanged); // Create palette redirector _paletteCommonRedirect = new PaletteContentInheritRedirect(Redirector, PaletteContentStyle.LabelNormalControl); // Create the palette provider _stateCommon = new PaletteContent(_paletteCommonRedirect, NeedPaintDelegate); _stateDisabled = new PaletteContent(_stateCommon, NeedPaintDelegate); _stateNormal = new PaletteContent(_stateCommon, NeedPaintDelegate); // Our view contains background and border with content inside _drawContent = new ViewDrawContent(_stateNormal, this, VisualOrientation.Top); _drawContent.UseMnemonic = _useMnemonic; // Create the view manager instance ViewManager = new ViewManager(this, _drawContent); // We want to be auto sized by default, but not the property default! AutoSize = true; AutoSizeMode = AutoSizeMode.GrowAndShrink; }
public MyUserControl() { // To remove flicker we use double buffering for drawing SetStyle(ControlStyles.AllPaintingInWmPaint | ControlStyles.OptimizedDoubleBuffer | ControlStyles.ResizeRedraw, true); // Cache the current global palette setting _palette = KryptonManager.CurrentGlobalPalette; // Hook into palette events if (_palette != null) _palette.PalettePaint += new EventHandler<PaletteLayoutEventArgs>(OnPalettePaint); // We want to be notified whenever the global palette changes KryptonManager.GlobalPaletteChanged += new EventHandler(OnGlobalPaletteChanged); // Create redirection object to the base palette _paletteRedirect = new PaletteRedirect(_palette); // Create accessor objects for the back, border and content _paletteBack = new PaletteBackInheritRedirect(_paletteRedirect); _paletteBorder = new PaletteBorderInheritRedirect(_paletteRedirect); _paletteContent = new PaletteContentInheritRedirect(_paletteRedirect); }
/// <summary> /// Initialize a new instance of the KryptonLabel class. /// </summary> public KryptonLabel() { // The label cannot take the focus SetStyle(ControlStyles.Selectable, false); // Set default properties _style = LabelStyle.NormalControl; _useMnemonic = true; _orientation = VisualOrientation.Top; _target = null; _enabledTarget = true; // Create content storage _labelValues = new LabelValues(NeedPaintDelegate); _labelValues.TextChanged += new EventHandler(OnLabelTextChanged); // Create palette redirector _paletteCommonRedirect = new PaletteContentInheritRedirect(Redirector, PaletteContentStyle.LabelNormalControl); // Create the palette provider _stateCommon = new PaletteContent(_paletteCommonRedirect, NeedPaintDelegate); _stateDisabled = new PaletteContent(_stateCommon, NeedPaintDelegate); _stateNormal = new PaletteContent(_stateCommon, NeedPaintDelegate); // Our view contains background and border with content inside _drawContent = new ViewDrawContent(_stateNormal, this, VisualOrientation.Top); _drawContent.UseMnemonic = _useMnemonic; // Create the view manager instance ViewManager = new ViewManager(this, _drawContent); // We want to be auto sized by default, but not the property default! AutoSize = true; AutoSizeMode = AutoSizeMode.GrowAndShrink; }
/// <summary> /// Initialize a new instance of the PaletteGroupBoxRedirect class. /// </summary> /// <param name="redirectDouble">Inheritence redirection for group border/background.</param> /// <param name="redirectContent">Inheritence redirection for group header.</param> /// <param name="needPaint">Delegate for notifying paint requests.</param> public PaletteGroupBoxRedirect(PaletteRedirect redirectDouble, PaletteRedirect redirectContent, NeedPaintHandler needPaint) : base(redirectDouble, PaletteBackStyle.ControlGroupBox, PaletteBorderStyle.ControlGroupBox, needPaint) { Debug.Assert(redirectDouble != null); Debug.Assert(redirectContent != null); _contentInherit = new PaletteContentInheritRedirect(redirectContent, PaletteContentStyle.LabelGroupBoxCaption); _content = new PaletteContent(_contentInherit, needPaint); }
/// <summary> /// Initialize a new instance of the PaletteGroupBoxRedirect class. /// </summary> /// <param name="redirectDouble">Inheritence redirection for group border/background.</param> /// <param name="redirectContent">Inheritence redirection for group header.</param> /// <param name="needPaint">Delegate for notifying paint requests.</param> public PaletteGroupBoxRedirect(PaletteRedirect redirectDouble, PaletteRedirect redirectContent, NeedPaintHandler needPaint) : base(redirectDouble, PaletteBackStyle.ControlGroupBox, PaletteBorderStyle.ControlGroupBox, needPaint) { Debug.Assert(redirectDouble != null); Debug.Assert(redirectContent != null); _contentInherit = new PaletteContentInheritRedirect(redirectContent, PaletteContentStyle.LabelGroupBoxCaption); _content = new PaletteContent(_contentInherit, needPaint); }
/// <summary> /// Initialize a new instance of the PaletteContextMenuItemState class. /// </summary> /// <param name="redirectItemHighlight">Redirector for ItemHighlight.</param> /// <param name="redirectItemImage">Redirector for ItemImage.</param> /// <param name="redirectItemShortcutText">Redirector for ItemShortcutText.</param> /// <param name="redirectItemSplit">Redirector for ItemSplit.</param> /// <param name="redirectItemTextAlternate">Redirector for ItemTextStandard.</param> /// <param name="redirectItemTextStandard">Redirector for ItemTextAlternate.</param> public PaletteContextMenuItemState(PaletteDoubleMetricRedirect redirectItemHighlight, PaletteTripleJustImageRedirect redirectItemImage, PaletteContentInheritRedirect redirectItemShortcutText, PaletteDoubleRedirect redirectItemSplit, PaletteContentInheritRedirect redirectItemTextStandard, PaletteContentInheritRedirect redirectItemTextAlternate) { _paletteItemHighlight = new PaletteDoubleMetric(redirectItemHighlight); _paletteItemImage = new PaletteTripleJustImage(redirectItemImage); _paletteItemShortcutText = new PaletteContentJustShortText(redirectItemShortcutText); _paletteItemSplit = new PaletteDouble(redirectItemSplit); _paletteItemTextStandard = new PaletteContentJustText(redirectItemTextStandard); _paletteItemTextAlternate = new PaletteContentJustText(redirectItemTextAlternate); }
/// <summary> /// Initialize a new instance of the KryptonPaletteLabel class. /// </summary> /// <param name="redirect">Redirector to inherit values from.</param> /// <param name="contentStyle">Content style.</param> /// <param name="needPaint">Delegate for notifying paint requests.</param> public KryptonPaletteLabel(PaletteRedirect redirect, PaletteContentStyle contentStyle, NeedPaintHandler needPaint) { // Create the storage objects _stateInherit = new PaletteContentInheritRedirect(redirect, contentStyle); StateCommon = new PaletteContent(_stateInherit, needPaint); StateDisabled = new PaletteContent(StateCommon, needPaint); StateNormal = new PaletteContent(StateCommon, needPaint); OverrideFocus = new PaletteContent(_stateInherit, needPaint); OverrideVisited = new PaletteContent(_stateInherit, needPaint); OverrideNotVisited = new PaletteContent(_stateInherit, needPaint); OverridePressed = new PaletteContent(_stateInherit, needPaint); }
/// <summary> /// Initialize a new instance of the KryptonPaletteLabel class. /// </summary> /// <param name="redirect">Redirector to inherit values from.</param> /// <param name="contentStyle">Content style.</param> /// <param name="needPaint">Delegate for notifying paint requests.</param> public KryptonPaletteLabel(PaletteRedirect redirect, PaletteContentStyle contentStyle, NeedPaintHandler needPaint) { // Create the storage objects _stateInherit = new PaletteContentInheritRedirect(redirect, contentStyle); _stateCommon = new PaletteContent(_stateInherit, needPaint); _stateDisabled = new PaletteContent(_stateCommon, needPaint); _stateNormal = new PaletteContent(_stateCommon, needPaint); _stateFocus = new PaletteContent(_stateInherit, needPaint); _stateVisited = new PaletteContent(_stateInherit, needPaint); _stateNotVisited = new PaletteContent(_stateInherit, needPaint); _statePressed = new PaletteContent(_stateInherit, needPaint); }
/// <summary> /// Initialize a new instance of the PaletteContextMenuItemState class. /// </summary> /// <param name="redirectItemHighlight">Redirector for ItemHighlight.</param> /// <param name="redirectItemImage">Redirector for ItemImage.</param> /// <param name="redirectItemShortcutText">Redirector for ItemShortcutText.</param> /// <param name="redirectItemSplit">Redirector for ItemSplit.</param> /// <param name="redirectItemTextAlternate">Redirector for ItemTextStandard.</param> /// <param name="redirectItemTextStandard">Redirector for ItemTextAlternate.</param> public PaletteContextMenuItemState(PaletteDoubleMetricRedirect redirectItemHighlight, PaletteTripleJustImageRedirect redirectItemImage, PaletteContentInheritRedirect redirectItemShortcutText, PaletteDoubleRedirect redirectItemSplit, PaletteContentInheritRedirect redirectItemTextStandard, PaletteContentInheritRedirect redirectItemTextAlternate) { _paletteItemHighlight = new PaletteDoubleMetric(redirectItemHighlight); _paletteItemImage = new PaletteTripleJustImage(redirectItemImage); _paletteItemShortcutText = new PaletteContentJustShortText(redirectItemShortcutText); _paletteItemSplit = new PaletteDouble(redirectItemSplit); _paletteItemTextStandard = new PaletteContentJustText(redirectItemTextStandard); _paletteItemTextAlternate = new PaletteContentJustText(redirectItemTextAlternate); }
/// <summary> /// Initialize a new instance of the PaletteContextMenuItemStateRedirect class. /// </summary> public PaletteContextMenuItemStateRedirect() { _itemHighlight = new PaletteRedirectDouble(); _itemImage = new PaletteRedirectTriple(); _itemShortcutText = new PaletteRedirectContent(); _itemSplit = new PaletteRedirectDouble(); _itemStandard = new PaletteRedirectContent(); _itemAlternate = new PaletteRedirectContent(); _redirectItemHighlight = new PaletteDoubleMetricRedirect(_itemHighlight, PaletteBackStyle.ContextMenuItemHighlight, PaletteBorderStyle.ContextMenuItemHighlight); _redirectItemImage = new PaletteTripleJustImageRedirect(_itemImage, PaletteBackStyle.ContextMenuItemImage, PaletteBorderStyle.ContextMenuItemImage, PaletteContentStyle.ContextMenuItemImage); _redirectItemShortcutText = new PaletteContentInheritRedirect(_itemShortcutText, PaletteContentStyle.ContextMenuItemShortcutText); _redirectItemSplit = new PaletteDoubleRedirect(_itemSplit, PaletteBackStyle.ContextMenuSeparator, PaletteBorderStyle.ContextMenuSeparator); _redirectItemTextStandard = new PaletteContentInheritRedirect(_itemStandard, PaletteContentStyle.ContextMenuItemTextStandard); _redirectItemTextAlternate = new PaletteContentInheritRedirect(_itemAlternate, PaletteContentStyle.ContextMenuItemTextAlternate); }
/// <summary> /// Initialize a new instance of the PaletteContextMenuItemStateRedirect class. /// </summary> public PaletteContextMenuItemStateRedirect() { _itemHighlight = new PaletteRedirectDouble(); _itemImage = new PaletteRedirectTriple(); _itemShortcutText = new PaletteRedirectContent(); _itemSplit = new PaletteRedirectDouble(); _itemStandard = new PaletteRedirectContent(); _itemAlternate = new PaletteRedirectContent(); _redirectItemHighlight = new PaletteDoubleMetricRedirect(_itemHighlight, PaletteBackStyle.ContextMenuItemHighlight, PaletteBorderStyle.ContextMenuItemHighlight); _redirectItemImage = new PaletteTripleJustImageRedirect(_itemImage, PaletteBackStyle.ContextMenuItemImage, PaletteBorderStyle.ContextMenuItemImage, PaletteContentStyle.ContextMenuItemImage); _redirectItemShortcutText = new PaletteContentInheritRedirect(_itemShortcutText, PaletteContentStyle.ContextMenuItemShortcutText); _redirectItemSplit = new PaletteDoubleRedirect(_itemSplit, PaletteBackStyle.ContextMenuSeparator, PaletteBorderStyle.ContextMenuSeparator); _redirectItemTextStandard = new PaletteContentInheritRedirect(_itemStandard, PaletteContentStyle.ContextMenuItemTextStandard); _redirectItemTextAlternate = new PaletteContentInheritRedirect(_itemAlternate, PaletteContentStyle.ContextMenuItemTextAlternate); }
/// <summary> /// Initialize a new instance of the PaletteTripleRedirect class. /// </summary> /// <param name="redirect">Inheritence redirection instance.</param> /// <param name="backStyle">Initial background style.</param> /// <param name="borderStyle">Initial border style.</param> /// <param name="contentStyle">Initial content style.</param> /// <param name="needPaint">Delegate for notifying paint requests.</param> public PaletteTripleRedirect(PaletteRedirect redirect, PaletteBackStyle backStyle, PaletteBorderStyle borderStyle, PaletteContentStyle contentStyle, NeedPaintHandler needPaint) { // Store the provided paint notification delegate NeedPaint = needPaint; // Store the inherit instances _backInherit = new PaletteBackInheritRedirect(redirect, backStyle); _borderInherit = new PaletteBorderInheritRedirect(redirect, borderStyle); _contentInherit = new PaletteContentInheritRedirect(redirect, contentStyle); // Create storage that maps onto the inherit instances Back = new PaletteBack(_backInherit, needPaint); Border = new PaletteBorder(_borderInherit, needPaint); Content = new PaletteContent(_contentInherit, needPaint); }
/// <summary> /// Initialize a new instance of the PaletteTabTripleRedirect class. /// </summary> /// <param name="redirect">Inheritence redirection instance.</param> /// <param name="backStyle">Initial background style.</param> /// <param name="borderStyle">Initial border style.</param> /// <param name="contentStyle">Initial content style.</param> /// <param name="needPaint">Delegate for notifying paint requests.</param> public PaletteTabTripleRedirect(PaletteRedirect redirect, PaletteBackStyle backStyle, PaletteBorderStyle borderStyle, PaletteContentStyle contentStyle, NeedPaintHandler needPaint) { Debug.Assert(redirect != null); // Store the provided paint notification delegate NeedPaint = needPaint; // Store the inherit instances _backInherit = new PaletteBackInheritRedirect(redirect, backStyle); _borderInherit = new PaletteBorderInheritRedirect(redirect, borderStyle); _contentInherit = new PaletteContentInheritRedirect(redirect, contentStyle); // Create storage that maps onto the inherit instances _back = new PaletteBack(_backInherit, needPaint); _border = new PaletteTabBorder(_borderInherit, needPaint); _content = new PaletteContent(_contentInherit, needPaint); }
/// <summary> /// Initialize a new instance of the PaletteContextMenuRedirect class. /// </summary> /// <param name="redirect">Inheritence redirection.</param> /// <param name="needPaint">Delegate for notifying paint requests.</param> public PaletteContextMenuRedirect(PaletteRedirect redirect, NeedPaintHandler needPaint) { Debug.Assert(redirect != null); // Create the palette storage _paletteControlInner = new PaletteDoubleRedirect(redirect, PaletteBackStyle.ContextMenuInner, PaletteBorderStyle.ContextMenuInner, needPaint); _paletteControlOuter = new PaletteDoubleRedirect(redirect, PaletteBackStyle.ContextMenuOuter, PaletteBorderStyle.ContextMenuOuter, needPaint); _paletteHeading = new PaletteTripleRedirect(redirect, PaletteBackStyle.ContextMenuHeading, PaletteBorderStyle.ContextMenuHeading, PaletteContentStyle.ContextMenuHeading, needPaint); _paletteItemHighlight = new PaletteDoubleMetricRedirect(redirect, PaletteBackStyle.ContextMenuItemHighlight, PaletteBorderStyle.ContextMenuItemHighlight, needPaint); _paletteItemImage = new PaletteTripleJustImageRedirect(redirect, PaletteBackStyle.ContextMenuItemImage, PaletteBorderStyle.ContextMenuItemImage, PaletteContentStyle.ContextMenuItemImage, needPaint); _paletteItemImageColumn = new PaletteDoubleRedirect(redirect, PaletteBackStyle.ContextMenuItemImageColumn, PaletteBorderStyle.ContextMenuItemImageColumn, needPaint); _paletteItemShortcutTextRedirect = new PaletteContentInheritRedirect(redirect, PaletteContentStyle.ContextMenuItemShortcutText); _paletteItemShortcutText = new PaletteContentJustShortText(_paletteItemShortcutTextRedirect, needPaint); _paletteItemSplit = new PaletteDoubleRedirect(redirect, PaletteBackStyle.ContextMenuItemSplit, PaletteBorderStyle.ContextMenuItemSplit, needPaint); _paletteItemTextAlternateRedirect = new PaletteContentInheritRedirect(redirect, PaletteContentStyle.ContextMenuItemTextAlternate); _paletteItemTextAlternate = new PaletteContentJustText(_paletteItemTextAlternateRedirect, needPaint); _paletteItemTextStandardRedirect = new PaletteContentInheritRedirect(redirect, PaletteContentStyle.ContextMenuItemTextStandard); _paletteItemTextStandard = new PaletteContentJustText(_paletteItemTextStandardRedirect, needPaint); _paletteSeparator = new PaletteDoubleRedirect(redirect, PaletteBackStyle.ContextMenuSeparator, PaletteBorderStyle.ContextMenuSeparator, needPaint); }
/// <summary> /// Initialize a new instance of the PaletteDataGridViewTripleRedirect class. /// </summary> /// <param name="redirect">Inheritence redirection instance.</param> /// <param name="backStyle">Initial background style.</param> /// <param name="borderStyle">Initial border style.</param> /// <param name="contentStyle">Initial content style.</param> /// <param name="needPaint">Delegate for notifying paint requests.</param> public PaletteDataGridViewTripleRedirect(PaletteRedirect redirect, PaletteBackStyle backStyle, PaletteBorderStyle borderStyle, PaletteContentStyle contentStyle, NeedPaintHandler needPaint) { Debug.Assert(redirect != null); // Store the provided paint notification delegate NeedPaint = needPaint; // Store the inherit instances _backInherit = new PaletteBackInheritRedirect(redirect, backStyle); _borderInherit = new PaletteBorderInheritRedirect(redirect, borderStyle); _contentInherit = new PaletteContentInheritRedirect(redirect, contentStyle); // Create storage that maps onto the inherit instances _back = new PaletteBack(_backInherit, needPaint); _border = new PaletteBorder(_borderInherit, needPaint); _content = new PaletteDataGridViewContentCommon(_contentInherit, needPaint); }
/// <summary> /// Initialize a new instance of the PaletteContextMenuRedirect class. /// </summary> /// <param name="redirect">Inheritence redirection.</param> /// <param name="needPaint">Delegate for notifying paint requests.</param> public PaletteContextMenuRedirect(PaletteRedirect redirect, NeedPaintHandler needPaint) { Debug.Assert(redirect != null); // Create the palette storage _paletteControlInner = new PaletteDoubleRedirect(redirect, PaletteBackStyle.ContextMenuInner, PaletteBorderStyle.ContextMenuInner, needPaint); _paletteControlOuter = new PaletteDoubleRedirect(redirect, PaletteBackStyle.ContextMenuOuter, PaletteBorderStyle.ContextMenuOuter, needPaint); _paletteHeading = new PaletteTripleRedirect(redirect, PaletteBackStyle.ContextMenuHeading, PaletteBorderStyle.ContextMenuHeading, PaletteContentStyle.ContextMenuHeading, needPaint); _paletteItemHighlight = new PaletteDoubleMetricRedirect(redirect, PaletteBackStyle.ContextMenuItemHighlight, PaletteBorderStyle.ContextMenuItemHighlight, needPaint); _paletteItemImage = new PaletteTripleJustImageRedirect(redirect, PaletteBackStyle.ContextMenuItemImage, PaletteBorderStyle.ContextMenuItemImage, PaletteContentStyle.ContextMenuItemImage, needPaint); _paletteItemImageColumn = new PaletteDoubleRedirect(redirect, PaletteBackStyle.ContextMenuItemImageColumn, PaletteBorderStyle.ContextMenuItemImageColumn, needPaint); _paletteItemShortcutTextRedirect = new PaletteContentInheritRedirect(redirect, PaletteContentStyle.ContextMenuItemShortcutText); _paletteItemShortcutText = new PaletteContentJustShortText(_paletteItemShortcutTextRedirect, needPaint); _paletteItemSplit = new PaletteDoubleRedirect(redirect, PaletteBackStyle.ContextMenuItemSplit, PaletteBorderStyle.ContextMenuItemSplit, needPaint); _paletteItemTextAlternateRedirect = new PaletteContentInheritRedirect(redirect, PaletteContentStyle.ContextMenuItemTextAlternate); _paletteItemTextAlternate = new PaletteContentJustText(_paletteItemTextAlternateRedirect, needPaint); _paletteItemTextStandardRedirect = new PaletteContentInheritRedirect(redirect, PaletteContentStyle.ContextMenuItemTextStandard); _paletteItemTextStandard = new PaletteContentJustText(_paletteItemTextStandardRedirect, needPaint); _paletteSeparator = new PaletteDoubleRedirect(redirect, PaletteBackStyle.ContextMenuSeparator, PaletteBorderStyle.ContextMenuSeparator, needPaint); }
/// <summary> /// Initialize a new instance of the PaletteInputControlTripleRedirect class. /// </summary> /// <param name="redirect">Inheritence redirection instance.</param> /// <param name="backStyle">Initial background style.</param> /// <param name="borderStyle">Initial border style.</param> /// <param name="contentStyle">Initial content style.</param> /// <param name="needPaint">Delegate for notifying paint requests.</param> public PaletteInputControlTripleRedirect(PaletteRedirect redirect, PaletteBackStyle backStyle, PaletteBorderStyle borderStyle, PaletteContentStyle contentStyle, NeedPaintHandler needPaint) { Debug.Assert(redirect != null); // Store the provided paint notification delegate NeedPaint = needPaint; // Store the inherit instances _backInherit = new PaletteBackInheritRedirect(redirect, backStyle); _borderInherit = new PaletteBorderInheritRedirect(redirect, borderStyle); _contentInherit = new PaletteContentInheritRedirect(redirect, contentStyle); _metricRedirect = new PaletteMetricRedirect(redirect); // Create storage that maps onto the inherit instances Back = new PaletteInputControlBackStates(_backInherit, needPaint); Border = new PaletteBorder(_borderInherit, needPaint); Content = new PaletteInputControlContentStates(_contentInherit, needPaint); }
/// <summary> /// Initialize a new instance of the KryptonLinkLabel class. /// </summary> public KryptonLinkLabel() { // The link label cannot take the focus SetStyle(ControlStyles.Selectable, true); // Turn off the target functionality present in the base class EnabledTarget = false; // Create the override states that redirect without inheriting _stateVisitedRedirect = new PaletteContentInheritRedirect(Redirector, PaletteContentStyle.LabelNormalControl); _stateNotVisitedRedirect = new PaletteContentInheritRedirect(Redirector, PaletteContentStyle.LabelNormalControl); _statePressedRedirect = new PaletteContentInheritRedirect(Redirector, PaletteContentStyle.LabelNormalControl); _stateFocusRedirect = new PaletteContentInheritRedirect(Redirector, PaletteContentStyle.LabelNormalControl); _stateVisited = new PaletteContent(_stateVisitedRedirect, NeedPaintDelegate); _stateNotVisited = new PaletteContent(_stateNotVisitedRedirect, NeedPaintDelegate); _stateFocus = new PaletteContent(_stateFocusRedirect, NeedPaintDelegate); _statePressed = new PaletteContent(_statePressedRedirect, NeedPaintDelegate); // Override the normal state to implement the underling logic _inheritBehavior = new LinkLabelBehaviorInherit(StateNormal, KryptonLinkBehavior.AlwaysUnderline); // Create the override handling classes _overrideVisited = new PaletteContentInheritOverride(_stateVisited, _inheritBehavior, PaletteState.LinkVisitedOverride, false); _overrideNotVisited = new PaletteContentInheritOverride(_stateNotVisited, _overrideVisited, PaletteState.LinkNotVisitedOverride, true); _overrideFocusNotVisited = new PaletteContentInheritOverride(_stateFocus, _overrideNotVisited, PaletteState.FocusOverride, false); _overridePressed = new PaletteContentInheritOverride(_statePressed, _inheritBehavior, PaletteState.LinkPressedOverride, false); _overridePressedFocus = new PaletteContentInheritOverride(_stateFocus, _overridePressed, PaletteState.FocusOverride, false); // Create controller for updating the view state/click events _controller = new LinkLabelController(ViewDrawContent, StateDisabled, _overrideFocusNotVisited, _overrideFocusNotVisited, _overridePressedFocus, _overridePressed, NeedPaintDelegate); _controller.Click += new MouseEventHandler(OnControllerClick); ViewDrawContent.MouseController = _controller; ViewDrawContent.KeyController = _controller; ViewDrawContent.SourceController = _controller; // Set initial palette for drawing the content ViewDrawContent.SetPalette(_overrideFocusNotVisited); }
/// <summary> /// Initialize a new instance of the KryptonLinkLabel class. /// </summary> public KryptonLinkLabel() { // The link label cannot take the focus SetStyle(ControlStyles.Selectable, true); // Turn off the target functionality present in the base class EnabledTarget = false; // Create the override states that redirect without inheriting _stateVisitedRedirect = new PaletteContentInheritRedirect(Redirector, PaletteContentStyle.LabelNormalControl); _stateNotVisitedRedirect = new PaletteContentInheritRedirect(Redirector, PaletteContentStyle.LabelNormalControl); _statePressedRedirect = new PaletteContentInheritRedirect(Redirector, PaletteContentStyle.LabelNormalControl); _stateFocusRedirect = new PaletteContentInheritRedirect(Redirector, PaletteContentStyle.LabelNormalControl); OverrideVisited = new PaletteContent(_stateVisitedRedirect, NeedPaintDelegate); OverrideNotVisited = new PaletteContent(_stateNotVisitedRedirect, NeedPaintDelegate); OverrideFocus = new PaletteContent(_stateFocusRedirect, NeedPaintDelegate); OverridePressed = new PaletteContent(_statePressedRedirect, NeedPaintDelegate); // Override the normal state to implement the underling logic _inheritBehavior = new LinkLabelBehaviorInherit(StateNormal, KryptonLinkBehavior.AlwaysUnderline); // Create the override handling classes _overrideVisited = new PaletteContentInheritOverride(OverrideVisited, _inheritBehavior, PaletteState.LinkVisitedOverride, false); _overrideNotVisited = new PaletteContentInheritOverride(OverrideNotVisited, _overrideVisited, PaletteState.LinkNotVisitedOverride, true); _overrideFocusNotVisited = new PaletteContentInheritOverride(OverrideFocus, _overrideNotVisited, PaletteState.FocusOverride, false); _overridePressed = new PaletteContentInheritOverride(OverridePressed, _inheritBehavior, PaletteState.LinkPressedOverride, false); _overridePressedFocus = new PaletteContentInheritOverride(OverrideFocus, _overridePressed, PaletteState.FocusOverride, false); // Create controller for updating the view state/click events _controller = new LinkLabelController(ViewDrawContent, StateDisabled, _overrideFocusNotVisited, _overrideFocusNotVisited, _overridePressedFocus, _overridePressed, NeedPaintDelegate); _controller.Click += OnControllerClick; ViewDrawContent.MouseController = _controller; ViewDrawContent.KeyController = _controller; ViewDrawContent.SourceController = _controller; // Set initial palette for drawing the content ViewDrawContent.SetPalette(_overrideFocusNotVisited); }
/// <summary> /// Initialize a new instance of the KryptonContextMenuLinkLabel class. /// </summary> /// <param name="initialText">Initial text for display.</param> public KryptonContextMenuLinkLabel(string initialText) { // Default fields _text = initialText; _extraText = string.Empty; _image = null; _imageTransparentColor = Color.Empty; _style = LabelStyle.NormalControl; _autoClose = true; // Create the redirectors _stateNormalRedirect = new PaletteContentInheritRedirect(PaletteContentStyle.LabelNormalControl); _stateVisitedRedirect = new PaletteContentInheritRedirect(PaletteContentStyle.LabelNormalControl); _stateNotVisitedRedirect = new PaletteContentInheritRedirect(PaletteContentStyle.LabelNormalControl); _statePressedRedirect = new PaletteContentInheritRedirect(PaletteContentStyle.LabelNormalControl); _stateFocusRedirect = new PaletteContentInheritRedirect(PaletteContentStyle.LabelNormalControl); // Create the states _stateNormal = new PaletteContent(_stateNormalRedirect); _stateVisited = new PaletteContent(_stateVisitedRedirect); _stateNotVisited = new PaletteContent(_stateNotVisitedRedirect); _stateFocus = new PaletteContent(_stateFocusRedirect); _statePressed = new PaletteContent(_statePressedRedirect); // Override the normal state to implement the underling logic _inheritBehavior = new LinkLabelBehaviorInherit(_stateNormal, KryptonLinkBehavior.AlwaysUnderline); // Create the override handling classes _overrideVisited = new PaletteContentInheritOverride(_stateVisited, _inheritBehavior, PaletteState.LinkVisitedOverride, false); _overrideNotVisited = new PaletteContentInheritOverride(_stateNotVisited, _overrideVisited, PaletteState.LinkNotVisitedOverride, true); _overrideFocusNotVisited = new PaletteContentInheritOverride(_stateFocus, _overrideNotVisited, PaletteState.FocusOverride, false); _overridePressed = new PaletteContentInheritOverride(_statePressed, _inheritBehavior, PaletteState.LinkPressedOverride, true); _overridePressedFocus = new PaletteContentInheritOverride(_stateFocus, _overridePressed, PaletteState.FocusOverride, false); }
/// <summary> /// Initialize a new instance of the RadioButton class. /// </summary> public KryptonRadioButton() { // Turn off standard click and double click events, we do that manually SetStyle(ControlStyles.StandardClick | ControlStyles.StandardDoubleClick, false); // Set default properties _style = LabelStyle.NormalControl; _orientation = VisualOrientation.Top; _checkPosition = VisualOrientation.Left; _checked = false; _useMnemonic = true; _autoCheck = true; // Create content storage Values = new LabelValues(NeedPaintDelegate); Values.TextChanged += OnRadioButtonTextChanged; Images = new RadioButtonImages(NeedPaintDelegate); // Create palette redirector _paletteCommonRedirect = new PaletteContentInheritRedirect(Redirector, PaletteContentStyle.LabelNormalControl); _paletteRadioButtonImages = new PaletteRedirectRadioButton(Redirector, Images); // Create the palette provider StateCommon = new PaletteContent(_paletteCommonRedirect, NeedPaintDelegate); StateDisabled = new PaletteContent(StateCommon, NeedPaintDelegate); StateNormal = new PaletteContent(StateCommon, NeedPaintDelegate); OverrideFocus = new PaletteContent(_paletteCommonRedirect, NeedPaintDelegate); // Override the normal values with the focus, when the control has focus _overrideNormal = new PaletteContentInheritOverride(OverrideFocus, StateNormal, PaletteState.FocusOverride, false); // Our view contains background and border with content inside _drawContent = new ViewDrawContent(_overrideNormal, Values, VisualOrientation.Top) { UseMnemonic = _useMnemonic, // Only draw a focus rectangle when focus cues are needed in the top level form TestForFocusCues = true }; // Create the check box image drawer and place inside element so it is always centered _drawRadioButton = new ViewDrawRadioButton(_paletteRadioButtonImages) { CheckState = _checked }; _layoutCenter = new ViewLayoutCenter { _drawRadioButton }; // Place check box on the left and the label in the remainder _layoutDocker = new ViewLayoutDocker { { _layoutCenter, ViewDockStyle.Left }, { _drawContent, ViewDockStyle.Fill } }; // Need a controller for handling mouse input _controller = new RadioButtonController(_drawRadioButton, _layoutDocker, NeedPaintDelegate); _controller.Click += OnControllerClick; _controller.Enabled = true; _layoutDocker.MouseController = _controller; _layoutDocker.KeyController = _controller; // Change the layout to match the inital right to left setting and orientation UpdateForOrientation(); // Create the view manager instance ViewManager = new ViewManager(this, _layoutDocker); // We want to be auto sized by default, but not the property default! AutoSize = true; AutoSizeMode = AutoSizeMode.GrowAndShrink; }
/// <summary> /// Constructor /// </summary> public KryptonOutlookGridGroupBox() { // To remove flicker we use double buffering for drawing SetStyle( ControlStyles.AllPaintingInWmPaint | ControlStyles.OptimizedDoubleBuffer | ControlStyles.ResizeRedraw, true); InitializeComponent(); columnsList = new List<OutlookGridGroupBoxColumn>(); // Cache the current global palette setting _palette = KryptonManager.CurrentGlobalPalette; // Hook into palette events if (_palette != null) _palette.PalettePaint += new EventHandler<PaletteLayoutEventArgs>(OnPalettePaint); // (4) We want to be notified whenever the global palette changes KryptonManager.GlobalPaletteChanged += new EventHandler(OnGlobalPaletteChanged); // Create redirection object to the base palette _paletteRedirect = new PaletteRedirect(_palette); // Create accessor objects for the back, border and content // Store the inherit instances _paletteBack = new PaletteBackInheritRedirect(_paletteRedirect); _paletteBorder = new PaletteBorderInheritRedirect(_paletteRedirect); _paletteContent = new PaletteContentInheritRedirect(_paletteRedirect); _paletteDataGridView = new PaletteDataGridViewRedirect(_paletteRedirect, null); _paletteDataGridViewAll = new PaletteDataGridViewAll(_paletteDataGridView, null); // Create storage that maps onto the inherit instances _border = new PaletteBorder(_paletteBorder, null); _dragColumnToGroupText = LangManager.Instance.GetString("DRAGCOLUMNTOGROUP"); using (Graphics g = CreateGraphics()) { factorX = g.DpiX > 96 ? (1f * g.DpiX / 96) : 1f; factorY = g.DpiY > 96 ? (1f * g.DpiY / 96) : 1f; } }
/// <summary> /// Initialize a new instance of the KryptonContextMenuRadioButton class. /// </summary> /// <param name="initialText">Initial text for display.</param> public KryptonContextMenuRadioButton(string initialText) { // Default fields _enabled = true; _autoClose = false; _text = initialText; _extraText = string.Empty; _image = null; _imageTransparentColor = Color.Empty; _checked = false; _autoCheck = true; _style = LabelStyle.NormalControl; _images = new RadioButtonImages(); // Create the redirectors _stateCommonRedirect = new PaletteContentInheritRedirect(PaletteContentStyle.LabelNormalControl); _stateRadioButtonImages = new PaletteRedirectRadioButton(_images); // Create the states _stateCommon = new PaletteContent(_stateCommonRedirect); _stateDisabled = new PaletteContent(_stateCommon); _stateNormal = new PaletteContent(_stateCommon); _stateFocus = new PaletteContent(_stateCommonRedirect); // Override the normal/disabled values with the focus, when the control has focus _overrideNormal = new PaletteContentInheritOverride(_stateFocus, _stateNormal, PaletteState.FocusOverride, false); _overrideDisabled = new PaletteContentInheritOverride(_stateFocus, _stateDisabled, PaletteState.FocusOverride, false); }
/// <summary> /// Initialize a new instance of the KryptonCheckBox class. /// </summary> public KryptonCheckBox() { // Turn off standard click and double click events, we do that manually SetStyle(ControlStyles.StandardClick | ControlStyles.StandardDoubleClick, false); // Set default properties _style = LabelStyle.NormalControl; _orientation = VisualOrientation.Top; _checkPosition = VisualOrientation.Left; _checked = false; _threeState = false; _checkState = CheckState.Unchecked; _useMnemonic = true; _autoCheck = true; // Create content storage _labelValues = new LabelValues(NeedPaintDelegate); _labelValues.TextChanged += new EventHandler(OnCheckBoxTextChanged); _images = new CheckBoxImages(NeedPaintDelegate); // Create palette redirector _paletteCommonRedirect = new PaletteContentInheritRedirect(Redirector, PaletteContentStyle.LabelNormalControl); _paletteCheckBoxImages = new PaletteRedirectCheckBox(Redirector, _images); // Create the palette provider _stateCommon = new PaletteContent(_paletteCommonRedirect, NeedPaintDelegate); _stateDisabled = new PaletteContent(_stateCommon, NeedPaintDelegate); _stateNormal = new PaletteContent(_stateCommon, NeedPaintDelegate); _stateFocus = new PaletteContent(_paletteCommonRedirect, NeedPaintDelegate); // Override the normal values with the focus, when the control has focus _overrideNormal = new PaletteContentInheritOverride(_stateFocus, _stateNormal, PaletteState.FocusOverride, false); // Our view contains background and border with content inside _drawContent = new ViewDrawContent(_overrideNormal, this, VisualOrientation.Top); _drawContent.UseMnemonic = _useMnemonic; // Only draw a focus rectangle when focus cues are needed in the top level form _drawContent.TestForFocusCues = true; // Create the check box image drawer and place inside element so it is always centered _drawCheckBox = new ViewDrawCheckBox(_paletteCheckBoxImages); _drawCheckBox.CheckState = _checkState; _layoutCenter = new ViewLayoutCenter(); _layoutCenter.Add(_drawCheckBox); // Place check box on the left and the label in the remainder _layoutDocker = new ViewLayoutDocker(); _layoutDocker.Add(_layoutCenter, ViewDockStyle.Left); _layoutDocker.Add(_drawContent, ViewDockStyle.Fill); // Need a controller for handling mouse input _controller = new CheckBoxController(_drawCheckBox, _layoutDocker, NeedPaintDelegate); _controller.Click += new EventHandler(OnControllerClick); _controller.Enabled = true; _layoutDocker.MouseController = _controller; _layoutDocker.KeyController = _controller; // Change the layout to match the inital right to left setting and orientation UpdateForOrientation(); // Create the view manager instance ViewManager = new ViewManager(this, _layoutDocker); // We want to be auto sized by default, but not the property default! AutoSize = true; AutoSizeMode = AutoSizeMode.GrowAndShrink; }
/// <summary> /// Initializes a new instance of the ImageListView class. /// </summary> public ImageListView() { // Renderer parameters controlSuspended = false; rendererSuspendCount = 0; rendererNeedsPaint = true; mColors = ImageListViewColor.Default; SetRenderer(new ImageListViewRenderer()); // Property defaults AutoRotateThumbnails = true; AllowCheckBoxClick = true; AllowColumnClick = true; AllowColumnResize = true; AllowDrag = false; AllowDuplicateFileNames = false; AllowPaneResize = true; mBorderStyle = BorderStyle.Fixed3D; mCacheMode = CacheMode.OnDemand; mCacheLimitAsItemCount = 0; mCacheLimitAsMemory = 20 * 1024 * 1024; mColumns = new ImageListViewColumnHeaderCollection(this); resources = new ResourceManager("Manina.Windows.Forms.ImageListViewResources", typeof(ImageListView).Assembly); mDefaultImage = resources.GetObject("DefaultImage") as Image; mErrorImage = resources.GetObject("ErrorImage") as Image; mRatingImage = resources.GetObject("RatingImage") as Image; mEmptyRatingImage = resources.GetObject("EmptyRatingImage") as Image; GroupHeaderFont = new Font("Microsoft Sans Serif", 8.25f, FontStyle.Bold); ColumnHeaderFont = new Font("Microsoft Sans Serif", 8.25f); mIntegralScroll = false; mItems = new ImageListViewItemCollection(this); MultiSelect = true; mPaneWidth = 240; mRetryOnError = true; mSelectedItems = new ImageListViewSelectedItemCollection(this); mCheckedItems = new ImageListViewCheckedItemCollection(this); mSortColumn = 0; mGroupColumn = 0; mSortOrder = SortOrder.None; mGroupOrder = SortOrder.None; SetStyle(ControlStyles.AllPaintingInWmPaint | ControlStyles.UserPaint | ControlStyles.Opaque | ControlStyles.Selectable | ControlStyles.UserMouse, true); ScrollBars = true; ShellIconFallback = true; ShellIconFromFileContent = true; Size = new Size(120, 100); mShowCheckBoxes = false; mCheckBoxAlignment = ContentAlignment.BottomRight; mCheckBoxPadding = new Size(2, 2); mShowFileIcons = false; mIconAlignment = ContentAlignment.TopRight; mIconPadding = new Size(2, 2); Text = string.Empty; mThumbnailSize = new Size(96, 96); mUseEmbeddedThumbnails = UseEmbeddedThumbnails.Auto; mUseWIC = UseWIC.Auto; mView = View.Thumbnails; mViewOffset = new Point(0, 0); mShowScrollBars = true; // Child controls hScrollBar = new HScrollBar(); vScrollBar = new VScrollBar(); hScrollBar.Visible = false; vScrollBar.Visible = false; hScrollBar.Scroll += hScrollBar_Scroll; vScrollBar.Scroll += vScrollBar_Scroll; Controls.Add(hScrollBar); Controls.Add(vScrollBar); // Groups groups = new ImageListViewGroupCollection(this); showGroups = false; // Lazy refresh timer lazyRefreshTimer = new System.Timers.Timer(); lazyRefreshTimer.Interval = ImageListViewRenderer.LazyRefreshInterval; lazyRefreshTimer.Enabled = false; lazyRefreshTimer.Elapsed += lazyRefreshTimer_Tick; lazyRefreshCallback = new RefreshDelegateInternal(Refresh); // Helpers layoutManager = new ImageListViewLayoutManager(this); navigationManager = new ImageListViewNavigationManager(this); // Cache nabagers defaultAdaptor = new ImageListViewItemAdaptors.FileSystemAdaptor(); thumbnailCache = new ImageListViewCacheThumbnail(this); shellInfoCache = new ImageListViewCacheShellInfo(this); metadataCache = new ImageListViewCacheMetadata(this); disposed = false; // Cache the current global palette setting _palette = KryptonManager.CurrentGlobalPalette; // Hook into palette events if (_palette != null) _palette.PalettePaint += new EventHandler<PaletteLayoutEventArgs>(OnPalettePaint); // We want to be notified whenever the global palette changes KryptonManager.GlobalPaletteChanged += new EventHandler(OnGlobalPaletteChanged); // Create redirection object to the base palette _paletteRedirect = new PaletteRedirect(_palette); // Create accessor objects for the back, border and content _paletteBack = new PaletteBackInheritRedirect(_paletteRedirect); _paletteBorder = new PaletteBorderInheritRedirect(_paletteRedirect); _paletteContent = new PaletteContentInheritRedirect(_paletteRedirect); this.Font = _palette.GetContentShortTextFont(PaletteContentStyle.ButtonStandalone, PaletteState.Normal); }