summaryrefslogtreecommitdiffstats
path: root/grapher/GraphStyle.hxx
blob: ce75d6983e4aa82ae4304bf9894f2d6993e467ad (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
#ifndef SYSTEMTAP_GRAPHSTYLE_HXX
#define SYSTEMTAP_GRAPHSTYLE_HXX 1
#include <tr1/memory>

#include <cairomm/context.h>

namespace systemtap
{
  class GraphDataBase;
  class Graph;

  class GraphStyle
  {
  public:
    virtual void draw(std::tr1::shared_ptr<GraphDataBase> graphData,
                      Graph* graph, Cairo::RefPtr<Cairo::Context> cr) = 0;
    virtual ssize_t dataIndexAtPoint(double x, double y,
                                     std::tr1::shared_ptr<GraphDataBase>
                                     graphData,
                                     std::tr1::shared_ptr<Graph> graph)
    {
      return -1;
    }
  };

  class GraphStyleBar : public GraphStyle
  {
  public:
    void draw(std::tr1::shared_ptr<GraphDataBase> graphData,
              Graph* graph, Cairo::RefPtr<Cairo::Context> cr);
    
    static GraphStyleBar instance;
    ssize_t dataIndexAtPoint(double x, double y,
                             std::tr1::shared_ptr<GraphDataBase> graphData,
                             std::tr1::shared_ptr<Graph> graph);
  };

  class GraphStyleDot : public GraphStyle
  {
  public:
    void draw(std::tr1::shared_ptr<GraphDataBase> graphData,
              Graph* graph, Cairo::RefPtr<Cairo::Context> cr);
    static GraphStyleDot instance;
  };

  class GraphStyleEvent : public GraphStyle
  {
  public:
    void draw(std::tr1::shared_ptr<GraphDataBase> graphData,
              Graph* graph, Cairo::RefPtr<Cairo::Context> cr);
    virtual ssize_t dataIndexAtPoint(double x, double y,
                                     std::tr1::shared_ptr<GraphDataBase>
                                     graphData,
                                     std::tr1::shared_ptr<Graph> graph);
    static GraphStyleEvent instance;
  };  
}
#endif