15#include "windowBase.hpp"
56 ksys_colors_table_t _colors;
68 std::vector<ButtonListElement> _Buttons;
71 std::vector<TextListElement> _Texts;
74 std::vector<FormListElement> _Forms;
77 unsigned ActiveForm = 0;
178 unsigned CreateText(
point coord = {0,0},
point size = {16, 16}, std::string text =
"Text",
unsigned FontSize = 9,
bool UseWindowColors =
true, ksys_color_t color =
OS::sys_color_table.work_text);
219 for(
unsigned i = 0; i < _Buttons.size(); i++)
223 _Buttons[i].btn = btn;
224 _Buttons[i].btn.Activate();
225 _Buttons[i].use =
true;
232 _Buttons.push_back(a);
233 return _Buttons.size();
236 unsigned Window::AddNewTextLabel(UI::text::TextLabel text)
238 for (
unsigned i = 0; i < _Texts.size(); i++)
242 _Texts[i].txt = text;
243 _Texts[i].use =
true;
253 inline unsigned Window::AddNewForm(UI::Form form)
255 for (
unsigned i = 0; i < _Forms.size(); i++)
259 _Forms[i].frm = form;
260 _Forms[i].use =
true;
268 return _Forms.size();
278 _colors = OS::GetSystemColors();
295 _colors = colorTable;
315 _ksys_create_window(coord.x, coord.y, _size.x, _size.y, _title.c_str(), _colors.work_area, _style);
321 _ksys_change_window(coord.x, coord.y, size.x, size.y);
326 _ksys_set_window_title(newTitle.c_str());
338 for(
unsigned i = 0; i < _Buttons.size(); i++)
342 _Buttons[i].btn.render();
345 for(
unsigned i = 0; i < _Texts.size(); i++)
349 _Texts[i].txt.render();
352 for(
unsigned i = 0; i < _Forms.size(); i++)
356 _Forms[i].frm.render();
377 color = _colors.work_button;
378 TextColor = _colors.work_button_text;
381 unsigned a = AddNewButton(btn);
388 return AddNewButton(btn);
393 _Buttons[id].btn.Deactivate();
394 _Buttons[id].use =
false;
400 color = _colors.work_text;
405 return AddNewTextLabel(t);
410 return AddNewTextLabel(text);
415 _Texts[id].use =
false;
420 UI::Form form (coord, size, BackgroundText, FormColor, BackgroundTextColor, _MARGIN);
421 return AddNewForm (form);
426 return AddNewForm(form);
431 return _Forms[form].frm.GetInput();
436 _Forms[id].use =
false;
441 for (
unsigned i = 0; i < _Buttons.size(); i++)
445 _Buttons[i].btn.Handler();
449 for (
unsigned i = 0; i < _Forms.size(); i++)
453 if (_Forms[i].frm.ButtonHandler())
459 _Forms[ActiveForm].frm.Handler();
464 for(
unsigned i = 0; i < _Buttons.size(); i++)
471 return _Buttons.size();
Текстовая метка
Definition UI.hpp:106
Класс для работы с окном
Definition window.hpp:47
Window(std::string Title="Window", point size=DefaultWindowSize, int style=0x14, ksys_colors_table_t colors=Color::DefaultColorTable, unsigned Margin=0)
Конструктор
Definition window.hpp:271
void EndRedraw()
Закончить перересовку окна
Definition window.hpp:304
void DeleteText(unsigned id)
Удалить текст
Definition window.hpp:413
void DeleteForm(unsigned id)
Удалить форму
Definition window.hpp:434
void Handler()
Обработчик элементов
Definition window.hpp:439
unsigned CreateForm(point coord={0, 0}, KolibriLib::point size={32, 16}, std::string BackgroundText=" ", ksys_color_t FormColor=OS::sys_color_table.work_text, ksys_color_t BackgroundTextColor=OS::sys_color_table.work_button_text)
Создать форму
Definition window.hpp:418
void ChangeWindow(point coord, point size)
Изменить окно
Definition window.hpp:318
unsigned CreateText(point coord={0, 0}, point size={16, 16}, std::string text="Text", unsigned FontSize=9, bool UseWindowColors=true, ksys_color_t color=OS::sys_color_table.work_text)
Создать текст в окне
Definition window.hpp:396
void StartRedraw()
Начать перересовку окна
Definition window.hpp:298
void SetWindowColors(ksys_colors_table_t colorTable)
Задать стандартные цвета окна
Definition window.hpp:293
std::string GetTextFromForm(unsigned form)
Получить текст из формы
Definition window.hpp:429
void ChangeTilte(std::string newTitle)
Изменить заголовок окна
Definition window.hpp:324
point GetSize()
Получить размер окна
Definition window.hpp:368
unsigned CreateButton(point coord={0, 0}, point size={16, 16}, std::string Text=" ", unsigned margin=UI::DefaultMargin, bool UseWindowColors=true, ksys_color_t color=OS::sys_color_table.work_button, ksys_color_t TextColor=OS::sys_color_table.work_button_text)
Создать кнопку
Definition window.hpp:373
unsigned GetMargin()
Получить рамер отступов в этом окне
Definition window.hpp:363
void DeleteButton(unsigned id)
Удалить кнопку
Definition window.hpp:391
void Render()
Отрисовать окно
Definition window.hpp:333
point GetWindowSize()
Получить размер окна
Definition window.hpp:329
unsigned GetPressedButton()
Получить нажатую кнопку
Definition window.hpp:462
void DrawWindow(point coord=mouse::GetMousePositionOnSreen())
Отрисовать окно
Definition window.hpp:313
const ksys_colors_table_t DefaultColorTable
Таблица цветов по умолчанию
Definition windowBase.hpp:14
bool ComparisonColorsTables(ksys_colors_table_t a, ksys_colors_table_t b)
Сравнить две таблица цветов
Definition windowBase.hpp:20
ksys_colors_table_t sys_color_table
Таблица стандартных(системных) цветов
Definition base.hpp:37
const unsigned DefaultMargin
Отступы поумолчанию
Definition UI.hpp:20
point GetMousePositionOnSreen()
Получить позицияю курсора на экране
Definition mouse.hpp:15
const point DefaultWindowCoord
Соординаты окна по умолчанию
Definition windowBase.hpp:39
const point DefaultWindowSize
Размер окна поумолчанию
Definition windowBase.hpp:36
Основное пространство имён
Definition base.hpp:17
Просто точка
Definition base.hpp:22