mirror of
https://github.com/UpsilonNumworks/Upsilon.git
synced 2026-01-19 00:37:25 +01:00
[apps] Shared: Factorize code: all FunctionGraphView have a member
indicating the selected function
This commit is contained in:
committed by
EmilieNumworks
parent
0dec52a708
commit
a6050fda55
@@ -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]);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user