summaryrefslogtreecommitdiffstats
path: root/grapher/GraphWidget.cxx
diff options
context:
space:
mode:
authorTim Moore <timoore@redhat.com>2009-09-02 12:39:05 +0200
committerTim Moore <timoore@redhat.com>2009-09-30 20:40:29 +0200
commiteece8f14d92f71fc12ab87c529fffc5fcc5a4e94 (patch)
tree2a0b6fce96e5acc0ee0316f889e616a7c2fcef1b /grapher/GraphWidget.cxx
parentc18a296b760df73e2c233077aa0b863f67ed725f (diff)
downloadsystemtap-steved-eece8f14d92f71fc12ab87c529fffc5fcc5a4e94.tar.gz
systemtap-steved-eece8f14d92f71fc12ab87c529fffc5fcc5a4e94.tar.xz
systemtap-steved-eece8f14d92f71fc12ab87c529fffc5fcc5a4e94.zip
Add graph data chooser window, based on glade
* configure.ac: Test for libglademm * grapher/GraphWidget.hxx (DataModelColumns): new class (onDataDialogCancel, void onDataAdd, onDataRemove, onDataDialogOpen): new methods * grapher/GraphWidget.cxx: ditto; methods for the graph data dialog. * grapher/graph-dialog.glade: New file. * grapher/graph-dialog.gladep: New file. * grapher/Makefile.am (dist_pkgdata_DATA): add graph-dialog.glade to installation. * grapher/GraphWidget.cxx (GraphWidget constructor): Use PKGDATADIR
Diffstat (limited to 'grapher/GraphWidget.cxx')
-rw-r--r--grapher/GraphWidget.cxx62
1 files changed, 59 insertions, 3 deletions
diff --git a/grapher/GraphWidget.cxx b/grapher/GraphWidget.cxx
index 757060e1..f3319806 100644
--- a/grapher/GraphWidget.cxx
+++ b/grapher/GraphWidget.cxx
@@ -1,8 +1,13 @@
#include <algorithm>
#include <ctime>
#include <math.h>
+#include <iostream>
#include <cairomm/context.h>
+#include <libglademm.h>
+
+#include "../config.h"
+
#include "GraphWidget.hxx"
#include "CairoWidget.hxx"
@@ -10,7 +15,9 @@ namespace systemtap
{
using namespace std;
using namespace std::tr1;
-
+
+
+
GraphWidget::GraphWidget()
: _trackingDrag(false), _width(600), _height(200)
{
@@ -34,6 +41,30 @@ namespace systemtap
// Temporary testing of multiple graphs
shared_ptr<Graph> graph(new Graph);
_graphs.push_back(graph);
+ try
+ {
+ _refXmlDataDialog = Gnome::Glade::Xml::create(PKGDATADIR "/graph-dialog.glade");
+ _refXmlDataDialog->get_widget("dialog1", _dataDialog);
+ Gtk::Button* button = 0;
+ _refXmlDataDialog->get_widget("cancelbutton1", button);
+ button->signal_clicked()
+ .connect(sigc::mem_fun(*this, &GraphWidget::onDataDialogCancel),
+ false);
+ _refXmlDataDialog->get_widget("button1", button);
+ button->signal_clicked()
+ .connect(sigc::mem_fun(*this, &GraphWidget::onDataAdd), false);
+ _refXmlDataDialog->get_widget("button2", button);
+ button->signal_clicked()
+ .connect(sigc::mem_fun(*this, &GraphWidget::onDataRemove), false);
+ _refXmlDataDialog->get_widget("treeview1", _dataTreeView);
+ _dataDialog->signal_map()
+ .connect(sigc::mem_fun(*this, &GraphWidget::onDataDialogOpen));
+ }
+ catch (const Gnome::Glade::XmlError& ex )
+ {
+ std::cerr << ex.what() << std::endl;
+ throw;
+ }
}
GraphWidget::~GraphWidget()
@@ -103,8 +134,16 @@ namespace systemtap
&& event->y >= (*g)->_graphY
&& event->y < (*g)->_graphY + (*g)->_graphHeight)
{
- _activeGraph = *g;
- break;
+ _activeGraph = *g;
+ if (event->button == 3)
+ {
+ _dataDialog->show();
+ return true;
+ }
+ else
+ {
+ break;
+ }
}
}
if (!_activeGraph)
@@ -198,4 +237,21 @@ namespace systemtap
req->width = _width;
req->height = _height;
}
+
+ void GraphWidget::onDataDialogCancel()
+ {
+ _dataDialog->hide();
+ }
+
+ void GraphWidget::onDataAdd()
+ {
+ }
+
+ void GraphWidget::onDataRemove()
+ {
+ }
+
+ void GraphWidget::onDataDialogOpen()
+ {
+ }
}