AWind
TextBoxStrTouch.h
1 #pragma once
2 #include "TextBox.h"
3 
4 class TextBoxStrTouch : public TextBox
5 {
6  char *_text;
7 public:
8  TextBoxStrTouch(int left,int top,int width,int height,char *text):TextBox(left,top,width,height)
9  {
10  _text=text;
11  }
12  bool IsAwaitTouch()
13  {
14  return !TextBox::IsAwaitTouch();
15  }
16  bool OnTouch(int x,int y);
17  void SetText(char *text)
18  {
19  if(_text!=text)
20  {
21  _text = text;
22  if(_changedEvent!=NULL)
23  _changedEvent->NotifyContentChanged(this);
24  Invalidate();
25  }
26  }
27  char * GetText()
28  {
29  return _text;
30  }
31  virtual void OnDraw(DC *dc)
32  {
33  TextBox::OnDraw(dc);
34  dc->DrawText(_text,_offset_x,_offset_y);
35  }
36 };
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
virtual bool IsAwaitTouch()
Returns true if window await touch action (like button) or false if touch manager should ignore this ...
Definition: Window.h:107
Definition: TextBoxStrTouch.h:4
Base class for window with text content.
Definition: TextBox.h:30
bool IsAwaitTouch()
Returns true if window await touch action (like button) or false if touch manager should ignore this ...
Definition: TextBoxStrTouch.h:12
bool OnTouch(int x, int y)
Touch manager calls this function right after touch is released.
Definition: TextBoxStrTouch.cpp:5
virtual void OnDraw(DC *dc)
Implements drawing code.
Definition: TextBoxStrTouch.h:31
Device context. Abstraction layer to the device specific drawing code. Coordinates in drawing functio...
Definition: DC.h:29
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
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.