6 const static int _bufSize = 70;
7 const static int _editSize = 18;
8 int _editPos, _caretPos, _bufLen;
21 dc->
DrawText(_tmpBuf,_offset_x,_offset_y);
22 dc->
DrawCaret(_caretPos, _offset_x, _offset_y);
26 s = _bufLen - _editSize;
29 e = (_bufLen > _editSize)? _editSize : _bufLen;
30 strncpy(_tmpBuf, _buf+s, e);
39 _bufLen = (len > _bufSize)? _bufSize : len;
40 strncpy(_buf, text, _bufLen);
43 _caretPos = (_bufLen > _editSize)? _editSize : _bufLen;
46 if(_changedEvent!=NULL)
53 s = (
char*) malloc(
sizeof(
char) * (strlen(_buf)+1) );
64 void UpdateEdit(byte b)
70 for (i=_editPos-1; i<_bufLen; i++)
74 if (_bufLen < _editSize)
85 if ((_editPos < _bufSize) && (_bufLen < _bufSize)) {
86 if (_editPos != _bufLen) {
87 for (i=_bufLen; i>=_editPos; i--)
90 _buf[_editPos++] = (char)b;
92 if (_caretPos<_editSize)
94 if (_editPos == _bufLen)
void DrawText(const __FlashStringHelper *text, int x, int y)
Draws PROGMEM string. Input coordinates have to be defined in the window coordinate system...
Definition: DC.h:177
Base class for window with text content.
Definition: TextBox.h:30
Definition: TextBoxEditString.h:4
Device context. Abstraction layer to the device specific drawing code. Coordinates in drawing functio...
Definition: DC.h:29
void DrawCaret(int pos, int x, int y)
Draw caret. Input coordinates have to be defined in the window coordinate system. ...
Definition: DC.h:228
void Invalidate()
If function is called than the window manager updates the window.
Definition: Window.h:157
void OnDraw(DC *dc)
Implements drawing code.
Definition: TextBox.h:69
virtual void OnDraw(DC *dc)
Implements drawing code.
Definition: TextBoxEditString.h:18
TextBox(int left, int top, int width, int height)
Constructor.
Definition: TextBox.h:45
virtual void NotifyContentChanged(Window *window)=0
Has to be implemented in target class.