11 USBTestController::USBTestController(
Responder * parentResponder) :
15 m_shouldPlugUSB(
true),
16 m_resetController(this)
28 bool USBTestController::fire() {
30 m_view.USBTextView()->setText(k_USBUnplugText);
31 m_view.arrowView()->setDirection(
false);
33 m_shouldPlugUSB =
false;
45 m_shouldPlugUSB =
true;
46 m_view.USBTextView()->setText(k_USBPlugText);
47 m_view.arrowView()->setDirection(
true);
51 void USBTestController::ContentView::USBView::drawRect(
KDContext * ctx,
KDRect rect)
const {
61 ctx->
fillRect(
KDRect((width-4)/2, k_USBHoleHeight+k_marginHeight+30+50+10, 4, height-(k_USBHoleHeight+k_marginHeight+30+50+10)),
KDColorBlack);
64 USBTestController::ContentView::ContentView() :
66 m_USBTextView(
KDText::FontSize::Large),
73 return &m_USBTextView;
76 ArrowView * USBTestController::ContentView::arrowView() {
80 void USBTestController::ContentView::layoutSubviews() {
81 m_USBTextView.
setFrame(
KDRect(0, 0, bounds().width(), k_textHeight));
82 m_USBView.setFrame(
KDRect(0, k_textHeight, bounds().width(), bounds().height()-k_textHeight));
83 m_arrowView.setFrame(
KDRect(0, k_textHeight+USBView::k_USBHoleHeight+5, bounds().width(), USBView::k_marginHeight-10));
86 int USBTestController::ContentView::numberOfSubviews()
const {
90 View * USBTestController::ContentView::subviewAtIndex(
int index) {
91 assert(index >= 0 && index < 3);
93 return &m_USBTextView;
void viewWillAppear() override
void setFrame(KDRect frame)
Responder * parentResponder() const
constexpr KDColor KDColorWhite
constexpr KDColor KDColorBlack
bool handleEvent(Ion::Events::Event e) override
void fillRect(KDRect rect, KDColor color)
void displayModalViewController(ViewController *vc, float verticalAlignment, float horizontalAlignment, KDCoordinate topMargin=0, KDCoordinate leftMargin=0, KDCoordinate bottomMargin=0, KDCoordinate rightMargin=0)
constexpr KDColor KDColorRed
constexpr KDColor KDColorGreen