Numworks Epsilon  1.4.1
Graphing Calculator Operating System
app.cpp
Go to the documentation of this file.
1 #include "app.h"
2 #include "../i18n.h"
3 #include "probability_icon.h"
4 #include <new>
5 
6 using namespace Shared;
7 
8 namespace Probability {
9 
10 I18n::Message App::Descriptor::name() {
11  return I18n::Message::ProbaApp;
12 }
13 
14 I18n::Message App::Descriptor::upperName() {
15  return I18n::Message::ProbaAppCapital;
16 }
17 
19  return ImageStore::ProbabilityIcon;
20 }
21 
22 App::Snapshot::Snapshot() :
23  m_law{},
24  m_calculation{},
25  m_activePage(Page::Law)
26 {
27  new(m_law) BinomialLaw();
28  new(m_calculation) LeftIntegralCalculation();
29  calculation()->setLaw(law());
30 }
31 
33  law()->~Law();
34  calculation()->~Calculation();
35 }
36 
38  return new App(container, this);
39 }
40 
42  static Descriptor descriptor;
43  return &descriptor;
44 }
45 
47  law()->~Law();
48  new(m_law) BinomialLaw();
49  calculation()->~Calculation();
50  new(m_calculation) LeftIntegralCalculation();
51  m_activePage = Page::Law;
52 }
53 
55  return (Law *)m_law;
56 }
57 
59  return (Calculation *)m_calculation;
60 }
61 
63  m_activePage = activePage;
64 }
65 
67  return m_activePage;
68 }
69 
71  TextFieldDelegateApp(container, snapshot, &m_stackViewController),
72  m_calculationController(&m_stackViewController, snapshot->law(), snapshot->calculation()),
73  m_parametersController(&m_stackViewController, snapshot->law(), &m_calculationController),
74  m_lawController(&m_stackViewController, snapshot->law(), &m_parametersController),
75  m_stackViewController(&m_modalViewController, &m_lawController)
76 {
77  switch (snapshot->activePage()) {
79  m_stackViewController.push(&m_parametersController, KDColorWhite, Palette::PurpleBright, Palette::PurpleBright);
80  break;
82  m_stackViewController.push(&m_parametersController, KDColorWhite, Palette::PurpleBright, Palette::PurpleBright);
83  m_stackViewController.push(&m_calculationController, KDColorWhite, Palette::SubTab, Palette::SubTab);
84  default:
85  break;
86  }
87 }
88 
89 
90 }
static constexpr KDColor PurpleBright
Definition: palette.h:10
Snapshot * snapshot()
Definition: app.cpp:41
Calculation * calculation()
Definition: app.cpp:58
Descriptor * descriptor() override
Definition: app.cpp:41
Definition: image.h:6
App(Container *container, Snapshot *snapshot, ViewController *rootViewController, I18n::Message warningMessage=(I18n::Message) 0)
Definition: app.cpp:30
ModalViewController m_modalViewController
Definition: app.h:65
constexpr KDColor KDColorWhite
Definition: color.h:42
static constexpr KDColor SubTab
Definition: palette.h:21
App * unpack(Container *container) override
Definition: app.cpp:37
virtual const Image * icon()
Definition: app.cpp:15
virtual I18n::Message upperName()
Definition: app.cpp:11
void reset() override
Definition: app.cpp:46
void setActivePage(Page activePage)
Definition: app.cpp:62
virtual I18n::Message name()
Definition: app.cpp:7