mirror of
https://github.com/UpsilonNumworks/Upsilon.git
synced 2026-03-26 17:20:53 +01:00
[escher] Change name list view cell -> menu list cell
Change-Id: I9fccf615fc0ebacadf7d0b55ca9af5ec997ce572
This commit is contained in:
@@ -5,9 +5,9 @@ namespace Graph {
|
||||
|
||||
ParameterController::ParameterController(Responder * parentResponder, FunctionStore * functionStore) :
|
||||
ViewController(parentResponder),
|
||||
m_colorCell(ListViewCell((char*)"Couleur de la fonction")),
|
||||
m_enableCell(SwitchListViewCell((char*)"Activer/Desactiver")),
|
||||
m_deleteCell(ListViewCell((char*)"Supprimer la fonction")),
|
||||
m_colorCell(MenuListCell((char*)"Couleur de la fonction")),
|
||||
m_enableCell(SwitchMenuListCell((char*)"Activer/Desactiver")),
|
||||
m_deleteCell(MenuListCell((char*)"Supprimer la fonction")),
|
||||
m_selectableTableView(SelectableTableView(this, this, Metric::TopMargin, Metric::RightMargin,
|
||||
Metric::BottomMargin, Metric::LeftMargin)),
|
||||
m_functionStore(functionStore)
|
||||
|
||||
@@ -24,9 +24,9 @@ public:
|
||||
private:
|
||||
bool handleEnter();
|
||||
constexpr static int k_totalNumberOfCell = 3;
|
||||
ListViewCell m_colorCell;
|
||||
SwitchListViewCell m_enableCell;
|
||||
ListViewCell m_deleteCell;
|
||||
MenuListCell m_colorCell;
|
||||
SwitchMenuListCell m_enableCell;
|
||||
MenuListCell m_deleteCell;
|
||||
SelectableTableView m_selectableTableView;
|
||||
Function * m_function;
|
||||
FunctionStore * m_functionStore;
|
||||
|
||||
@@ -5,9 +5,9 @@ namespace Graph {
|
||||
|
||||
AbscissaParameterController::AbscissaParameterController(Responder * parentResponder, ValuesParameterController * valuesParameterController) :
|
||||
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_deleteColumn(MenuListCell((char*)"Effacer la colonne")),
|
||||
m_copyColumn(MenuListCell((char*)"Copier la colonne dans une liste")),
|
||||
m_setInterval(MenuListCell((char*)"Regler l'intervalle")),
|
||||
m_selectableTableView(SelectableTableView(this, this, Metric::TopMargin, Metric::RightMargin,
|
||||
Metric::BottomMargin, Metric::LeftMargin)),
|
||||
m_valuesParameterController(valuesParameterController)
|
||||
|
||||
@@ -20,9 +20,9 @@ public:
|
||||
private:
|
||||
bool handleEnter();
|
||||
constexpr static int k_totalNumberOfCell = 3;
|
||||
ListViewCell m_deleteColumn;
|
||||
ListViewCell m_copyColumn;
|
||||
ListViewCell m_setInterval;
|
||||
MenuListCell m_deleteColumn;
|
||||
MenuListCell m_copyColumn;
|
||||
MenuListCell m_setInterval;
|
||||
SelectableTableView m_selectableTableView;
|
||||
ValuesParameterController * m_valuesParameterController;
|
||||
};
|
||||
|
||||
@@ -6,8 +6,8 @@ namespace Graph {
|
||||
DerivativeParameterController::DerivativeParameterController(Responder * parentResponder) :
|
||||
ViewController(parentResponder),
|
||||
m_pageTitle("Colonne f'(x)"),
|
||||
m_hideColumn(ListViewCell((char*)"Masquer la colonne de la derivee")),
|
||||
m_copyColumn(ListViewCell((char*)"Copier la colonne dans une liste")),
|
||||
m_hideColumn(MenuListCell((char*)"Masquer la colonne de la derivee")),
|
||||
m_copyColumn(MenuListCell((char*)"Copier la colonne dans une liste")),
|
||||
m_selectableTableView(SelectableTableView(this, this, Metric::TopMargin, Metric::RightMargin,
|
||||
Metric::BottomMargin, Metric::LeftMargin)),
|
||||
m_function(nullptr)
|
||||
|
||||
@@ -24,8 +24,8 @@ private:
|
||||
constexpr static int k_totalNumberOfCell = 2;
|
||||
constexpr static int k_maxNumberOfCharsInTitle = 16;
|
||||
char m_pageTitle[k_maxNumberOfCharsInTitle];
|
||||
ListViewCell m_hideColumn;
|
||||
ListViewCell m_copyColumn;
|
||||
MenuListCell m_hideColumn;
|
||||
MenuListCell m_copyColumn;
|
||||
SelectableTableView m_selectableTableView;
|
||||
Function * m_function;
|
||||
};
|
||||
|
||||
@@ -6,8 +6,8 @@ namespace Graph {
|
||||
FunctionParameterController::FunctionParameterController(Responder * parentResponder) :
|
||||
ViewController(parentResponder),
|
||||
m_pageTitle("Colonne f(x)"),
|
||||
m_displayDerivativeColumn(SwitchListViewCell((char*)"Colonne de la fonction derivee")),
|
||||
m_copyColumn(ListViewCell((char*)"Copier la colonne dans une liste")),
|
||||
m_displayDerivativeColumn(SwitchMenuListCell((char*)"Colonne de la fonction derivee")),
|
||||
m_copyColumn(MenuListCell((char*)"Copier la colonne dans une liste")),
|
||||
m_selectableTableView(SelectableTableView(this, this, Metric::TopMargin, Metric::RightMargin,
|
||||
Metric::BottomMargin, Metric::LeftMargin)),
|
||||
m_function(nullptr)
|
||||
|
||||
@@ -25,8 +25,8 @@ private:
|
||||
constexpr static int k_totalNumberOfCell = 2;
|
||||
constexpr static int k_maxNumberOfCharsInTitle = 16;
|
||||
char m_pageTitle[k_maxNumberOfCharsInTitle];
|
||||
SwitchListViewCell m_displayDerivativeColumn;
|
||||
ListViewCell m_copyColumn;
|
||||
SwitchMenuListCell m_displayDerivativeColumn;
|
||||
MenuListCell m_copyColumn;
|
||||
SelectableTableView m_selectableTableView;
|
||||
Function * m_function;
|
||||
};
|
||||
|
||||
@@ -7,9 +7,9 @@ namespace Graph {
|
||||
ValuesParameterController::ValuesParameterController(Responder * parentResponder, Interval * interval) :
|
||||
ViewController(parentResponder),
|
||||
m_interval(interval),
|
||||
m_intervalStartCell(TextListViewCell((char*)"X Debut")),
|
||||
m_intervalEndCell(TextListViewCell((char*)"X Fin")),
|
||||
m_intervalStepCell(TextListViewCell((char*)"Pas")),
|
||||
m_intervalStartCell(TextMenuListCell((char*)"X Debut")),
|
||||
m_intervalEndCell(TextMenuListCell((char*)"X Fin")),
|
||||
m_intervalStepCell(TextMenuListCell((char*)"Pas")),
|
||||
m_selectableTableView(SelectableTableView(this, this, Metric::TopMargin, Metric::RightMargin,
|
||||
Metric::BottomMargin, Metric::LeftMargin))
|
||||
{
|
||||
@@ -37,7 +37,7 @@ int ValuesParameterController::activeCell() {
|
||||
}
|
||||
|
||||
void ValuesParameterController::willDisplayCellForIndex(TableViewCell * cell, int index) {
|
||||
TextListViewCell * myCell = (TextListViewCell *) cell;
|
||||
TextMenuListCell * myCell = (TextMenuListCell *) cell;
|
||||
char buffer[14];
|
||||
switch (index) {
|
||||
case 0:
|
||||
@@ -97,8 +97,8 @@ void ValuesParameterController::editInterval(bool overwrite, char initialDigit)
|
||||
initialTextContent[0] = initialDigit;
|
||||
initialTextContent[1] = 0;
|
||||
} else {
|
||||
TextListViewCell * textListViewCell = (TextListViewCell *)reusableCell(activeCell());
|
||||
strlcpy(initialTextContent, textListViewCell->textContent(), sizeof(initialTextContent));
|
||||
TextMenuListCell * textMenuListCell = (TextMenuListCell *)reusableCell(activeCell());
|
||||
strlcpy(initialTextContent, textMenuListCell->textContent(), sizeof(initialTextContent));
|
||||
}
|
||||
App * myApp = (App *)app();
|
||||
InputViewController * inputController = myApp->inputViewController();
|
||||
@@ -106,7 +106,7 @@ void ValuesParameterController::editInterval(bool overwrite, char initialDigit)
|
||||
[](void * context, void * sender){
|
||||
ValuesParameterController * valuesParameterController = (ValuesParameterController *)context;
|
||||
int activeCell = valuesParameterController->activeCell();
|
||||
TextListViewCell * cell = (TextListViewCell *)valuesParameterController->reusableCell(activeCell);
|
||||
TextMenuListCell * cell = (TextMenuListCell *)valuesParameterController->reusableCell(activeCell);
|
||||
InputViewController * myInputViewController = (InputViewController *)sender;
|
||||
const char * textBody = myInputViewController->textBody();
|
||||
App * myApp = (App *)valuesParameterController->app();
|
||||
|
||||
@@ -25,9 +25,9 @@ public:
|
||||
private:
|
||||
constexpr static int k_totalNumberOfCell = 3;
|
||||
Interval * m_interval;
|
||||
TextListViewCell m_intervalStartCell;
|
||||
TextListViewCell m_intervalEndCell;
|
||||
TextListViewCell m_intervalStepCell;
|
||||
TextMenuListCell m_intervalStartCell;
|
||||
TextMenuListCell m_intervalEndCell;
|
||||
TextMenuListCell m_intervalStepCell;
|
||||
SelectableTableView m_selectableTableView;
|
||||
};
|
||||
|
||||
|
||||
@@ -62,7 +62,7 @@ int Probability::LawController::reusableCellCount() {
|
||||
}
|
||||
|
||||
void Probability::LawController::willDisplayCellForIndex(TableViewCell * cell, int index) {
|
||||
ListViewCell * myCell = (ListViewCell *)cell;
|
||||
MenuListCell * myCell = (MenuListCell *)cell;
|
||||
myCell->textView()->setText(m_messages[index]);
|
||||
myCell->textView()->setAlignment(0., 0.5);
|
||||
}
|
||||
|
||||
@@ -24,7 +24,7 @@ private:
|
||||
constexpr static int k_maxNumberOfCells = 10;
|
||||
// !!! CAUTION: The order here is important
|
||||
// The cells should be initialized *before* the listview!
|
||||
ListViewCell m_cells[k_maxNumberOfCells];
|
||||
MenuListCell m_cells[k_maxNumberOfCells];
|
||||
SelectableTableView m_selectableTableView;
|
||||
const char ** m_messages;
|
||||
};
|
||||
|
||||
@@ -9,8 +9,8 @@ objs += $(addprefix escher/src/,\
|
||||
image_view.o\
|
||||
invocation.o\
|
||||
input_view_controller.o\
|
||||
list_view_cell.o\
|
||||
list_view_data_source.o\
|
||||
menu_list_cell.o\
|
||||
metric.o\
|
||||
palette.o\
|
||||
pointer_text_view.o\
|
||||
@@ -23,7 +23,7 @@ objs += $(addprefix escher/src/,\
|
||||
solid_color_view.o\
|
||||
stack_view.o\
|
||||
stack_view_controller.o\
|
||||
switch_list_view_cell.o\
|
||||
switch_menu_list_cell.o\
|
||||
switch_view.o\
|
||||
tab_view.o\
|
||||
tab_view_cell.o\
|
||||
@@ -32,7 +32,7 @@ objs += $(addprefix escher/src/,\
|
||||
table_view_cell.o\
|
||||
table_view_data_source.o\
|
||||
text_field.o\
|
||||
text_list_view_cell.o\
|
||||
text_menu_list_cell.o\
|
||||
text_view.o\
|
||||
tiled_view.o\
|
||||
view.o\
|
||||
|
||||
@@ -10,8 +10,8 @@
|
||||
#include <escher/image_view.h>
|
||||
#include <escher/input_view_controller.h>
|
||||
#include <escher/invocation.h>
|
||||
#include <escher/list_view_cell.h>
|
||||
#include <escher/list_view_data_source.h>
|
||||
#include <escher/menu_list_cell.h>
|
||||
#include <escher/metric.h>
|
||||
#include <escher/palette.h>
|
||||
#include <escher/pointer_text_view.h>
|
||||
@@ -24,9 +24,9 @@
|
||||
#include <escher/solid_color_view.h>
|
||||
#include <escher/stack_view_controller.h>
|
||||
#include <escher/switch_view.h>
|
||||
#include <escher/switch_list_view_cell.h>
|
||||
#include <escher/switch_menu_list_cell.h>
|
||||
#include <escher/text_field.h>
|
||||
#include <escher/text_list_view_cell.h>
|
||||
#include <escher/text_menu_list_cell.h>
|
||||
#include <escher/text_view.h>
|
||||
#include <escher/tab_view_controller.h>
|
||||
#include <escher/table_view.h>
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
#ifndef ESCHER_LIST_VIEW_CELL_H
|
||||
#define ESCHER_LIST_VIEW_CELL_H
|
||||
#ifndef ESCHER_MENU_LIST_CELL_H
|
||||
#define ESCHER_MENU_LIST_CELL_H
|
||||
|
||||
#include <escher/view.h>
|
||||
#include <escher/pointer_text_view.h>
|
||||
@@ -7,9 +7,9 @@
|
||||
#include <escher/metric.h>
|
||||
#include <escher/table_view_cell.h>
|
||||
|
||||
class ListViewCell : public TableViewCell {
|
||||
class MenuListCell : public TableViewCell {
|
||||
public:
|
||||
ListViewCell(char * label = nullptr);
|
||||
MenuListCell(char * label = nullptr);
|
||||
PointerTextView * textView();
|
||||
virtual View * contentView() const;
|
||||
void drawRect(KDContext * ctx, KDRect rect) const override;
|
||||
@@ -1,15 +0,0 @@
|
||||
#ifndef ESCHER_SWITCH_LIST_VIEW_CELL_H
|
||||
#define ESCHER_SWITCH_LIST_VIEW_CELL_H
|
||||
|
||||
#include <escher/list_view_cell.h>
|
||||
#include <escher/switch_view.h>
|
||||
|
||||
class SwitchListViewCell : public ListViewCell {
|
||||
public:
|
||||
SwitchListViewCell(char * label);
|
||||
View * contentView() const override;
|
||||
private:
|
||||
SwitchView m_contentView;
|
||||
};
|
||||
|
||||
#endif
|
||||
15
escher/include/escher/switch_menu_list_cell.h
Normal file
15
escher/include/escher/switch_menu_list_cell.h
Normal file
@@ -0,0 +1,15 @@
|
||||
#ifndef ESCHER_SWITCH_MENU_LIST_CELL_H
|
||||
#define ESCHER_SWITCH_MENU_LIST_CELL_H
|
||||
|
||||
#include <escher/menu_list_cell.h>
|
||||
#include <escher/switch_view.h>
|
||||
|
||||
class SwitchMenuListCell : public MenuListCell {
|
||||
public:
|
||||
SwitchMenuListCell(char * label);
|
||||
View * contentView() const override;
|
||||
private:
|
||||
SwitchView m_contentView;
|
||||
};
|
||||
|
||||
#endif
|
||||
@@ -1,12 +1,12 @@
|
||||
#ifndef ESCHER_TEXT_LIST_VIEW_CELL_H
|
||||
#define ESCHER_TEXT_LIST_VIEW_CELL_H
|
||||
#ifndef ESCHER_TEXT_MENU_LIST_CELL_H
|
||||
#define ESCHER_TEXT_MENU_LIST_CELL_H
|
||||
|
||||
#include <escher/list_view_cell.h>
|
||||
#include <escher/menu_list_cell.h>
|
||||
#include <escher/buffer_text_view.h>
|
||||
|
||||
class TextListViewCell : public ListViewCell {
|
||||
class TextMenuListCell : public MenuListCell {
|
||||
public:
|
||||
TextListViewCell(char * label);
|
||||
TextMenuListCell(char * label);
|
||||
void reloadCell() override;
|
||||
View * contentView() const override;
|
||||
void setHighlighted(bool highlight);
|
||||
@@ -1,22 +1,22 @@
|
||||
#include <escher/list_view_cell.h>
|
||||
#include <escher/menu_list_cell.h>
|
||||
#include <assert.h>
|
||||
|
||||
constexpr KDCoordinate ListViewCell::k_separatorThickness;
|
||||
constexpr KDCoordinate MenuListCell::k_separatorThickness;
|
||||
|
||||
ListViewCell::ListViewCell(char * label) :
|
||||
MenuListCell::MenuListCell(char * label) :
|
||||
TableViewCell(),
|
||||
m_pointerTextView(PointerTextView(label, 0, 0.5, KDColorBlack, Palette::CellBackgroundColor))
|
||||
{
|
||||
}
|
||||
|
||||
int ListViewCell::numberOfSubviews() const {
|
||||
int MenuListCell::numberOfSubviews() const {
|
||||
if (contentView() == nullptr) {
|
||||
return 1;
|
||||
}
|
||||
return 2;
|
||||
}
|
||||
|
||||
View * ListViewCell::subviewAtIndex(int index) {
|
||||
View * MenuListCell::subviewAtIndex(int index) {
|
||||
if (index == 0) {
|
||||
return &m_pointerTextView;
|
||||
}
|
||||
@@ -24,7 +24,7 @@ View * ListViewCell::subviewAtIndex(int index) {
|
||||
return contentView();
|
||||
}
|
||||
|
||||
void ListViewCell::layoutSubviews() {
|
||||
void MenuListCell::layoutSubviews() {
|
||||
KDCoordinate width = bounds().width();
|
||||
KDCoordinate height = bounds().height();
|
||||
KDSize labelSize = m_pointerTextView.minimalSizeForOptimalDisplay();
|
||||
@@ -35,21 +35,21 @@ void ListViewCell::layoutSubviews() {
|
||||
}
|
||||
}
|
||||
|
||||
void ListViewCell::reloadCell() {
|
||||
void MenuListCell::reloadCell() {
|
||||
TableViewCell::reloadCell();
|
||||
KDColor backgroundColor = isHighlighted()? Palette::FocusCellBackgroundColor : Palette::CellBackgroundColor;
|
||||
m_pointerTextView.setBackgroundColor(backgroundColor);
|
||||
}
|
||||
|
||||
PointerTextView * ListViewCell::textView() {
|
||||
PointerTextView * MenuListCell::textView() {
|
||||
return &m_pointerTextView;
|
||||
}
|
||||
|
||||
View * ListViewCell::contentView() const {
|
||||
View * MenuListCell::contentView() const {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
void ListViewCell::drawRect(KDContext * ctx, KDRect rect) const {
|
||||
void MenuListCell::drawRect(KDContext * ctx, KDRect rect) const {
|
||||
KDCoordinate width = bounds().width();
|
||||
KDCoordinate height = bounds().height();
|
||||
KDColor backgroundColor = isHighlighted() ? Palette::FocusCellBackgroundColor : Palette::CellBackgroundColor;
|
||||
@@ -1,11 +0,0 @@
|
||||
#include <escher/switch_list_view_cell.h>
|
||||
|
||||
SwitchListViewCell::SwitchListViewCell(char * label) :
|
||||
ListViewCell(label),
|
||||
m_contentView(SwitchView())
|
||||
{
|
||||
}
|
||||
|
||||
View * SwitchListViewCell::contentView() const {
|
||||
return (View *)&m_contentView;
|
||||
}
|
||||
11
escher/src/switch_menu_list_cell.cpp
Normal file
11
escher/src/switch_menu_list_cell.cpp
Normal file
@@ -0,0 +1,11 @@
|
||||
#include <escher/switch_menu_list_cell.h>
|
||||
|
||||
SwitchMenuListCell::SwitchMenuListCell(char * label) :
|
||||
MenuListCell(label),
|
||||
m_contentView(SwitchView())
|
||||
{
|
||||
}
|
||||
|
||||
View * SwitchMenuListCell::contentView() const {
|
||||
return (View *)&m_contentView;
|
||||
}
|
||||
@@ -1,31 +1,31 @@
|
||||
#include <escher/text_list_view_cell.h>
|
||||
#include <escher/text_menu_list_cell.h>
|
||||
|
||||
TextListViewCell::TextListViewCell(char * label) :
|
||||
ListViewCell(label),
|
||||
TextMenuListCell::TextMenuListCell(char * label) :
|
||||
MenuListCell(label),
|
||||
m_contentView(BufferTextView(1.0f, 0.5f))
|
||||
{
|
||||
}
|
||||
|
||||
void TextListViewCell::setText(const char * textBody) {
|
||||
void TextMenuListCell::setText(const char * textBody) {
|
||||
m_contentView.setText(textBody);
|
||||
}
|
||||
|
||||
const char * TextListViewCell::textContent() {
|
||||
const char * TextMenuListCell::textContent() {
|
||||
return m_contentView.text();
|
||||
}
|
||||
|
||||
View * TextListViewCell::contentView() const {
|
||||
View * TextMenuListCell::contentView() const {
|
||||
return (View *)&m_contentView;
|
||||
}
|
||||
|
||||
void TextListViewCell::reloadCell() {
|
||||
ListViewCell::reloadCell();
|
||||
void TextMenuListCell::reloadCell() {
|
||||
MenuListCell::reloadCell();
|
||||
KDColor backgroundColor = isHighlighted()? Palette::FocusCellBackgroundColor : Palette::CellBackgroundColor;
|
||||
m_contentView.setBackgroundColor(backgroundColor);
|
||||
}
|
||||
|
||||
void TextListViewCell::setHighlighted(bool highlight) {
|
||||
ListViewCell::setHighlighted(highlight);
|
||||
void TextMenuListCell::setHighlighted(bool highlight) {
|
||||
MenuListCell::setHighlighted(highlight);
|
||||
KDColor backgroundColor = highlight? Palette::FocusCellBackgroundColor : Palette::CellBackgroundColor;
|
||||
m_contentView.setBackgroundColor(backgroundColor);
|
||||
}
|
||||
Reference in New Issue
Block a user