Files
Upsilon/apps/settings/sub_menu/display_mode_controller.h
Léa Saviot 5e45a60f99 [apps/settings] Fix selection glitch
Scenario: Go to the Result format submenu of Settings. Modify the
significant figures with a wrong value (for instance, "7::"), press OK
then 0 -> he first row is selected, as well as the last row
2020-02-12 15:13:22 +01:00

39 lines
1.7 KiB
C++

#ifndef SETTINGS_DISPLAY_MODE_CONTROLLER_H
#define SETTINGS_DISPLAY_MODE_CONTROLLER_H
#include "preferences_controller.h"
#include "../message_table_cell_with_editable_text_with_separator.h"
#include "../../shared/parameter_text_field_delegate.h"
namespace Settings {
class DisplayModeController : public PreferencesController, public Shared::ParameterTextFieldDelegate {
public:
DisplayModeController(Responder * parentResponder, InputEventHandlerDelegate * inputEventHandlerDelegate);
KDCoordinate rowHeight(int j) override;
KDCoordinate cumulatedHeightFromIndex(int j) override;
int indexFromCumulatedHeight(KDCoordinate offsetY) override;
HighlightCell * reusableCell(int index, int type) override;
int reusableCellCount(int type) override;
int typeAtLocation(int i, int j) 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;
/* DisplayModeController is different to GenericSubController as it can
* display the modal view if there is a syntax error in the text field. We
* need to tweak the different Responder methods to handle the modal view
* properly. */
void didEnterResponderChain(Responder * previousFirstResponder) override {} // Override GenericSubController which reinitializes the selected cell
void didBecomeFirstResponder() override;
void viewWillAppear() override;
private:
static constexpr int k_resultFormatType = 0;
static constexpr int k_significantDigitsType = 1;
MessageTableCellWithEditableTextWithSeparator m_editableCell;
};
}
#endif