diff options
author | Abdullah Sowayan <sowayan@users.noreply.github.com> | 2007-03-18 22:23:37 +0000 |
---|---|---|
committer | Abdullah Sowayan <sowayan@users.noreply.github.com> | 2007-03-18 22:23:37 +0000 |
commit | 06a34455bd98b1379cc69bbc5b2cf085e0fc0d9b (patch) | |
tree | 8815ce3b3a85c3c4285429295f338e00ea4497f4 /CIAO/examples/Display/NavDisplayGUI_exec/NodeItem.cpp | |
parent | d66fcc9b4aaec8e88eeb83fc578fdf8a3cc963de (diff) | |
download | ATCD-Static_RT_DAnCE.tar.gz |
Diffstat (limited to 'CIAO/examples/Display/NavDisplayGUI_exec/NodeItem.cpp')
-rw-r--r-- | CIAO/examples/Display/NavDisplayGUI_exec/NodeItem.cpp | 63 |
1 files changed, 63 insertions, 0 deletions
diff --git a/CIAO/examples/Display/NavDisplayGUI_exec/NodeItem.cpp b/CIAO/examples/Display/NavDisplayGUI_exec/NodeItem.cpp new file mode 100644 index 00000000000..f1567d8f4c0 --- /dev/null +++ b/CIAO/examples/Display/NavDisplayGUI_exec/NodeItem.cpp @@ -0,0 +1,63 @@ +// $Id$ + +#include "NodeItem.h" +//#include <qbrush.h> + + +QBrush *NodeItem::normal = new QBrush(red); +QBrush *NodeItem::highlighted = new QBrush(green); + + +NodeItem::NodeItem(QCanvas *canvas, NavUnit &unit) + : QCanvasEllipse(8, 8, canvas), + unit_(unit), + blink_timer(canvas), + is_selected_(0) +{ + setBrush(*normal); + setZ(128); +} + + +void NodeItem::moveBy(double dx, double dy, double /* dz */) +{ + QCanvasEllipse::moveBy (dx, dy); +} + + +void +NodeItem::timerDone() +{ + if(selected()) + { + if(brush() == *normal) + setBrush(*highlighted); + else + setBrush(*normal); + + canvas()->update(); + } +} + + +void +NodeItem::setSelected(bool yes) +{ + is_selected_ = yes; + + if(yes) + { + connect(&blink_timer, SIGNAL(timeout()), + SLOT(timerDone())); + + blink_timer.start(500); + } + else + { + blink_timer.stop(); + disconnect(SIGNAL(timeout()), this, + SLOT(timerDone())); + setBrush(*normal); + canvas()->update(); + } +} |