mirror of
https://github.com/UpsilonNumworks/Upsilon.git
synced 2026-01-19 00:37:25 +01:00
[apps/shared] Move partial class values controller and function
parameter controller to shared to be used by sequences Change-Id: I7908c184c757bb35856763bd339d3b34cf4ffe81
This commit is contained in:
64
apps/shared/values_function_parameter_controller.cpp
Normal file
64
apps/shared/values_function_parameter_controller.cpp
Normal file
@@ -0,0 +1,64 @@
|
||||
#include "values_function_parameter_controller.h"
|
||||
#include <assert.h>
|
||||
|
||||
namespace Shared {
|
||||
|
||||
ValuesFunctionParameterController::ValuesFunctionParameterController(char symbol) :
|
||||
ViewController(nullptr),
|
||||
m_copyColumn(PointerTableCellWithChevron((char*)"Copier la colonne dans une liste")),
|
||||
m_selectableTableView(SelectableTableView(this, this, Metric::CommonTopMargin, Metric::CommonRightMargin,
|
||||
Metric::CommonBottomMargin, Metric::CommonLeftMargin)),
|
||||
m_pageTitle{"Colonne f(x)"},
|
||||
m_function(nullptr)
|
||||
{
|
||||
for (int currentChar = 0; currentChar < k_maxNumberOfCharsInTitle; currentChar++) {
|
||||
if (m_pageTitle[currentChar] == '(') {
|
||||
m_pageTitle[currentChar+1] = symbol;
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
const char * ValuesFunctionParameterController::title() const {
|
||||
return m_pageTitle;
|
||||
}
|
||||
|
||||
View * ValuesFunctionParameterController::view() {
|
||||
return &m_selectableTableView;
|
||||
}
|
||||
|
||||
void ValuesFunctionParameterController::setFunction(Function * function) {
|
||||
m_function = function;
|
||||
for (int currentChar = 0; currentChar < k_maxNumberOfCharsInTitle; currentChar++) {
|
||||
if (m_pageTitle[currentChar] == '(') {
|
||||
m_pageTitle[currentChar-1] = *m_function->name();
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void ValuesFunctionParameterController::didBecomeFirstResponder() {
|
||||
m_selectableTableView.reloadData();
|
||||
m_selectableTableView.selectCellAtLocation(0, 0);
|
||||
app()->setFirstResponder(&m_selectableTableView);
|
||||
}
|
||||
|
||||
int ValuesFunctionParameterController::numberOfRows() {
|
||||
return 1;
|
||||
};
|
||||
|
||||
HighlightCell * ValuesFunctionParameterController::reusableCell(int index) {
|
||||
assert(index == 0);
|
||||
return &m_copyColumn;
|
||||
}
|
||||
|
||||
int ValuesFunctionParameterController::reusableCellCount() {
|
||||
return 1;
|
||||
}
|
||||
|
||||
KDCoordinate ValuesFunctionParameterController::cellHeight() {
|
||||
return Metric::ParameterCellHeight;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user