diff options
Diffstat (limited to 'grapher/GraphWidget.cxx')
-rw-r--r-- | grapher/GraphWidget.cxx | 26 |
1 files changed, 23 insertions, 3 deletions
diff --git a/grapher/GraphWidget.cxx b/grapher/GraphWidget.cxx index 53c7645d..c4613fd7 100644 --- a/grapher/GraphWidget.cxx +++ b/grapher/GraphWidget.cxx @@ -12,7 +12,7 @@ namespace systemtap using namespace std::tr1; GraphWidget::GraphWidget() - : _trackingDrag(false) + : _trackingDrag(false), _width(600), _height(200) { add_events(Gdk::POINTER_MOTION_MASK | Gdk::BUTTON_PRESS_MASK | Gdk::BUTTON_RELEASE_MASK | Gdk::SCROLL_MASK); @@ -33,8 +33,6 @@ namespace systemtap .connect(sigc::mem_fun(*this, &GraphWidget::on_scroll_event), false); // Temporary testing of multiple graphs shared_ptr<Graph> graph(new Graph); - graph->_graphHeight = 180; - graph->_graphWidth = 580; _graphs.push_back(graph); } @@ -46,6 +44,22 @@ namespace systemtap { _graphs[0]->addGraphData(data); } + + void GraphWidget::addGraph() + { + shared_ptr<Graph> graph(new Graph); + double x = 0.0; + double y = 0.0; + if (!_graphs.empty()) + { + _graphs.back()->getOrigin(x, y); + y += _graphs.back()->_height + 10; + _height = y + graph->_height; + } + graph->setOrigin(x, y); + _graphs.push_back(graph); + queue_resize(); + } bool GraphWidget::on_expose_event(GdkEventExpose* event) { @@ -174,4 +188,10 @@ namespace systemtap queue_draw(); return true; } + + void GraphWidget::on_size_request(Gtk::Requisition* req) + { + req->width = _width; + req->height = _height; + } } |