/// <summary> /// Registers a control for showing tooltips; or removes it if null is passed. /// </summary> internal override sealed void RegisterControlForTooltip(ZenControlBase ctrl, IZenTooltip tt) { lock (tooltipInfos) { // Removing existing tooltip? if (tt == null && tooltipInfos.ContainsKey(ctrl)) { // Tooltip will disappear when timer next hits. tooltipInfos[ctrl].AnimState = float.MinValue; // Make sure timer does hit. SubscribeToTimer(); } // Adding or resetting tooltip? else if (tt != null) { // Not there yet: add now if (!tooltipInfos.ContainsKey(ctrl)) { TooltipInfo tti = new TooltipInfo(tt); tooltipInfos[ctrl] = tti; } // There already: replace; keep animation state; make it repaint else { TooltipInfo ttiExisting = tooltipInfos[ctrl]; TooltipInfo tti = new TooltipInfo(tt); tti.AnimState = ttiExisting.AnimState; tti.Repaint = ttiExisting.AnimState != 0; tooltipInfos[ctrl] = tti; // If we need a repaint, make sure timer does hit. if (tti.Repaint) SubscribeToTimer(); } } } }
/// <summary> /// Register/unregister chain. Implemented and sealed by <see cref="ZenTabbedForm"/>. /// </summary> /// <param name="ctrl">Control to register for showing tooltips.</param> /// <param name="tt">Tooltip informatio provider. To show not tooltips, pass null.</param> internal virtual void RegisterControlForTooltip(ZenControlBase ctrl, IZenTooltip tt) { ZenControlBase parent = Parent; if (parent != null) { parent.RegisterControlForTooltip(ctrl, tt); } }
/// <summary> /// Handles mouse click. /// </summary> public override bool DoMouseClick(Point p, MouseButtons button) { // Hide tooltip if it wants to be hidden on click IZenTooltip tt = Tooltip; if (tt != null && tt.HideOnClick) { base.KillTooltip(); } // Prevent base class from handling click - we already sent Click event from mouse up. return(true); }
/// <summary> /// Registers a control for showing tooltips; or removes it if null is passed. /// </summary> internal sealed override void RegisterControlForTooltip(ZenControlBase ctrl, IZenTooltip tt) { lock (tooltipInfos) { // Removing existing tooltip? if (tt == null && tooltipInfos.ContainsKey(ctrl)) { // Tooltip will disappear when timer next hits. tooltipInfos[ctrl].AnimState = float.MinValue; // Make sure timer does hit. SubscribeToTimer(); } // Adding or resetting tooltip? else if (tt != null) { // Not there yet: add now if (!tooltipInfos.ContainsKey(ctrl)) { TooltipInfo tti = new TooltipInfo(tt); tooltipInfos[ctrl] = tti; } // There already: replace; keep animation state; make it repaint else { TooltipInfo ttiExisting = tooltipInfos[ctrl]; TooltipInfo tti = new TooltipInfo(tt); tti.AnimState = ttiExisting.AnimState; tti.Repaint = ttiExisting.AnimState != 0; tooltipInfos[ctrl] = tti; // If we need a repaint, make sure timer does hit. if (tti.Repaint) { SubscribeToTimer(); } } } } }
/// <summary> /// Register/unregister chain. Implemented and sealed by <see cref="ZenTabbedForm"/>. /// </summary> /// <param name="ctrl">Control to register for showing tooltips.</param> /// <param name="tt">Tooltip informatio provider. To show not tooltips, pass null.</param> internal virtual void RegisterControlForTooltip(ZenControlBase ctrl, IZenTooltip tt) { ZenControlBase parent = Parent; if (parent != null) parent.RegisterControlForTooltip(ctrl, tt); }
/// <summary> /// Ctor: takes tooltip info provider. /// </summary> public TooltipInfo(IZenTooltip tooltip) { Tooltip = tooltip; }