AWind
wnd_info.h
1 #pragma once
2 
3 #include "TextBoxString.h"
4 #include "TextBoxStrTouch.h"
5 
6 class wnd_info : public MainWindow
7 {
8  TextBoxStrTouch *edtBox;
9 public:
10  wnd_info(int width,int height):MainWindow(width,height)
11  {
12  int x=0, y=10, xOff=95, yOff=20, xW=width-xOff, tHgt=13;
13  AddDecorator(new DecoratorRectFill(Color::Black));
14  AddDecorator(new DecoratorColor(Color::SkyBlue));
15 
16  TextBoxFString *label=new TextBoxFString(x,y,104,tHgt,F("Enter text:"));
17  AddChild(label);
18  edtBox=new TextBoxStrTouch(xOff,y,xW,tHgt,"Some text to edit");
19  initEditBox(edtBox);
20 
21  y += yOff;
22  label=new TextBoxFString(x,y,104,tHgt,F("Short Text:"));
23  AddChild(label);
24  edtBox=new TextBoxStrTouch(xOff,y,xW,tHgt,"Short text");
25  initEditBox(edtBox);
26 
27  y += yOff;
28  label=new TextBoxFString(x,y,104,tHgt,F("Long Text:"));
29  AddChild(label);
30  edtBox=new TextBoxStrTouch(xOff,y,xW,tHgt,"Some long text that is greater than the edit box size will be around");
31  initEditBox(edtBox);
32 
33  y += yOff;
34  label=new TextBoxFString(x,y,104,tHgt,F("Long Text:"));
35  AddChild(label);
36  edtBox=new TextBoxStrTouch(xOff,y,xW,tHgt,"This will exceed the length of the edit area");
37  initEditBox(edtBox);
38  }
39 protected:
40  void initEditBox(TextBoxStrTouch *edt)
41  {
43  edt->SetMargins(4,0);
44  AddChild(edt);
45  }
46 
47 public:
48  void Create()
49  {
50  }
51  void Notify(Window * wnd)
52  {
53  }
54 };
DecoratorList * GetDecorators()
Returns window decorators list.
Definition: Window.h:81
Base class for all window objects. Provides basic window functionality.
Definition: Window.h:34
Definition: TextBoxStrTouch.h:4
Definition: wnd_info.h:6
Decorator primitive that sets current color. Overriden members description see Decorator class docume...
Definition: DecoratorPrimitives.h:24
Decorator primitive for round rect filled area. Overriden members description see Decorator class doc...
Definition: DecoratorPrimitives.h:79
void AddChild(Window *window)
Adds window child window.
Definition: Window.h:194
void AddDecorator(Decorator *decorator)
Adds decorator to the decaorator list.
Definition: Window.h:86
MainWindow(int width, int height)
Constructor.
Definition: MainWindow.h:52
virtual void SetDecorators(DecoratorList *decorators)
Sets window decorators list.
Definition: Window.h:76
Base class for main application window. Each application has to have one main window, which is root parent for all other application windows.
Definition: MainWindow.h:38
void SetMargins(int offset_x, int offset_y)
Defines offset from left and top for text.
Definition: TextBox.h:58