6663b6c9
adorian
projet complet av...
|
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
|
#ifndef SHARED_STORE_CONTROLLER_H
#define SHARED_STORE_CONTROLLER_H
#include <escher.h>
#include "buffer_text_view_with_text_field.h"
#include "editable_cell_table_view_controller.h"
#include "double_pair_store.h"
#include "store_cell.h"
#include "store_context.h"
#include "store_parameter_controller.h"
#include "store_selectable_table_view.h"
namespace Shared {
class StoreController : public EditableCellTableViewController, public ButtonRowDelegate {
public:
StoreController(Responder * parentResponder, DoublePairStore * store, ButtonRowController * header);
virtual StoreContext * storeContext() = 0;
void displayFormulaInput();
virtual void setFormulaLabel() = 0;
virtual bool fillColumnWithFormula(Poincare::Expression * formula) = 0;
// TextFieldDelegate
bool textFieldShouldFinishEditing(TextField * textField, Ion::Events::Event event) override;
bool textFieldDidFinishEditing(TextField * textField, const char * text, Ion::Events::Event event) override;
bool textFieldDidAbortEditing(TextField * textField) override;
// TableViewDataSource
int numberOfColumns() override;
KDCoordinate columnWidth(int i) override;
KDCoordinate cumulatedWidthFromIndex(int i) override;
int indexFromCumulatedWidth(KDCoordinate offsetX) override;
HighlightCell * reusableCell(int index, int type) override;
int reusableCellCount(int type) override;
int typeAtLocation(int i, int j) override;
void willDisplayCellAtLocation(HighlightCell * cell, int i, int j) override;
// ViewController
const char * title() override;
// Responder
bool handleEvent(Ion::Events::Event event) override;
void didBecomeFirstResponder() override;
protected:
static constexpr KDCoordinate k_cellWidth = 116;
static constexpr KDCoordinate k_margin = 8;
static constexpr KDCoordinate k_scrollBarMargin = Metric::CommonRightMargin;
constexpr static int k_maxNumberOfEditableCells = 22 * DoublePairStore::k_numberOfSeries;
constexpr static int k_numberOfTitleCells = 4;
static constexpr int k_titleCellType = 0;
static constexpr int k_editableCellType = 1;
class ContentView : public View , public Responder {
public:
ContentView(DoublePairStore * store, Responder * parentResponder, TableViewDataSource * dataSource, SelectableTableViewDataSource * selectionDataSource, TextFieldDelegate * textFieldDelegate);
StoreSelectableTableView * dataView() { return &m_dataView; }
BufferTextViewWithTextField * formulaInputView() { return &m_formulaInputView; }
void displayFormulaInput(bool display);
// Responder
void didBecomeFirstResponder() override;
private:
static constexpr KDCoordinate k_margin = 8;
static constexpr KDCoordinate k_scrollBarMargin = Metric::CommonRightMargin;
static constexpr KDCoordinate k_formulaInputHeight = 31;
int numberOfSubviews() const override { return 1 + m_displayFormulaInputView; }
View * subviewAtIndex(int index) override;
void layoutSubviews() override;
KDRect formulaFrame() const;
StoreSelectableTableView m_dataView;
BufferTextViewWithTextField m_formulaInputView;
bool m_displayFormulaInputView;
};
Responder * tabController() const override;
SelectableTableView * selectableTableView() override;
View * loadView() override;
void unloadView(View * view) override;
bool cellAtLocationIsEditable(int columnIndex, int rowIndex) override;
bool setDataAtLocation(double floatBody, int columnIndex, int rowIndex) override;
double dataAtLocation(int columnIndex, int rowIndex) override;
int numberOfElements() override;
int maxNumberOfElements() const override;
virtual HighlightCell * titleCells(int index) = 0;
char m_draftTextBuffer[TextField::maxBufferSize()];
int seriesAtColumn(int column) const { return column / DoublePairStore::k_numberOfColumnsPerSeries; }
bool privateFillColumnWithFormula(Poincare::Expression * formula, Poincare::Expression::isVariableTest isVariable);
virtual StoreParameterController * storeParameterController() = 0;
StoreCell * m_editableCells[k_maxNumberOfEditableCells];
DoublePairStore * m_store;
private:
bool cellShouldBeTransparent(int i, int j);
ContentView * contentView() { return static_cast<ContentView *>(view()); }
};
}
#endif
|