8 constexpr
KDColor LEDTestController::k_LEDColors[k_numberOfColors];
14 m_batteryTestController(this)
24 setLEDColor(LEDColorAtIndex(m_LEDColorIndex++));
25 if (m_LEDColorIndex == k_numberOfColors) {
35 setLEDColor(LEDColorAtIndex(m_LEDColorIndex++));
38 void LEDTestController::setLEDColor(
KDColor color) {
40 m_view.LEDColorIndicatorView()->setColor(color);
43 KDColor LEDTestController::LEDColorAtIndex(
int i) {
44 assert(i >= 0 && i < k_numberOfColors);
45 return k_LEDColors[i];
48 LEDTestController::ContentView::ContentView() :
52 m_ledView(
KDText::FontSize::Large),
55 m_ledView.setText(
"LED");
58 SolidColorView * LEDTestController::ContentView::LEDColorIndicatorView() {
59 return &m_ledColorIndicatorView;
62 void LEDTestController::ContentView::layoutSubviews() {
63 KDSize ledSize = m_ledView.minimalSizeForOptimalDisplay();
65 m_ledColorIndicatorView.setFrame(
KDRect((
Ion::Display::Width-k_indicatorSize)/2+k_indicatorMargin/2+ledSize.
width()/2, k_arrowLength+2*k_arrowMargin, k_indicatorSize, k_indicatorSize));
66 m_ledColorOutlineView.setFrame(
KDRect((
Ion::Display::Width-k_indicatorSize)/2+k_indicatorMargin/2+ledSize.
width()/2-1, k_arrowLength+2*k_arrowMargin-1, k_indicatorSize+2, k_indicatorSize+2));
67 m_arrowView.setFrame(
KDRect(0, k_arrowMargin, bounds().width(), k_arrowLength));
70 int LEDTestController::ContentView::numberOfSubviews()
const {
74 View * LEDTestController::ContentView::subviewAtIndex(
int index) {
79 return &m_ledColorOutlineView;
82 return &m_ledColorIndicatorView;
constexpr KDCoordinate width() const
Responder * parentResponder() const
void viewWillAppear() override
constexpr KDColor KDColorWhite
constexpr KDColor KDColorBlack
void displayModalViewController(ViewController *vc, float verticalAlignment, float horizontalAlignment, KDCoordinate topMargin=0, KDCoordinate leftMargin=0, KDCoordinate bottomMargin=0, KDCoordinate rightMargin=0)
bool handleEvent(Ion::Events::Event event) override
LEDTestController(Responder *parentResponder)
constexpr KDCoordinate height() const