changeset 1657:3c63fb1f08b3

move generic tooltip enter/leave to Widget Technically, Textblock's notifyImpl()s should probably call the Widget one as well. It doesn't matter currently, since we don't look for title attrs on elements that correspond to entire Textblocks.
author corvid <corvid@lavabit.com>
date Thu, 22 Apr 2010 01:30:41 +0000
parents 0b01d120294c
children 9793f025b43a
files dw/image.cc dw/ui.cc dw/widget.cc
diffstat 3 files changed, 14 insertions(+), 10 deletions(-) [+]
line wrap: on
line diff
--- a/dw/image.cc	Wed Apr 21 17:24:15 2010 +0000
+++ b/dw/image.cc	Thu Apr 22 01:30:41 2010 +0000
@@ -247,28 +247,22 @@
 {
    // BUG: this is wrong for image maps, but the cursor position is unknown.
    currLink = getStyle()->x_link;
-   core::style::Tooltip *tooltip = getStyle()->x_tooltip;
 
    if (currLink != -1) {
       (void) layout->emitLinkEnter (this, currLink, -1, -1, -1);
    }
-   if (tooltip) {
-      tooltip->onEnter();
-   }
+   Widget::enterNotifyImpl(event);
 }
 
 void Image::leaveNotifyImpl (core::EventCrossing *event)
 {
-   core::style::Tooltip *tooltip = getStyle()->x_tooltip;
    clicking = false;
 
    if (currLink != -1) {
       currLink = -1;
       (void) layout->emitLinkEnter (this, -1, -1, -1, -1);
    }
-   if (tooltip) {
-      tooltip->onLeave();
-   }
+   Widget::leaveNotifyImpl(event);
 }
 
 /*
--- a/dw/ui.cc	Wed Apr 21 17:24:15 2010 +0000
+++ b/dw/ui.cc	Thu Apr 22 01:30:41 2010 +0000
@@ -62,11 +62,13 @@
 void Embed::enterNotifyImpl (core::EventCrossing *event)
 {
    resource->emitEnter();
+   Widget::enterNotifyImpl(event);
 }
 
 void Embed::leaveNotifyImpl (core::EventCrossing *event)
 {
    resource->emitLeave();
+   Widget::leaveNotifyImpl(event);
 }
 
 bool Embed::buttonPressImpl (core::EventButton *event)
--- a/dw/widget.cc	Wed Apr 21 17:24:15 2010 +0000
+++ b/dw/widget.cc	Thu Apr 22 01:30:41 2010 +0000
@@ -594,12 +594,20 @@
    return false;
 }
 
-void Widget::enterNotifyImpl (EventCrossing *event)
+void Widget::enterNotifyImpl (EventCrossing *)
 {
+   core::style::Tooltip *tooltip = getStyle()->x_tooltip;
+
+   if (tooltip)
+      tooltip->onEnter();
 }
 
-void Widget::leaveNotifyImpl (EventCrossing *event)
+void Widget::leaveNotifyImpl (EventCrossing *)
 {
+   core::style::Tooltip *tooltip = getStyle()->x_tooltip;
+
+   if (tooltip)
+      tooltip->onLeave();
 }
 
 void Widget::removeChild (Widget *child)