diff options
author | Tim Moore <timoore@redhat.com> | 2009-04-20 10:06:50 +0200 |
---|---|---|
committer | Tim Moore <timoore@redhat.com> | 2009-04-20 10:06:50 +0200 |
commit | c6cc0049534b543878844c728dbdd3a06cbf7969 (patch) | |
tree | 75df1566da2f5f780249e1e8c3a25b41fc85610b /grapher/CairoWidget.cxx | |
parent | b185f07818262bad07e2904a696f2dfcd22fc1fe (diff) | |
parent | 1087b83f9b60e85d3d41cebd797f2eb4cc495bc6 (diff) | |
download | systemtap-steved-c6cc0049534b543878844c728dbdd3a06cbf7969.tar.gz systemtap-steved-c6cc0049534b543878844c728dbdd3a06cbf7969.tar.xz systemtap-steved-c6cc0049534b543878844c728dbdd3a06cbf7969.zip |
Merge branch 'timoore/grapher'
Diffstat (limited to 'grapher/CairoWidget.cxx')
-rw-r--r-- | grapher/CairoWidget.cxx | 42 |
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; + } +} |