diff options
author | Tim Moore <timoore@redhat.com> | 2009-04-15 18:43:23 +0200 |
---|---|---|
committer | Tim Moore <timoore@redhat.com> | 2009-04-15 19:00:00 +0200 |
commit | 2d45e339f3287cf0b4805ea91b3aa9f17b6d4752 (patch) | |
tree | abd4c3faf3c774702b85a0ff6fb50da184fd5023 /CairoWidget.cxx | |
parent | 7a51212ca1895b85f400fafe0e5198525996af1d (diff) | |
download | systemtap-steved-2d45e339f3287cf0b4805ea91b3aa9f17b6d4752.tar.gz systemtap-steved-2d45e339f3287cf0b4805ea91b3aa9f17b6d4752.tar.xz systemtap-steved-2d45e339f3287cf0b4805ea91b3aa9f17b6d4752.zip |
graphing widget and test harness
Diffstat (limited to 'CairoWidget.cxx')
-rw-r--r-- | CairoWidget.cxx | 42 |
1 files changed, 42 insertions, 0 deletions
diff --git a/CairoWidget.cxx b/CairoWidget.cxx new file mode 100644 index 00000000..86498a4f --- /dev/null +++ b/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; + } +} |