10 m_isActivatingExamMode(
false),
16 if (m_isActivatingExamMode != activatingExamMode) {
17 m_isActivatingExamMode = activatingExamMode;
18 m_contentView.setMessages(activatingExamMode);
23 return &m_contentView;
27 if (m_isActivatingExamMode ==
false) {
33 m_contentView.setSelectedButton(0,
app());
38 m_contentView.setSelectedButton(0,
app());
42 m_contentView.setSelectedButton(1,
app());
48 ExamPopUpController::ContentView::ContentView(
Responder * parentResponder) :
49 m_cancelButton(parentResponder,
I18n::Message::Cancel,
Invocation([](void * context, void * sender) {
54 m_okButton(parentResponder, I18n::Message::Ok,
Invocation([](
void * context,
void * sender) {
74 void ExamPopUpController::ContentView::drawRect(
KDContext * ctx,
KDRect rect)
const {
78 void ExamPopUpController::ContentView::setSelectedButton(
int selectedButton,
App * app) {
79 m_cancelButton.setHighlighted(selectedButton == 0);
80 m_okButton.setHighlighted(selectedButton == 1);
81 if (selectedButton == 0) {
88 int ExamPopUpController::ContentView::selectedButton() {
89 if (m_cancelButton.isHighlighted()) {
95 void ExamPopUpController::ContentView::setMessages(
bool activingExamMode) {
96 if (activingExamMode) {
97 m_messageTextView1.setMessage(I18n::Message::ActiveExamModeMessage1);
98 m_messageTextView2.setMessage(I18n::Message::ActiveExamModeMessage2);
99 m_messageTextView3.setMessage(I18n::Message::ActiveExamModeMessage3);
101 m_messageTextView1.setMessage(I18n::Message::ExitExamMode1);
102 m_messageTextView2.setMessage(I18n::Message::ExitExamMode2);
103 m_messageTextView3.setMessage(I18n::Message::Default);
107 int ExamPopUpController::ContentView::numberOfSubviews()
const {
111 View * ExamPopUpController::ContentView::subviewAtIndex(
int index) {
114 return &m_warningTextView;
116 return &m_messageTextView1;
118 return &m_messageTextView2;
120 return &m_messageTextView3;
122 return &m_cancelButton;
131 void ExamPopUpController::ContentView::layoutSubviews() {
135 m_warningTextView.setFrame(
KDRect(0, k_topMargin, width, textHeight));
136 m_messageTextView1.setFrame(
KDRect(0, k_topMargin+k_paragraphHeight+textHeight, width, textHeight));
137 m_messageTextView2.setFrame(
KDRect(0, k_topMargin+k_paragraphHeight+2*textHeight, width, textHeight));
138 m_messageTextView3.setFrame(
KDRect(0, k_topMargin+k_paragraphHeight+3*textHeight, width, textHeight));
139 m_cancelButton.setFrame(
KDRect(k_buttonMargin, height-k_buttonMargin-k_buttonHeight, (width-3*k_buttonMargin)/2, k_buttonHeight));
140 m_okButton.setFrame(
KDRect(2*k_buttonMargin+(width-3*k_buttonMargin)/2, height-k_buttonMargin-k_buttonHeight, (width-3*k_buttonMargin)/2, k_buttonHeight));
ExamPopUpController(ExamPopUpControllerDelegate *delegate)
bool isActivatingExamMode() const
virtual void examDeactivatingPopUpIsDismissed()=0
void setExamMode(ExamMode examMode)
void didBecomeFirstResponder() override
bool handleEvent(Ion::Events::Event event) override
constexpr KDColor KDColorWhite
void viewDidDisappear() override
constexpr KDColor KDColorBlack
void fillRect(KDRect rect, KDColor color)
const Container * container() const
void setFirstResponder(Responder *responder)
static constexpr KDSize charSize(FontSize size=FontSize::Large)
void refreshPreferences()
void dismissModalViewController()
void setActivatingExamMode(bool activingExamMode)
static GlobalPreferences * sharedGlobalPreferences()
constexpr KDCoordinate height() const