From bb91631807ad833a92d011895ad7ca1872e02745 Mon Sep 17 00:00:00 2001 From: Tim Moore Date: Wed, 29 Jul 2009 13:11:10 +0200 Subject: Draw multiple graphs * grapher/Graph.cxx (Graph constructor): Initialize graph dimensions. (draw): Don't clear the drawing area. * grapher/GraphWidget.hxx (GraphWidget): Add dimensions and on_size_request() method. * grapher/GraphWidget.cxx (GraphWidget constructor): Initialize dimensions. (addGraph): New method. (on_size_request): New method to pass widget's size to parent widgets * grapher/grapher.cxx (GrapherWindow constructor): add "add graph" action. (addGraph): New method. --- grapher/grapher.cxx | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'grapher/grapher.cxx') diff --git a/grapher/grapher.cxx b/grapher/grapher.cxx index 95ac232d..ad7023f2 100644 --- a/grapher/grapher.cxx +++ b/grapher/grapher.cxx @@ -32,6 +32,7 @@ public: GraphWidget w; protected: virtual void on_menu_file_quit(); + void addGraph(); // menu support Glib::RefPtr m_refUIManager; Glib::RefPtr m_refActionGroup; @@ -48,6 +49,8 @@ GrapherWindow::GrapherWindow() m_refActionGroup = Gtk::ActionGroup::create(); //File menu: m_refActionGroup->add(Gtk::Action::create("FileMenu", "File")); + m_refActionGroup->add(Gtk::Action::create("AddGraph", "Add graph"), + sigc::mem_fun(*this, &GrapherWindow::addGraph)); m_refActionGroup->add(Gtk::Action::create("FileQuit", Gtk::Stock::QUIT), sigc::mem_fun(*this, &GrapherWindow::on_menu_file_quit)); m_refUIManager = Gtk::UIManager::create(); @@ -59,6 +62,7 @@ GrapherWindow::GrapherWindow() "" " " " " + " " " " " " " " @@ -136,3 +140,9 @@ int main(int argc, char** argv) ; return 0; } + +void GrapherWindow::addGraph() +{ + w.addGraph(); + +} -- cgit