summaryrefslogtreecommitdiff
path: root/CIAO/examples/Display/NavDisplayGUI_exec/RootPanel.cpp
diff options
context:
space:
mode:
authorAbdullah Sowayan <sowayan@users.noreply.github.com>2007-03-18 22:23:37 +0000
committerAbdullah Sowayan <sowayan@users.noreply.github.com>2007-03-18 22:23:37 +0000
commit06a34455bd98b1379cc69bbc5b2cf085e0fc0d9b (patch)
tree8815ce3b3a85c3c4285429295f338e00ea4497f4 /CIAO/examples/Display/NavDisplayGUI_exec/RootPanel.cpp
parentd66fcc9b4aaec8e88eeb83fc578fdf8a3cc963de (diff)
downloadATCD-06a34455bd98b1379cc69bbc5b2cf085e0fc0d9b.tar.gz
Diffstat (limited to 'CIAO/examples/Display/NavDisplayGUI_exec/RootPanel.cpp')
-rw-r--r--CIAO/examples/Display/NavDisplayGUI_exec/RootPanel.cpp90
1 files changed, 90 insertions, 0 deletions
diff --git a/CIAO/examples/Display/NavDisplayGUI_exec/RootPanel.cpp b/CIAO/examples/Display/NavDisplayGUI_exec/RootPanel.cpp
new file mode 100644
index 00000000000..c6737ee96c0
--- /dev/null
+++ b/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);
+ }
+*/
+}