summaryrefslogtreecommitdiffstats
path: root/grapher/CairoWidget.cxx
diff options
context:
space:
mode:
authorTim Moore <timoore@redhat.com>2009-12-01 12:26:59 +0100
committerTim Moore <timoore@redhat.com>2009-12-01 12:36:55 +0100
commitd293d53136fa7e6e7eda510847145edf4d3d7f55 (patch)
tree50d5969dec90938cc7efd42e9aea5bfcf5aa6bae /grapher/CairoWidget.cxx
parent572a176d481c329b370ce52e7bec1a49ed76c225 (diff)
downloadsystemtap-steved-d293d53136fa7e6e7eda510847145edf4d3d7f55.tar.gz
systemtap-steved-d293d53136fa7e6e7eda510847145edf4d3d7f55.tar.xz
systemtap-steved-d293d53136fa7e6e7eda510847145edf4d3d7f55.zip
Add hover text to the graph.
When the graph display is paused, leaving the mouse stationary over the graph will display the data point under the pointer. * grapher/CairoWidget.hxx (CairoTextBox): new class (CairoWidget, CairoPlayButton): refector some play button-specific things from CairoWidget to CairoPlayButton. * grapher/CairoWidget.cxx (CairoTextBox::draw): new function. * grapher/GraphWidget.hxx (GraphWidget): new members for supporting hover text. * grapher/GraphWidget.cxx (on_motion_notify_event): Set up hover text box. (establishHoverTimeout, onHoverTimeout, getGraphUnderPoint): new functions.
Diffstat (limited to 'grapher/CairoWidget.cxx')
-rw-r--r--grapher/CairoWidget.cxx21
1 files changed, 21 insertions, 0 deletions
diff --git a/grapher/CairoWidget.cxx b/grapher/CairoWidget.cxx
index 86498a4f..f627dfaa 100644
--- a/grapher/CairoWidget.cxx
+++ b/grapher/CairoWidget.cxx
@@ -39,4 +39,25 @@ namespace systemtap
else
return false;
}
+
+ void CairoTextBox::draw(Cairo::RefPtr<Cairo::Context> cr)
+ {
+ if (!_visible)
+ return;
+ cr->save();
+ Cairo::TextExtents extents;
+ cr->get_text_extents(contents, extents);
+ double width = extents.width, height = extents.height;
+ cr->move_to(_x0 - 2, _y0 - 2);
+ cr->line_to(_x0 + width + 2, _y0 - 2);
+ cr->line_to(_x0 + width + 2, _y0 + height + 2);
+ cr->line_to(_x0 - 2, _y0 + height + 2);
+ cr->close_path();
+ cr->set_source_rgba(1.0, 1.0, 1.0, .8);
+ cr->fill();
+ cr->set_source_rgba(0.0, 0.0, 0.0, 1.0);
+ cr->move_to(_x0, _y0 + height);
+ cr->show_text(contents);
+ cr->restore();
+ }
}