AWind
TextBoxChar.h
1 #pragma once
2 #include "TextBox.h"
3 
4 class TextBoxChar : public TextBox
5 {
6  char _chr;
7 public:
8  TextBoxChar(int left,int top,int width,int height, char ch):TextBox(left,top,width,height)
9  {
10  _chr = ch;
11  }
12  virtual void OnDraw(DC *dc)
13  {
14  TextBox::OnDraw(dc);
15  dc->DrawChar(_chr,_offset_x,_offset_y);
16  }
17  void SetChar(char ch)
18  {
19  _chr = ch;
20  if(_changedEvent!=NULL)
21  _changedEvent->NotifyContentChanged(this);
22  Invalidate();
23  }
24  char GetChar()
25  {
26  return _chr;
27  }
28 };
virtual void OnDraw(DC *dc)
Implements drawing code.
Definition: TextBoxChar.h:12
Definition: TextBoxChar.h:4
Base class for window with text content.
Definition: TextBox.h:30
Device context. Abstraction layer to the device specific drawing code. Coordinates in drawing functio...
Definition: DC.h:29
void DrawChar(const char c, int x, int y)
Draws a character. Input coordinates have to be defined in the window coordinate system.
Definition: DC.h:221
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.