Numworks Epsilon  1.4.1
Graphing Calculator Operating System
warning_controller.cpp
Go to the documentation of this file.
2 #include <escher/app.h>
3 
4 WarningController::ContentView::ContentView() :
6  m_textView(KDText::FontSize::Small, (I18n::Message)0, 0.5f, 0.5f, KDColorWhite, KDColorBlack)
7 {
8 }
9 
10 void WarningController::ContentView::setLabel(I18n::Message label) {
11  m_textView.setMessage(label);
12 }
13 
14 int WarningController::ContentView::numberOfSubviews() const {
15  return 1;
16 }
17 
18 View * WarningController::ContentView::subviewAtIndex(int index) {
19  return &m_textView;
20 }
21 
22 void WarningController::ContentView::layoutSubviews() {
23  m_textView.setFrame(bounds());
24 }
25 
26 KDSize WarningController::ContentView::minimalSizeForOptimalDisplay() const {
27  KDSize textSize = m_textView.minimalSizeForOptimalDisplay();
28  return KDSize(textSize.width() + k_horizontalMargin, textSize.height() + k_verticalMargin);
29 }
30 
31 WarningController::WarningController(Responder * parentResponder, I18n::Message warningMessage) :
32  ViewController(parentResponder),
33  m_contentView(),
34  m_warningMessage(warningMessage)
35 {
36 }
37 
38 void WarningController::setLabel(I18n::Message label) {
39  m_contentView.setLabel(label);
40 }
41 
42 const char * WarningController::title() {
43  return I18n::translate(m_warningMessage);
44 }
45 
47  return &m_contentView;
48 }
49 
52  return true;
53 }
Definition: i18n.h:6
bool handleEvent(Ion::Events::Event event) override
void setFrame(KDRect frame)
Definition: view.cpp:125
const char * title() override
constexpr KDCoordinate width() const
Definition: size.h:10
Definition: text.h:8
void setLabel(I18n::Message message)
Definition: size.h:6
enum Message uint16_t enum Language uint16_t const char * translate(Message m, Language l=(Language) 0)
Definition: i18n.cpp:5
constexpr KDColor KDColorWhite
Definition: color.h:42
constexpr KDColor KDColorBlack
Definition: color.h:41
View * view() override
WarningController(Responder *parentResponder, I18n::Message warningMessage)
Definition: view.h:23
App * app()
Definition: responder.cpp:77
void dismissModalViewController()
Definition: app.cpp:93
constexpr KDCoordinate height() const
Definition: size.h:11