22 #include "MainWindow.h" 28 LinkedList<Button> _listButtons;
29 LinkedList<Window> _listWindow;
30 static const int _szy = 30;
39 TabControl(
const __FlashStringHelper * name,
int left,
int top,
int width,
int height):
Window(name, left, top, width, height)
48 int wnd_width=
Width();
57 window->
Move(1, _szy+1, wnd_width-2,wnd_height - _szy-2);
58 _listButtons.Add(button);
59 _listWindow.Add(window);
60 if(_listWindow.Count()>1)
63 _listButtons[0]->SetDecorators(
Environment::Get()->FindDecorators(F(
"ActiveTabButton")));
69 int szx =
Width() / _listButtons.Count();
71 for (
int i = 0;i < _listButtons.Count();i++)
73 int offset_y = i == sel_index ? 0 : 3;
74 _listButtons[i]->Move(0 + szx*i, offset_y, szx - 1, _szy- offset_y);
82 for(
int i=0;i<_listButtons.Count();i++)
84 if(window == _listButtons[i])
94 for(
int i=0;i<_listButtons.Count();i++)
96 _listWindow[i]->SetVisible(i==sel_index);
99 _listWindow[i]->Invalidate();
100 _listButtons[i]->SetDecorators(
Environment::Get()->FindDecorators(F(
"ActiveTabButton")));
106 _listButtons[i]->SetDecorators(buttonDeco);
void RegisterTouchEventReceiver(ITouchEventReceiver *touchEventReceiver)
Registers receiver for touch event.
Definition: Window.h:102
DecoratorList * GetDecorators()
Returns window decorators list.
Definition: Window.h:81
Base class for all window objects. Provides basic window functionality.
Definition: Window.h:34
static Environment * Get()
Returns singltone instance of environment.
Definition: Environment.h:44
void NotifyTouch(Window *window)
Events routing for gui interaction (see RegisterTouchEventReceiver and public ITouchEventReceiver dec...
Definition: TabControl.h:79
TabControl(const __FlashStringHelper *name, int left, int top, int width, int height)
Constructor.
Definition: TabControl.h:39
virtual void Move(int left, int top, int width, int height)
Moves and resizes window relativly to the parent window.
Definition: Window.h:149
void UpdateTabs(int sel_index)
If new tab is selected, the size of buttons and their appearance are adjusted.
Definition: TabControl.h:67
LinkedList< Window > & Children()
Returns list of children window.
Definition: Window.h:223
int Height()
Returns window height.
Definition: Window.h:189
Window(const __FlashStringHelper *name, int left, int top, int width, int height)
Constructor.
Definition: Window.h:60
TabControl. Control element wich allows intersactive switch between chidl windows.
Definition: TabControl.h:26
void AddChild(Window *window)
Adds window child window.
Definition: Window.h:194
void SetVisible(bool isVisible)
Sets window visibility status.
Definition: Window.h:205
virtual void SetDecorators(DecoratorList *decorators)
Sets window decorators list.
Definition: Window.h:76
DecoratorList * FindDecorators(const __FlashStringHelper *id)
Finds registered decorators by the name.
Definition: Environment.h:59
Interface that provides screen touch notifications. If you want receive this notification in the targ...
Definition: ITouchEventReceiver.h:24
int Width()
Returns window width.
Definition: Window.h:184
void AddTab(const __FlashStringHelper *buttonName, Window *window)
Adds pair: button + corresponding window. The size of added window is adjusted automatically.
Definition: TabControl.h:46
void SetMargins(int offset_x, int offset_y)
Defines offset from left and top for text.
Definition: TextBox.h:58