File: graphing.h

package info (click to toggle)
apitrace 7.1%2Bgit20170623.d38a69d6%2Brepack-3
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 15,992 kB
  • sloc: cpp: 179,347; ansic: 62,439; python: 33,058; java: 377; makefile: 105; sh: 26; xml: 26
file content (45 lines) | stat: -rw-r--r-- 956 bytes parent folder | download | duplicates (6)
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;
};