KolibriLib
Loading...
Searching...
No Matches
KolibriLib::UI::buttons::Button Class Reference

Класс для работы с кнопками More...

#include <button.hpp>

Inheritance diagram for KolibriLib::UI::buttons::Button:
KolibriLib::UI::UIElement KolibriLib::UI::CheckBox

Public Types

enum  Type { Image = 0 , Text }
 

Public Member Functions

 Button (const Coord &coord={0, 0}, const Size &size={20, 20}, unsigned Margin=UI::DefaultMargin, Color::Color ButtonColor=OS::sys_color_table.work_button)
 Это конструктор
 
void init (const Coord &coord={0, 0}, const Size &size={0, 0}, const std::string &text="button", const unsigned &Margin=UI::DefaultMargin, const Color::Color &ButtonColor=OS::sys_color_table.work_button)
 инициализировать параметры
 
void init (const Coord &coord={0, 0}, const Size &size={0, 0}, const Images::image &image=Images::image(), const unsigned &Margin=DefaultMargin, const Color::Color &ButtonColor=OS::sys_color_table.work_button)
 инициализировать параметры
 
void init (const Coord &coord={0, 0}, const Size &size={0, 0}, std::string Path=DefaultImage)
 инициализировать параметры
 
void Render ()
 Отрисовать кнопку
 
bool Handler ()
 Обработчик кнопки
 
bool GetStatus ()
 Получить сосояние кнопки на момент последней обработки
 
ButtonID GetId ()
 Получить номер кнопки
 
void Deactivate ()
 Деактивировать кнопку
 
void Activate ()
 Активировать кнопку
 
unsigned GetType ()
 Возвращает тип данных используемых в кнопке _type.
 
std::string GetTextLabel ()
 Возвращает текст кнопки
 
Images::image GetImage ()
 Получить изображение кнопки
 
void SetText (std::string NewText)
 Изменить текст кнопки
 
 ~Button ()
 Декструктор
 
Buttonoperator= (const Button &butt)
 
- Public Member Functions inherited from KolibriLib::UI::UIElement
 UIElement (const Coord &coord={0, 0}, const Size &size={16, 16}, const Color::Color &MainColor=0, const unsigned &Margin=DefaultMargin)
 
Size GetSize ()
 
void SetSize (Size NewSize)
 
unsigned GetMargin ()
 
Color::Color GetColor ()
 Получить осносной цвет элемента
 
void SetColor (Color::Color NewColor)
 
void SetCoord (Coord NewCoord)
 
Coord GetCoord ()
 
UIElementoperator= (const UIElement &Element)
 

Additional Inherited Members

- Protected Attributes inherited from KolibriLib::UI::UIElement
Coord _coord
 Координаты
 
Size _size
 Размер
 
Color::Color _MainColor
 
unsigned _Margin
 Отступы
 

Detailed Description

Класс для работы с кнопками

Constructor & Destructor Documentation

◆ Button()

KolibriLib::UI::buttons::Button::Button ( const Coord & coord = {0, 0},
const Size & size = {20, 20},
unsigned Margin = UI::DefaultMargin,
Color::Color ButtonColor = OS::sys_color_table.work_button )

Это конструктор

Parameters
coordкоордината
sizeразмер
textтекст
Marginотступы текста от границ
ButtonColorцвет кнопки
TextColorцвет текста

Member Function Documentation

◆ Activate()

void KolibriLib::UI::buttons::Button::Activate ( )

Активировать кнопку

функции возвращает кнопку в рабочее состояние

◆ Deactivate()

void KolibriLib::UI::buttons::Button::Deactivate ( )

Деактивировать кнопку

функция может выполнятся очень долго, если вы уже создали довольно много кнопок. Это становится действительно важно когда у вас объявленно более 2000 кнопок

Деактивированном состоянии кнопка "Не нажимается", а её становится не действительным

◆ GetId()

ButtonID KolibriLib::UI::buttons::Button::GetId ( )

Получить номер кнопки

Returns
_id

◆ GetImage()

Images::image KolibriLib::UI::buttons::Button::GetImage ( )

Получить изображение кнопки

Returns

◆ GetStatus()

bool KolibriLib::UI::buttons::Button::GetStatus ( )

Получить сосояние кнопки на момент последней обработки

Returns
_status

◆ GetTextLabel()

std::string KolibriLib::UI::buttons::Button::GetTextLabel ( )

Возвращает текст кнопки

Returns
std::string

◆ GetType()

unsigned KolibriLib::UI::buttons::Button::GetType ( )

Возвращает тип данных используемых в кнопке _type.

Returns
Функция возвращает ::

◆ Handler()

bool KolibriLib::UI::buttons::Button::Handler ( )

Обработчик кнопки

Returns
Состояние кнопки(Нажата/Ненажата)

переменную в true если эта кнопка нажата, иначе false

функцию нужно вызывать в цикле, чтобы кнопка работала

◆ init() [1/3]

void KolibriLib::UI::buttons::Button::init ( const Coord & coord = {0, 0},
const Size & size = {0, 0},
const Images::image & image = Images::image(),
const unsigned & Margin = DefaultMargin,
const Color::Color & ButtonColor = OS::sys_color_table.work_button )

инициализировать параметры

Parameters
coordкоордината
sizeразмер
imageИзображение
Marginотступы текста от границ
BackgroundColorцвет кнопки
TextColorцвет текста

◆ init() [2/3]

void KolibriLib::UI::buttons::Button::init ( const Coord & coord = {0, 0},
const Size & size = {0, 0},
const std::string & text = "button",
const unsigned & Margin = UI::DefaultMargin,
const Color::Color & ButtonColor = OS::sys_color_table.work_button )

инициализировать параметры

Parameters
coordкоордината
sizeразмер
textтекст
Marginотступы текста от границ
BackgroundColorцвет кнопки
TextColorцвет текста

◆ init() [3/3]

void KolibriLib::UI::buttons::Button::init ( const Coord & coord = {0, 0},
const Size & size = {0, 0},
std::string Path = DefaultImage )

инициализировать параметры

Parameters
coordкоордината
sizeразмер
PathПуть до изображения
Marginотступы текста от границ
BackgroundColorцвет кнопки
TextColorцвет текста

◆ SetText()

void KolibriLib::UI::buttons::Button::SetText ( std::string NewText)

Изменить текст кнопки

Parameters
Новыйтекст кнопки

The documentation for this class was generated from the following file: