Numworks Epsilon  1.4.1
Graphing Calculator Operating System
responder_image_cell.cpp
Go to the documentation of this file.
1 #include "responder_image_cell.h"
2 #include <assert.h>
3 
4 namespace Probability {
5 
6 ResponderImageCell::ResponderImageCell(Responder * parentResponder, Law * law, Calculation * calculation, CalculationController * calculationController) :
8  Responder(parentResponder),
9  m_calculationTypeController(nullptr, law, calculation, calculationController)
10 {
11 }
12 
14  ctx->fillRect(bounds(), KDColorWhite);
16 }
17 
20 }
21 
23  if (event == Ion::Events::OK || event == Ion::Events::EXE || event == Ion::Events::Down) {
24  KDPoint topLeftAngle = app()->modalView()->pointFromPointInView(this, KDPoint(k_outline, k_outline));
25  app()->displayModalViewController(&m_calculationTypeController, 0.0f, 0.0f, topLeftAngle.y(), topLeftAngle.x());
26  return true;
27  }
28  return false;
29 }
30 
31 void ResponderImageCell::setHighlighted(bool highlight) {
33  m_imageCell.setHighlighted(highlight);
34 }
35 
36 void ResponderImageCell::setImage(const Image * image, const Image * focusedImage) {
37  m_imageCell.setImage(image, focusedImage);
38 }
39 
40 int ResponderImageCell::numberOfSubviews() const {
41  return 1;
42 }
43 
44 View * ResponderImageCell::subviewAtIndex(int index) {
45  assert(index == 0);
46  return &m_imageCell;
47 }
48 
49 void ResponderImageCell::layoutSubviews() {
50  m_imageCell.setFrame(KDRect(k_outline, k_outline, bounds().width()-2*k_outline, bounds().height()-2*k_outline));
51 }
52 
53 }
void strokeRect(KDRect rect, KDColor color)
ResponderImageCell(Responder *parentResponder, Law *law, Calculation *calculation, CalculationController *calculationController)
KDCoordinate y() const
Definition: point.h:11
#define assert(e)
Definition: assert.h:9
void displayModalViewController(ViewController *vc, float verticalAlignment, float horizontalAlignment, KDCoordinate topMargin=0, KDCoordinate leftMargin=0, KDCoordinate bottomMargin=0, KDCoordinate rightMargin=0)
Definition: app.cpp:85
void setHighlighted(bool highlight) override
void setFrame(KDRect frame)
Definition: view.cpp:125
static constexpr KDCoordinate k_height
Definition: image_cell.h:14
constexpr Event EXE
Definition: events.h:114
constexpr Event Down
Definition: events.h:63
Definition: image.h:6
void setHighlighted(bool highlight) override
Definition: image_cell.cpp:13
Definition: point.h:6
bool handleEvent(Ion::Events::Event event) override
Definition: size.h:6
constexpr KDColor KDColorWhite
Definition: color.h:42
KDSize minimalSizeForOptimalDisplay() const override
static constexpr KDCoordinate k_width
Definition: image_cell.h:13
static constexpr KDColor GreyMiddle
Definition: palette.h:14
void setImage(const Image *image, const Image *focusedImage)
Definition: image_cell.cpp:22
void drawRect(KDContext *ctx, KDRect rect) const override
Definition: rect.h:26
void fillRect(KDRect rect, KDColor color)
Definition: context_rect.cpp:8
void setImage(const Image *image, const Image *focusedImage)
Definition: view.h:23
KDCoordinate x() const
Definition: point.h:10
View * modalView()
Definition: app.cpp:122
App * app()
Definition: responder.cpp:77
constexpr Event OK
Definition: events.h:65
virtual void setHighlighted(bool highlight)
KDRect bounds() const
Definition: view.cpp:157
KDPoint pointFromPointInView(View *view, KDPoint point)
Definition: view.cpp:153
static constexpr KDCoordinate k_outline