mirror of
https://github.com/UpsilonNumworks/Upsilon.git
synced 2026-03-19 05:40:38 +01:00
[apps/probability] Create a class calculation controller
Change-Id: I87f5a712d213ae3f4dd5553b64e2b641bd0601ba
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
app_objs += $(addprefix apps/probability/,\
|
||||
app.o\
|
||||
calculation_controller.o\
|
||||
cell.o\
|
||||
evaluate_context.o\
|
||||
law.o\
|
||||
|
||||
46
apps/probability/calculation_controller.cpp
Normal file
46
apps/probability/calculation_controller.cpp
Normal file
@@ -0,0 +1,46 @@
|
||||
#include "calculation_controller.h"
|
||||
#include <assert.h>
|
||||
|
||||
namespace Probability {
|
||||
|
||||
CalculationController::ContentView::ContentView(Responder * parentResponder, Law * law) :
|
||||
m_lawCurveView(LawCurveView(law))
|
||||
{
|
||||
}
|
||||
|
||||
int CalculationController::ContentView::numberOfSubviews() const {
|
||||
return 1;
|
||||
}
|
||||
|
||||
View * CalculationController::ContentView::subviewAtIndex(int index) {
|
||||
assert(index == 0);
|
||||
return &m_lawCurveView;
|
||||
}
|
||||
|
||||
void CalculationController::ContentView::layoutSubviews() {
|
||||
m_lawCurveView.setFrame(bounds());
|
||||
}
|
||||
|
||||
CalculationController::CalculationController(Responder * parentResponder, Law * law) :
|
||||
ViewController(parentResponder),
|
||||
m_contentView(ContentView(this, law)),
|
||||
m_law(law)
|
||||
{
|
||||
}
|
||||
|
||||
View * CalculationController::view() {
|
||||
return &m_contentView;
|
||||
}
|
||||
|
||||
const char * CalculationController::title() const {
|
||||
return "Calculer les probabilites";
|
||||
}
|
||||
|
||||
bool CalculationController::handleEvent(Ion::Events::Event event) {
|
||||
return false;
|
||||
}
|
||||
|
||||
void CalculationController::didBecomeFirstResponder() {
|
||||
}
|
||||
|
||||
}
|
||||
33
apps/probability/calculation_controller.h
Normal file
33
apps/probability/calculation_controller.h
Normal file
@@ -0,0 +1,33 @@
|
||||
#ifndef PROBABILITY_CALCULATION_CONTROLLER_H
|
||||
#define PROBABILITY_CALCULATION_CONTROLLER_H
|
||||
|
||||
#include <escher.h>
|
||||
#include "law.h"
|
||||
#include "law_curve_view.h"
|
||||
|
||||
namespace Probability {
|
||||
|
||||
class CalculationController : public ViewController {
|
||||
public:
|
||||
CalculationController(Responder * parentResponder, Law * law);
|
||||
View * view() override;
|
||||
const char * title() const override;
|
||||
bool handleEvent(Ion::Events::Event event) override;
|
||||
void didBecomeFirstResponder() override;
|
||||
private:
|
||||
class ContentView : public View {
|
||||
public:
|
||||
ContentView(Responder * parentResponder, Law * law);
|
||||
void layoutSubviews() override;
|
||||
private:
|
||||
int numberOfSubviews() const override;
|
||||
View * subviewAtIndex(int index) override;
|
||||
LawCurveView m_lawCurveView;
|
||||
};
|
||||
ContentView m_contentView;
|
||||
Law * m_law;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
Reference in New Issue
Block a user