mirror of
https://github.com/UpsilonNumworks/Upsilon.git
synced 2026-03-27 17:50:04 +01:00
[apps/graph/values] Create a parameter page to configure the abscissa
column Change-Id: I69bad8037ece0c421a96fe8b190146f23912ca90
This commit is contained in:
76
apps/graph/values/abscissa_parameter_controller.cpp
Normal file
76
apps/graph/values/abscissa_parameter_controller.cpp
Normal file
@@ -0,0 +1,76 @@
|
||||
#include "abscissa_parameter_controller.h"
|
||||
#include <assert.h>
|
||||
|
||||
namespace Graph {
|
||||
|
||||
AbscissaParameterController::AbscissaParameterController(Responder * parentResponder) :
|
||||
ViewController(parentResponder),
|
||||
m_deleteColumn(ListViewCell((char*)"Effacer la colonne")),
|
||||
m_copyColumn(ListViewCell((char*)"Copier la colonne dans une liste")),
|
||||
m_setInterval(ListViewCell((char*)"Regler l'intervalle")),
|
||||
m_listView(ListView(this,Metric::TopMargin, Metric::RightMargin,
|
||||
Metric::BottomMargin, Metric::LeftMargin)),
|
||||
m_activeCell(0)
|
||||
{
|
||||
}
|
||||
|
||||
const char * AbscissaParameterController::title() const {
|
||||
return "Colonne x";
|
||||
}
|
||||
|
||||
View * AbscissaParameterController::view() {
|
||||
return &m_listView;
|
||||
}
|
||||
|
||||
void AbscissaParameterController::didBecomeFirstResponder() {
|
||||
setActiveCell(m_activeCell);
|
||||
}
|
||||
|
||||
void AbscissaParameterController::setActiveCell(int index) {
|
||||
if (index < 0 || index >= k_totalNumberOfCell) {
|
||||
return;
|
||||
}
|
||||
ListViewCell * previousCell = (ListViewCell *)(m_listView.cellAtIndex(m_activeCell));
|
||||
previousCell->setHighlighted(false);
|
||||
|
||||
m_activeCell = index;
|
||||
m_listView.scrollToRow(index);
|
||||
ListViewCell * cell = (ListViewCell *)(m_listView.cellAtIndex(index));
|
||||
cell->setHighlighted(true);
|
||||
}
|
||||
|
||||
bool AbscissaParameterController::handleEvent(Ion::Events::Event event) {
|
||||
switch (event) {
|
||||
case Ion::Events::Event::DOWN_ARROW:
|
||||
setActiveCell(m_activeCell+1);
|
||||
return true;
|
||||
case Ion::Events::Event::UP_ARROW:
|
||||
setActiveCell(m_activeCell-1);
|
||||
return true;
|
||||
case Ion::Events::Event::ENTER:
|
||||
return true;
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
int AbscissaParameterController::numberOfRows() {
|
||||
return k_totalNumberOfCell;
|
||||
};
|
||||
|
||||
View * AbscissaParameterController::reusableCell(int index) {
|
||||
assert(index >= 0);
|
||||
assert(index < k_totalNumberOfCell);
|
||||
View * cells[] = {&m_deleteColumn, &m_copyColumn, &m_setInterval};
|
||||
return cells[index];
|
||||
}
|
||||
|
||||
int AbscissaParameterController::reusableCellCount() {
|
||||
return k_totalNumberOfCell;
|
||||
}
|
||||
|
||||
KDCoordinate AbscissaParameterController::cellHeight() {
|
||||
return 35;
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user