summaryrefslogtreecommitdiffstats
path: root/grapher/GraphStyle.hxx
blob: bea4922a31ea85fc6a790c1233e9f4f7823499bb (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
59
60
61
62
63
64
65
66
// systemtap grapher
// Copyright (C) 2009 Red Hat Inc.
//
// This file is part of systemtap, and is free software.  You can
// redistribute it and/or modify it under the terms of the GNU General
// Public License (GPL); either version 2, or (at your option) any
// later version.

#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