summaryrefslogtreecommitdiff
path: root/gui/graphing/graphing.h
blob: f97df8b34aead0cad9f64478e094de972770cd5b (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
#pragma once

#include <QString>

/**
 * A simple struct to hold a horizontal or vertical selection
 */
struct SelectionState {
    enum SelectionType {
        None,
        Horizontal,
        Vertical
    };

    SelectionType type;
    qint64 start;
    qint64 end;
};


/**
 * Fairly generic data provider for graphs
 */
class GraphDataProvider {
public:
    virtual ~GraphDataProvider(){}

    /* Number of elements in graph */
    virtual qint64 size() const = 0;

    /* Returns value for index */
    virtual qint64 value(qint64 index) const = 0;

    /* Is the item at index selected */
    virtual bool selected(qint64 index) const = 0;

    /* Get mouse hover tooltip for item */
    virtual QString itemTooltip(qint64 index) const = 0;

    /* Called on item double click */
    virtual void itemDoubleClicked(qint64 index) const = 0;

    /* Set pointer to selection state */
    virtual void setSelectionState(SelectionState* state) = 0;
};