diff options
author | jai <jai@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 2007-01-29 21:10:39 +0000 |
---|---|---|
committer | jai <jai@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 2007-01-29 21:10:39 +0000 |
commit | e7b830ab561638ed25822054be80ce12e8801d38 (patch) | |
tree | a5b9aa16924c541fcb424ee9460b1ac7f5a89352 /modules/CIAO/examples/Display/NavDisplayGUI_exec/RootPanel.cpp | |
parent | 9b720f395833b3ce2f499463e5fed37a0da926f4 (diff) | |
download | ATCD-DiffServ-Merge.tar.gz |
branching/taggingDiffServ-Merge
Diffstat (limited to 'modules/CIAO/examples/Display/NavDisplayGUI_exec/RootPanel.cpp')
-rw-r--r-- | modules/CIAO/examples/Display/NavDisplayGUI_exec/RootPanel.cpp | 90 |
1 files changed, 90 insertions, 0 deletions
diff --git a/modules/CIAO/examples/Display/NavDisplayGUI_exec/RootPanel.cpp b/modules/CIAO/examples/Display/NavDisplayGUI_exec/RootPanel.cpp new file mode 100644 index 00000000000..c6737ee96c0 --- /dev/null +++ b/modules/CIAO/examples/Display/NavDisplayGUI_exec/RootPanel.cpp @@ -0,0 +1,90 @@ +// $Id$ + +#include "RootPanel.h" +#include <qmenubar.h> +#include <qapplication.h> +#include <qprogressdialog.h> +#include <stdlib.h> +#include <qsplitter.h> +#include "NodeItem.h" +#include "Command.h" + + +RootPanel::RootPanel(QCanvas &c, QWidget *parent, const char *name) +: QMainWindow(parent, name), canvas(c) +{ + QSplitter *s1 = new QSplitter( QSplitter::Vertical, this , "main" ); + + + navview = new MapView(canvas, s1); + s1->moveToFirst(navview); + + details = new DetailView(s1); + + QMenuBar* menu = menuBar(); + + QPopupMenu* file = new QPopupMenu; + //file->insertItem("&Fill canvas", this, SLOT(init()), CTRL+Key_F); + //file->insertItem("&Erase canvas", this, SLOT(clear()), CTRL+Key_E); + //file->insertItem("&New view", this, SLOT(newView()), CTRL+Key_N); + file->insertSeparator(); + file->insertItem("E&xit", qApp, SLOT(quit()), CTRL+Key_Q); + menu->insertItem("&File", file); + + setCentralWidget(s1); +} + + +RootPanel::~RootPanel() +{ + clear(); +} + + +void +RootPanel::addUnit(NavUnit *unit) +{ + NodeItem *el = new NodeItem(&canvas, *unit); + nodeMap.bind(unit->getID(), el); + UnitLocation loc = unit->getLocation(); + el->move(loc.x_, loc.y_); + el->show(); + this->details->currentNode(unit); +} + +void +RootPanel::updateUnit(NavUnit *unit) +{ + NodeItem *el = NULL; + nodeMap.find(unit->getID(), el); + UnitLocation loc = unit->getLocation(); + el->move(loc.x_, loc.y_); + //canvas.update(); + + this->details->updateLocation(loc); +} + + +void +RootPanel::clear() +{ + navview->clear(); +} + +void +RootPanel::customEvent(QCustomEvent *e) +{ + CommandBase *cmd = (CommandBase*)(e->data()); + cmd->execute(); + delete cmd; +/* + int elapsed = time.restart(); + int fps = (elapsed == 0 ? 1000 : 1000 / elapsed); + + if(prev_fps != fps) + { + prev_fps = fps; + ups->setNum(prev_fps); + } +*/ +} |