Numworks Epsilon  1.4.1
Graphing Calculator Operating System
string_layout.h
Go to the documentation of this file.
1 #ifndef POINCARE_STRING_LAYOUT_H
2 #define POINCARE_STRING_LAYOUT_H
3 
5 #include <string.h>
6 
7 namespace Poincare {
8 
9 class StringLayout : public ExpressionLayout {
10 public:
11  // Here the inverse is a uint8_t instead of a bool, because the size of a bool is
12  // not standardized, thus since we call a foreign C function with this value we want to be
13  // sure about compatibility.
14  StringLayout(const char * string, size_t length, KDText::FontSize fontSize = KDText::FontSize::Large);
15  ~StringLayout();
16  StringLayout(const StringLayout& other) = delete;
17  StringLayout(StringLayout&& other) = delete;
18  StringLayout& operator=(const StringLayout& other) = delete;
19  StringLayout& operator=(StringLayout&& other) = delete;
20  char * text();
21 protected:
22  void render(KDContext * ctx, KDPoint p, KDColor expressionColor, KDColor backgroundColor) override;
23  KDSize computeSize() override;
24  ExpressionLayout * child(uint16_t index) override;
26 private:
27  char * m_string;
28  KDText::FontSize m_fontSize;
29 };
30 
31 }
32 
33 #endif
unsigned short uint16_t
Definition: stdint.h:5
Definition: point.h:6
Definition: size.h:6
ExpressionLayout * child(uint16_t index) override
KDSize computeSize() override
Definition: color.h:6
FontSize
Definition: text.h:10
StringLayout(const char *string, size_t length, KDText::FontSize fontSize=KDText::FontSize::Large)
StringLayout & operator=(const StringLayout &other)=delete
void render(KDContext *ctx, KDPoint p, KDColor expressionColor, KDColor backgroundColor) override
KDPoint positionOfChild(ExpressionLayout *child) override