Numworks Epsilon  1.4.1
Graphing Calculator Operating System
even_odd_double_buffer_text_cell.cpp
Go to the documentation of this file.
2 #include <assert.h>
3 
5  EvenOddCell(),
6  Responder(parentResponder),
7  m_firstTextSelected(true),
8  m_firstBufferTextView(KDText::FontSize::Small),
9  m_secondBufferTextView(KDText::FontSize::Small)
10 {
11 }
12 
14  return m_firstBufferTextView.text();
15 }
16 
19 }
20 
22  return m_firstTextSelected;
23 }
24 
29  reloadCell();
30 }
31 
35 }
36 
41  if (isHighlighted()) {
42  if (m_firstTextSelected) {
44  } else {
46  }
47  }
48  reloadCell();
49 }
50 
54  reloadCell();
55 }
56 
57 void EvenOddDoubleBufferTextCell::setFirstText(const char * textContent) {
58  m_firstBufferTextView.setText(textContent);
59 }
60 
61 void EvenOddDoubleBufferTextCell::setSecondText(const char * textContent) {
62  m_secondBufferTextView.setText(textContent);
63 }
64 
68 }
69 
71  return 2;
72 }
73 
75  assert(index == 0 || index == 1);
76  if (index == 0) {
77  return &m_firstBufferTextView;
78  }
79  return &m_secondBufferTextView;
80 }
81 
83  KDCoordinate width = bounds().width();
84  KDCoordinate height = bounds().height();
85  m_firstBufferTextView.setFrame(KDRect(0, 0, width/2, height));
86  m_secondBufferTextView.setFrame(KDRect(width/2, 0, width/2, height));
87 }
88 
90  if (m_firstTextSelected && event == Ion::Events::Right) {
91  selectFirstText(false);
92  return true;
93  }
94  if (!m_firstTextSelected && event == Ion::Events::Left) {
95  selectFirstText(true);
96  return true;
97  }
98  return false;
99 }
100 
void setFirstText(const char *textContent)
#define assert(e)
Definition: assert.h:9
void setFrame(KDRect frame)
Definition: view.cpp:125
int16_t KDCoordinate
Definition: coordinate.h:6
EvenOddDoubleBufferTextCell(Responder *parentResponder=nullptr)
Definition: text.h:8
void setTextColor(KDColor textColor)
void setText(const char *textContent)
bool handleEvent(Ion::Events::Event event) override
void setEven(bool even) override
bool isHighlighted() const
void setHighlighted(bool highlight) override
constexpr Event Left
Definition: events.h:61
Definition: rect.h:26
Definition: color.h:6
void setHighlighted(bool highlight) override
Definition: view.h:23
constexpr Event Right
Definition: events.h:64
KDCoordinate width() const
Definition: rect.h:39
virtual void setHighlighted(bool highlight)
virtual void reloadCell()
KDCoordinate height() const
Definition: rect.h:40
KDRect bounds() const
Definition: view.cpp:157
void setSecondText(const char *textContent)
#define true
Definition: stdbool.h:8