private bool owner_draw;
private bool stripAmpersands;
private ToolTipIcon tool_tip_icon;
- private string tool_tip_title;
private bool useAnimation;
private bool useFading;
private object tag;
internal class ToolTipWindow : Control {
#region ToolTipWindow Class Local Variables
private Control associated_control;
+ internal Icon icon;
+ internal string title = String.Empty;
+ internal Rectangle icon_rect;
+ internal Rectangle title_rect;
+ internal Rectangle text_rect;
#endregion // ToolTipWindow Class Local Variables
#region ToolTipWindow Class Constructor
}
#if NET_2_0
- public event PopupEventHandler UnPopup {
+ internal event PopupEventHandler UnPopup {
add { Events.AddHandler (UnPopupEvent, value); }
remove { Events.RemoveHandler (UnPopupEvent, value); }
}
internal static event ControlEventHandler UIAToolTipHookUp;
internal static event ControlEventHandler UIAToolTipUnhookUp;
+ internal Rectangle UIAToolTipRectangle {
+ get { return tooltip_window.Bounds; }
+ }
+
internal static void OnUIAUnPopup (object sender, PopupEventArgs args)
{
if (UIAUnPopup != null)
[DefaultValue (ToolTipIcon.None)]
public ToolTipIcon ToolTipIcon {
get { return this.tool_tip_icon; }
- set { this.tool_tip_icon = value; }
+ set {
+ switch (value) {
+ case ToolTipIcon.None:
+ tooltip_window.icon = null;
+ break;
+ case ToolTipIcon.Error:
+ tooltip_window.icon = SystemIcons.Error;
+ break;
+ case ToolTipIcon.Warning:
+ tooltip_window.icon = SystemIcons.Warning;
+ break;
+ case ToolTipIcon.Info:
+ tooltip_window.icon = SystemIcons.Information;
+ break;
+ }
+
+ tool_tip_icon = value;
+ }
}
[DefaultValue ("")]
public string ToolTipTitle {
- get { return this.tool_tip_title; }
- set { this.tool_tip_title = value; }
+ get { return tooltip_window.title; }
+ set {
+ if (value == null)
+ value = String.Empty;
+
+ tooltip_window.title = value;
+ }
}
[Browsable (true)]
#region Protected Instance Methods
protected override void Dispose(bool disposing) {
+ // call the base impl first to avoid conflicts with any parent's events
+ base.Dispose (disposing);
+
if (disposing) {
// Mop up the mess; or should we wait for the GC to kick in?
timer.Stop();
#endif
#endregion // Protected Instance Methods
- enum TipState {
+ internal enum TipState {
Initial,
Show,
Down
if (!is_active)
return;
- if (!show_always) {
- IContainerControl cc = last_control.GetContainerControl ();
- if ((cc == null) || (cc.ActiveControl == null)) {
- return;
- }
- }
+ // ShowAlways controls whether the controls in non-active forms
+ // can display its tooltips, even if they are not current active control.
+ if (!show_always && control.FindForm () != Form.ActiveForm)
+ return;
string text = (string)tooltip_strings[control];
if (text != null && text.Length > 0) {
if (active_control == null) {
- timer.Interval = initial_delay;
+ timer.Interval = Math.Max (initial_delay, 1);
} else {
timer.Interval = Math.Max (re_show_delay, 1);
}