Files
Upsilon/apps/calculation/additional_outputs/complex_graph_cell.h

38 lines
1.2 KiB
C++

#ifndef CALCULATION_ADDITIONAL_OUTPUTS_COMPLEX_GRAPH_CELL_H
#define CALCULATION_ADDITIONAL_OUTPUTS_COMPLEX_GRAPH_CELL_H
#include "../../shared/curve_view.h"
#include "complex_model.h"
namespace Calculation {
class ComplexGraphView : public Shared::CurveView {
public:
ComplexGraphView(ComplexModel * complexModel);
void drawRect(KDContext * ctx, KDRect rect) const override;
private:
char * label(Axis axis, int index) const override {
return (axis == Axis::Horizontal ? (char *)m_xLabels[index] : (char *)m_yLabels[index]);
}
char m_xLabels[k_maxNumberOfXLabels][k_labelBufferMaxSize];
char m_yLabels[k_maxNumberOfYLabels][k_labelBufferMaxSize];
ComplexModel * m_complex;
};
class ComplexGraphCell : public HighlightCell {
public:
ComplexGraphCell(ComplexModel * complexModel) : m_view(complexModel) {}
void setHighlighted(bool highlight) override { return; }
void reload() { m_view.reload(); }
private:
int numberOfSubviews() const override { return 1; }
View * subviewAtIndex(int index) override { return &m_view; }
void layoutSubviews(bool force = false) override { m_view.setFrame(bounds(), force); }
ComplexGraphView m_view;
};
}
#endif