From d293d53136fa7e6e7eda510847145edf4d3d7f55 Mon Sep 17 00:00:00 2001 From: Tim Moore Date: Tue, 1 Dec 2009 12:26:59 +0100 Subject: 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. --- grapher/CairoWidget.hxx | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) (limited to 'grapher/CairoWidget.hxx') diff --git a/grapher/CairoWidget.hxx b/grapher/CairoWidget.hxx index 077a4c7a..8cfb816a 100644 --- a/grapher/CairoWidget.hxx +++ b/grapher/CairoWidget.hxx @@ -8,7 +8,7 @@ namespace systemtap { public: CairoWidget(bool visible = false) - : _visible(visible), _size(50.0), _radius(5) + : _visible(visible) {} bool isVisible() const { return _visible; } void setVisible(bool visible) { _visible = visible; } @@ -28,15 +28,27 @@ namespace systemtap bool _visible; double _x0; double _y0; - double _size; - double _radius; }; class CairoPlayButton : public CairoWidget { public: + CairoPlayButton(bool visible = false) + : CairoWidget(visible), _size(50.0), _radius(5) + { + } virtual void draw(Cairo::RefPtr cr); virtual bool containsPoint(double x, double y); + protected: + double _size; + double _radius; + }; + + class CairoTextBox : public CairoWidget + { + public: + void draw(Cairo::RefPtr cr); + std::string contents; }; } #endif -- cgit