Files
Upsilon/apps/shared/float_parameter_controller.h
Émilie Feral 7715da8e36 [apps/shared] In float parameter controllers, back has the same
consequence as 'validate'

Change-Id: Id45f824c50af2f6e47be5abd9115d98971a1e073
2017-04-26 09:39:14 +02:00

53 lines
2.2 KiB
C++

#ifndef SHARED_FLOAT_PARAMETER_CONTROLLER_H
#define SHARED_FLOAT_PARAMETER_CONTROLLER_H
#include <escher.h>
#include "text_field_delegate.h"
#include "button_with_separator.h"
namespace Shared {
/* This controller edits float parameter of any model (given through
* parameterAtIndex and setParameterAtIndex). */
class FloatParameterController : public DynamicViewController, public ListViewDataSource, public SelectableTableViewDelegate, public TextFieldDelegate {
public:
FloatParameterController(Responder * parentResponder);
void didBecomeFirstResponder() override;
void viewWillAppear() override;
void willExitResponderChain(Responder * nextFirstResponder) override;
bool handleEvent(Ion::Events::Event event) override;
int typeAtLocation(int i, int j) override;
int reusableCellCount(int type) override;
HighlightCell * reusableCell(int index, int type) override;
KDCoordinate rowHeight(int j) override;
KDCoordinate cumulatedHeightFromIndex(int j) override;
int indexFromCumulatedHeight(KDCoordinate offsetY) override;
void willDisplayCellForIndex(HighlightCell * cell, int index) override;
bool textFieldShouldFinishEditing(TextField * textField, Ion::Events::Event event) override;
bool textFieldDidFinishEditing(TextField * textField, const char * text, Ion::Events::Event event) override;
bool textFieldDidReceiveEvent(TextField * textField, Ion::Events::Event event) override;
void tableViewDidChangeSelection(SelectableTableView * t, int previousSelectedCellX, int previousSelectedCellY) override;
void unloadView() override;
protected:
int activeCell();
StackViewController * stackController();
virtual float parameterAtIndex(int index) = 0;
virtual SelectableTableView * selectableTableView();
View * createView() override;
private:
constexpr static int k_buttonMargin = 6;
virtual void buttonAction();
virtual I18n::Message okButtonText();
virtual int reusableParameterCellCount(int type) = 0;
virtual HighlightCell * reusableParameterCell(int index, int type) = 0;
TextFieldDelegateApp * textFieldDelegateApp() override;
virtual bool setParameterAtIndex(int parameterIndex, float f) = 0;
ButtonWithSeparator * m_okButton;
};
}
#endif