From 6197b0dc80c4f87000d26213293fe2cb72fbe081 Mon Sep 17 00:00:00 2001 From: Tim Moore Date: Tue, 1 Dec 2009 19:05:09 +0100 Subject: Refactor drawing of different styles of graph into classes * grapher/GraphStyle.cxx: New file * grapher/GraphStyle.hxx: New file * grapher/Graph(draw): Move much drawing code to GraphStyle::draw --- grapher/GraphStyle.hxx | 43 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 43 insertions(+) create mode 100644 grapher/GraphStyle.hxx (limited to 'grapher/GraphStyle.hxx') diff --git a/grapher/GraphStyle.hxx b/grapher/GraphStyle.hxx new file mode 100644 index 00000000..4a0cd955 --- /dev/null +++ b/grapher/GraphStyle.hxx @@ -0,0 +1,43 @@ +#ifndef SYSTEMTAP_GRAPHSTYLE_HXX +#define SYSTEMTAP_GRAPHSTYLE_HXX 1 +#include + +#include + +namespace systemtap +{ + class GraphDataBase; + class Graph; + + class GraphStyle + { + public: + virtual void draw(std::tr1::shared_ptr graphData, + Graph* graph, Cairo::RefPtr cr) = 0; + }; + + class GraphStyleBar : public GraphStyle + { + public: + virtual void draw(std::tr1::shared_ptr graphData, + Graph* graph, Cairo::RefPtr cr); + static GraphStyleBar instance; + }; + + class GraphStyleDot : public GraphStyle + { + public: + virtual void draw(std::tr1::shared_ptr graphData, + Graph* graph, Cairo::RefPtr cr); + static GraphStyleDot instance; + }; + + class GraphStyleEvent : public GraphStyle + { + public: + virtual void draw(std::tr1::shared_ptr graphData, + Graph* graph, Cairo::RefPtr cr); + static GraphStyleEvent instance; + }; +} +#endif -- cgit