[apps] Shared: Factorize code: all FunctionGraphView have a member

indicating the selected function
This commit is contained in:
Émilie Feral
2018-01-08 15:53:14 +01:00
committed by EmilieNumworks
parent 0dec52a708
commit a6050fda55
5 changed files with 16 additions and 14 deletions

View File

@@ -9,6 +9,7 @@ namespace Shared {
FunctionGraphView::FunctionGraphView(InteractiveCurveViewRange * graphRange,
CurveViewCursor * cursor, BannerView * bannerView, View * cursorView) :
CurveView(graphRange, cursor, bannerView, cursorView),
m_selectedFunction(nullptr),
m_xLabels{},
m_yLabels{},
m_context(nullptr)
@@ -32,6 +33,14 @@ Context * FunctionGraphView::context() const {
return m_context;
}
void FunctionGraphView::selectFunction(Function * function) {
if (m_selectedFunction != function) {
reload();
m_selectedFunction = function;
reload();
}
}
char * FunctionGraphView::label(Axis axis, int index) const {
return (axis == Axis::Horizontal ? (char *)m_xLabels[index] : (char *)m_yLabels[index]);
}