1 #include <MutilaDebug.h> 2 #include "GfxTextBox.h" 3 #include "CbOledDisplay.h" 5 GfxTextBox::GfxTextBox(uint16_t width, String text,
bool border) :
13 _DBF(
"GfxText draw@%d,%d : text=%s\n", xOffset, yOffset, _text.c_str());
14 CbOledDisplay.setFont(CBOLED_MESSAGE_FONT);
15 uint16_t strLenPixels;
16 uint16_t useLen = _text.length();
19 strLenPixels = CbOledDisplay.getStrWidth(_text.substring(0, useLen).c_str());
20 strLenPixels + 4 > _width && useLen > 0;
21 }
while (strLenPixels + 2 > _width && useLen-- > 0);
22 CbOledDisplay.drawStr(xOffset+2,
23 yOffset+CBOLED_MESSAGE_FONT_VSEP+CBOLED_MESSAGE_FONT_HEIGHT,
24 _text.substring(0, useLen).c_str());
26 CbOledDisplay.drawFrame(xOffset,
39 return CBOLED_MESSAGE_FONT_HEIGHT + (2*CBOLED_MESSAGE_FONT_VSEP);
void draw(uint16_t xOffset=0, uint16_t yOffset=0)