]> git.cworth.org Git - apitrace/blobdiff - gui/graphing/graphing.h
Rewrote profile graph drawing code.
[apitrace] / gui / graphing / graphing.h
diff --git a/gui/graphing/graphing.h b/gui/graphing/graphing.h
new file mode 100644 (file)
index 0000000..35b4a91
--- /dev/null
@@ -0,0 +1,48 @@
+#ifndef GRAPHING_H
+#define GRAPHING_H
+
+#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;
+};
+
+#endif