Blame view

build3/apps/hardware_test/usb_test_controller.h 1.36 KB
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
  #ifndef HARDWARE_TEST_USB_TEST_CONTROLLER_H
  #define HARDWARE_TEST_USB_TEST_CONTROLLER_H
  
  #include <escher.h>
  #include "reset_controller.h"
  #include "arrow_view.h"
  
  namespace HardwareTest {
  
  class USBTestController : public ViewController, public Timer {
  public:
    USBTestController(Responder * parentResponder);
    View * view() override;
    void viewWillAppear() override;
    bool handleEvent(Ion::Events::Event e) override;
  private:
    bool fire() override;
    class ContentView : public SolidColorView {
    public:
      ContentView();
      BufferTextView * USBTextView();
      ArrowView * arrowView();
    private:
      class USBView : public View {
      public:
        void drawRect(KDContext * ctx, KDRect rect) const override;
        constexpr static KDCoordinate k_USBHoleWidth = 40;
        constexpr static KDCoordinate k_USBHoleHeight = 20;
        constexpr static KDCoordinate k_marginHeight = 50;
      };
      constexpr static KDCoordinate k_textHeight = 50;
      void layoutSubviews() override;
      int numberOfSubviews() const override;
      View * subviewAtIndex(int index) override;
      BufferTextView m_USBTextView;
      USBView m_USBView;
      ArrowView m_arrowView;
    };
    constexpr static const char * k_USBPlugText = "PLUG USB";
    constexpr static const char * k_USBUnplugText = "OK, UNPLUG USB";
    ContentView m_view;
    bool m_shouldPlugUSB;
    ResetController m_resetController;
  };
  
  }
  
  #endif