summaryrefslogtreecommitdiffstats
path: root/grapher/CairoWidget.cxx
diff options
context:
space:
mode:
authorTim Moore <timoore@redhat.com>2009-04-20 08:13:38 +0200
committerTim Moore <timoore@redhat.com>2009-04-20 08:13:38 +0200
commita6e65750e80380d42ea238f3c688c3499de16d74 (patch)
treef5ef0b9df733e04d405b969d2fc6290d5ddce773 /grapher/CairoWidget.cxx
parent2d45e339f3287cf0b4805ea91b3aa9f17b6d4752 (diff)
downloadsystemtap-steved-a6e65750e80380d42ea238f3c688c3499de16d74.tar.gz
systemtap-steved-a6e65750e80380d42ea238f3c688c3499de16d74.tar.xz
systemtap-steved-a6e65750e80380d42ea238f3c688c3499de16d74.zip
Move grapher to subdirectory
Diffstat (limited to 'grapher/CairoWidget.cxx')
-rw-r--r--grapher/CairoWidget.cxx42
1 files changed, 42 insertions, 0 deletions
diff --git a/grapher/CairoWidget.cxx b/grapher/CairoWidget.cxx
new file mode 100644
index 00000000..86498a4f
--- /dev/null
+++ b/grapher/CairoWidget.cxx
@@ -0,0 +1,42 @@
+#include "CairoWidget.hxx"
+
+#include <math.h>
+
+namespace systemtap
+{
+ void CairoPlayButton::draw(Cairo::RefPtr<Cairo::Context> cr)
+ {
+ if (!_visible)
+ return;
+ cr->save();
+ cr->set_line_width(1.0);
+ // square with rounded corners
+ cr->move_to(_x0, _y0 + _radius);
+ cr->arc(_x0 + _radius, _y0 + _radius, _radius, M_PI, -M_PI_2);
+ cr->line_to(_x0 + _size - _radius, _y0);
+ cr->arc(_x0 + _size - _radius, _y0 + _radius, _radius, -M_PI_2, 0.0);
+ cr->line_to(_x0 + _size, _y0 + _size - _radius);
+ cr->arc(_x0 + _size - _radius, _y0 + _size - _radius, _radius, 0.0, M_PI_2);
+ cr->line_to(_x0 + _radius, _y0 + _size);
+ cr->arc(_x0 + _radius, _y0 + _size - _radius, _radius, M_PI_2, M_PI);
+ cr->close_path();
+ //cr->rectangle(_x0, _y0, 50.0, 50.0);
+ cr->set_source_rgba(1.0, 1.0, 1.0, .8);
+ cr->stroke();
+ // play equalateral triangle
+ cr->move_to(_x0 + .25 * _size, _y0 + (.5 - 1.0 / (sqrt(3.0) * 2.0)) * _size);
+ cr->line_to(_x0 + .75 * _size, _y0 + .5 * _size);
+ cr->line_to(_x0 + .25 * _size, _y0 + (.5 + 1.0 / (sqrt(3.0) * 2.0)) * _size);
+ cr->close_path();
+ cr->fill();
+ cr->restore();
+ }
+
+ bool CairoPlayButton::containsPoint(double x, double y)
+ {
+ if (x >= _x0 && (x < (_x0 + 50.0)) && (y >= _y0) && (y < (_y0 + 50)))
+ return true;
+ else
+ return false;
+ }
+}