Numworks Epsilon  1.4.1
Graphing Calculator Operating System
language_controller.cpp
Go to the documentation of this file.
1 #include "language_controller.h"
2 #include "../global_preferences.h"
3 #include "../apps_container.h"
4 #include "../i18n.h"
5 
6 namespace Shared {
7 
9  ViewController(parentResponder),
10  m_selectableTableView(this, this, this)
11 {
12  m_selectableTableView.setTopMargin(topMargin);
13  m_selectableTableView.setBottomMargin(0);
14  for (int i = 0; i < I18n::NumberOfLanguages; i++) {
16  }
17 }
18 
20  m_selectableTableView.deselectTable();
22  selectCellAtLocation(0, index);
23 }
24 
25 const char * LanguageController::title() {
26  return I18n::translate(I18n::Message::Language);
27 }
28 
30  return &m_selectableTableView;
31 }
32 
34  app()->setFirstResponder(&m_selectableTableView);
35 }
36 
39 }
40 
42  if (event == Ion::Events::OK || event == Ion::Events::EXE) {
44  return true;
45  }
46  return false;
47 }
48 
50  return I18n::NumberOfLanguages;
51 }
52 
55 }
56 
58  return &m_cells[index];
59 }
60 
62  return I18n::NumberOfLanguages;
63 }
64 
66  static_cast<MessageTableCell *>(cell)->setMessage(I18n::LanguageNames[index]);
67 }
68 
69 }
void setBottomMargin(KDCoordinate m)
Definition: scroll_view.h:17
constexpr Event EXE
Definition: events.h:114
int16_t KDCoordinate
Definition: coordinate.h:6
HighlightCell * reusableCell(int index) override
enum Message uint16_t enum Language uint16_t const char * translate(Message m, Language l=(Language) 0)
Definition: i18n.cpp:5
void setTopMargin(KDCoordinate m)
Definition: scroll_view.h:13
LanguageController(Responder *parentResponder, KDCoordinate topMargin)
void setLanguage(I18n::Language language)
void willDisplayCellForIndex(HighlightCell *cell, int index) override
const char * title() override
void setMessageFontSize(KDText::FontSize fontSize)
I18n::Language language() const
static constexpr KDCoordinate ParameterCellHeight
Definition: metric.h:15
void setFirstResponder(Responder *responder)
Definition: app.cpp:62
Definition: view.h:23
bool handleEvent(Ion::Events::Event event) override
KDCoordinate cellHeight() override
App * app()
Definition: responder.cpp:77
constexpr Event OK
Definition: events.h:65
static GlobalPreferences * sharedGlobalPreferences()