Skip to content

Commit

Permalink
fix: some documentation errors & add Send* functions
Browse files Browse the repository at this point in the history
  • Loading branch information
Egor00f committed Oct 1, 2024
1 parent 3d5f1cf commit 3147b5d
Show file tree
Hide file tree
Showing 27 changed files with 205 additions and 105 deletions.
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@ if(KolibriLib_BUILD_DOCS)

include(Doxygen)

ADD_DOCUMENTATION(doc ${CMAKE_CURRENT_SOURCE_DIR}/Docs/Doxyfile)
ADD_DOCUMENTATION(doc)

endif()

Expand Down
6 changes: 3 additions & 3 deletions cmake/CMakeDetermineKOS32Compiler.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ include_directories(
)


set(CMAKE_C_LINK_EXECUTABLE "<CMAKE_LINKER> -o <TARGET> -L${TOOLCHAIN_DIR}/lib -L${SDK_DIR}/lib --subsystem native <OBJECTS> --start-group -lgcc -lc.dll <LINK_LIBRARIES> --end-group <CMAKE_C_LINK_FLAGS> <LINK_FLAGS>")
set(CMAKE_CXX_LINK_EXECUTABLE "<CMAKE_LINKER> -o <TARGET> -L${TOOLCHAIN_DIR}/lib -L${TOOLCHAIN_DIR}/mingw32/lib -L${SDK_DIR}/lib --subsystem native <OBJECTS> --start-group -lgcc -lc.dll -lstdc++ -lsupc++ <LINK_LIBRARIES> --end-group <CMAKE_CXX_LINK_FLAGS> <LINK_FLAGS>")
set(CMAKE_C_LINK_EXECUTABLE "<CMAKE_LINKER> <LINK_FLAGS> -o <TARGET> <OBJECTS> --start-group -lgcc -lc.dll <LINK_LIBRARIES> --end-group <CMAKE_C_LINK_FLAGS>")
set(CMAKE_CXX_LINK_EXECUTABLE "<CMAKE_LINKER> <LINK_FLAGS> -o <TARGET> <OBJECTS> --start-group -lgcc -lc.dll -lstdc++ -lsupc++ <LINK_LIBRARIES> --end-group <CMAKE_CXX_LINK_FLAGS>")

set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -static -S --image-base 0 -nostdlib -T${NEWLIB_DIR}/app.lds")
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -static -S --image-base 0 -nostdlib -T${NEWLIB_DIR}/app.lds -L${TOOLCHAIN_DIR}/lib -L${TOOLCHAIN_DIR}/mingw32/lib -L${SDK_DIR}/lib --subsystem native")
5 changes: 3 additions & 2 deletions cmake/Doxygen.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,9 @@ MACRO(ADD_DOCUMENTATION)
IF(DOXYGEN_FOUND)
set(DOXYGEN_GENERATE_HTML YES)
set(DOXYGEN_PROJECT_NUMBER ${PROJECT_NUMBER})
set(DOXYGEN_OUTPUT_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/Docs)
doxygen_add_docs(doc ${CMAKE_SOURCE_DIR})
set(DOXYGEN_OUTPUT_DIRECTORY ${PROJECT_SOURCE_DIR}/Docs)
set(DOXYGEN_IMAGE_PATH ${DOXYGEN_OUTPUT_DIRECTORY}/media)
doxygen_add_docs(doc ${CMAKE_SOURCE_DIR} )

ELSE(DOXYGEN_FOUND)
MESSAGE(STATUS "Doxygen not found. Documentation will not be generated")
Expand Down
15 changes: 13 additions & 2 deletions examples/Readme.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,14 @@
# Это папка с примерами использования библиотеки
# примеры использования библиотеки

Makefile нужно подредактировать, чтобы у вас всё нормально скомпилировалось. Посмотри его, там инструкции все есть.
Просто посмотрите исходники, скомпилируйте и запустите примеры и всё станет понятнее

## Hello world

Просто окно с написью и кнопкой.


по нажатию на у надписи меняется цвет текста.

## Mouse Position

показывает координаты мыши
3 changes: 2 additions & 1 deletion include/kolibriLib/UI/BaseEditor.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@ namespace KolibriLib
{
namespace UI
{
/// \brief Форма для ввода текста
/// @brief Форма для ввода текста
/// @warning не завершено
class BaseEditor : public buttons::TextButton
{
public:
Expand Down
9 changes: 5 additions & 4 deletions include/kolibriLib/UI/Readme.md
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
# User Interface
# namespace UI

Тут находятся элементы интерфейса

Вот их список:
+ `UIElement` - Класс от которого наследуются все остальные
+ `Button` - кнопка
+ `TextLabel` - Текстовая метка
+ `Frame` - Фрейм, может хранить в себе другие элементы
+ `Button` - кнопка
+ `CheckBox` - Чекбокс
+ `TextButton` - кнопка с текстом, тоже что и TextLabel но кнопка
+ `ImageButton` - кнопка с картинкой, тоже что и Image но кнопка
+ `Image` - Просто изображение
+ `Form` - форма для ввода текста
+ `Menu` - Выпадающий список меню
+ 'CheckBox' - наследуется от кнопки
3 changes: 2 additions & 1 deletion include/kolibriLib/UI/UI.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@

namespace KolibriLib
{
// Элементы UI
/// @brief UI
/// @details Пространство имён в котором только UI
namespace UI
{

Expand Down
1 change: 0 additions & 1 deletion include/kolibriLib/UI/buttons/TextButton.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ namespace KolibriLib
namespace buttons
{
/// \brief Класс для работы с кнопками
/// @example example.cpp
class TextButton: public text::TextLabel, public BaseButton
{
public:
Expand Down
7 changes: 7 additions & 0 deletions include/kolibriLib/UI/buttons/baseButton.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,13 @@ namespace KolibriLib

BaseButton();

/// @brief Конструтор
/// @param id ID кнопки
BaseButton(ButtonID id);

BaseButton(const BaseButton &) = default;

/// @brief Деструктор
~BaseButton();

/// @brief Получить сосояние кнопки на момент последней обработки
Expand Down Expand Up @@ -53,6 +56,10 @@ namespace KolibriLib
/// @return true если у кнопки есть ID
bool IsActive() const;

/// @brief Объявить кнопку
/// @param coord Координаты кнопки
/// @param size размер кнопки
/// @param color цвет кнокпи
void Define(const Coord &coord, const Size &size, const Colors::Color &color = Globals::SystemColors.work_button) const;

protected:
Expand Down
20 changes: 13 additions & 7 deletions include/kolibriLib/UI/buttons/buttonsBase.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,18 +20,21 @@ namespace KolibriLib
/// @brief ID кнопки
struct ButtonID
{
uint32_t value;
/// @brief Значение
std::uint32_t value;

ButtonID(unsigned val);

/// @brief является ли этот ID пригодным
/// @details ID кнопок могут быть только от 0 до 0x8000 (исключая сами числа)
bool CheckIsValid() const;

ButtonID &operator = (const ButtonID&) = default;

ButtonID operator=(const unsigned &val);

/// @brief
operator uint32_t() const;
operator std::uint32_t() const;
};

const ButtonID ButtonIDNotSet = 0;
Expand All @@ -48,7 +51,7 @@ namespace KolibriLib
/// \brief Получить свободный номер id кнопки из списка
/// \paragraph Эта функция может выполнятся очень долго, если вы уже создали довольно много кнопок. Это становится действительно важно когда у вас объявленно более 2000 кнопок
/// \return номер кнопки из списка ButtonsIdList
ButtonID GetFreeButtonId(std::vector<ButtonID> *ButtonsIdList, uint32_t startID = 2);
ButtonID GetFreeButtonId(std::vector<ButtonID> *ButtonsIdList, std::uint32_t startID = 2);

/// \brief Освободить номер кнопки
/// \param id номер номер кнопки из списка ButtonsIdList
Expand Down Expand Up @@ -110,16 +113,19 @@ namespace KolibriLib
return ButtonID(_ksys_get_button());
}

typedef enum ButtonStyle
/// @brief Стиль кнопок
enum class ButtonStyle
{
/// @brief Плоские кнопки
flat = 0,

/// @brief Объёмные кнокпи
volumetric = 1
} buttonStyle;
};

inline void SetButtonStyle(buttonStyle style)
/// @brief Измнить стиль кнопок
/// @param новый стиль кнопок
inline void SetButtonStyle(ButtonStyle style)
{
asm_inline(
"int $0x40" ::"a"(48), "b"(1), "c"(style));
Expand All @@ -146,7 +152,7 @@ namespace KolibriLib
/// @brief Список использованных id кнопок
std::vector<ButtonID> ButtonsIdList{/*CloseButton,*/ MinimizeButton};

uint32_t _top = 2;
unsigned _top = 2;
};

} // namespace buttons
Expand Down
1 change: 1 addition & 0 deletions include/kolibriLib/UI/form.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ namespace KolibriLib
{
namespace UI
{
/// @brief Форма для ввода текста
class Form : public BaseEditor
{
public:
Expand Down
4 changes: 1 addition & 3 deletions include/kolibriLib/UI/text/textlabel.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,7 @@ namespace KolibriLib
namespace text
{
/// @brief Текстовая метка
/// @note Простая текстовая метка, ничего особенного.
/// @note Возможно важные сведения: текст всегда отрисовывается в середине
/// @example example.cpp
/// @details Простая текстовая метка, ничего особенного.
class TextLabel: public Txt, public UI::UIElement
{
public:
Expand Down
45 changes: 37 additions & 8 deletions include/kolibriLib/color.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,37 +9,65 @@ namespace KolibriLib
/// @brief Набор функций для работы с цветом
namespace Colors
{

/// @brief rgb цвет
/// @details крутая оболочка для rgb_t из sys/ksys.h
struct rgb: public rgb_t
{
rgb(rgb_t val);

rgb(ksys_color_t val);

/// @brief Конструктор
/// @param r красная состовляющаяя
/// @param g зелёная
rgb(std::uint8_t r, std::uint8_t g, std::uint8_t b);

/// @brief конструктор по умолчанию
rgb() = default;
rgb(const rgb&) = default;

rgb& operator=(const rgb&) = default;
rgb& operator = (const rgb&) = default;

bool operator == (const rgb& color) const;
bool operator != (const rgb& color) const;

operator ksys_color_t() const;

/// @brief Получить цвет в формате BBGGRR
/// @return цвет в формате BBGGRR
std::uint32_t BBGGRR() const;

/// @brief Получить цвет в формате BBGGRR
/// @return цвет в формате BBGGRR
std::uint32_t RRGGBB() const;

/// @brief Получить цвет в формате BBGGRR00
/// @return BBGGRR00
std::uint32_t BBGGRR00() const;

/// @brief Получить цвет в формате RRGGBB00
/// @return цвет в формате RRGGBB00
std::uint32_t RRGGBB00() const;

/// @brief Получить цвет в формате 00RRGGBB
/// @return цвет в формате RRGGBB00
std::uint32_t ZeroRRGGBB() const;
};

/// @brief Цвет
union Color
{
Color():val(0xFFFFFFFF){};
/// @brief Конструктор по умолчанию
Color() = default;

///Color(const Color *a);
Color(const Color &a) = default;

/// @brief Конструктор
/// @param a
Color(const ksys_color_t& a);
//Color(const Color *a);
Color(const Color &a) = default;
/// @brief Конструктор
Color(const rgb_t &color);

/// @brief Конструктор
Expand Down Expand Up @@ -70,6 +98,7 @@ namespace KolibriLib

bool operator != (const Color& a) const;

// Поля

ksys_color_t val;

Expand Down Expand Up @@ -114,10 +143,10 @@ namespace KolibriLib
/// @param grabBar
/// @param grabBarButton
/// @param grabText
/// @param workArea
/// @param workArea цвет рабочей области окна
/// @param workButton
/// @param workButtonText
/// @param workText
/// @param workText цвет текста
/// @param workGraph
ColorsTable (
Color frameArea,
Expand All @@ -131,7 +160,7 @@ namespace KolibriLib
Color workGraph
);

ColorsTable& operator=(const ColorsTable&) = default;
ColorsTable& operator = (const ColorsTable&) = default;
};

/// @brief Таблица цветов по умолчанию
Expand Down
1 change: 0 additions & 1 deletion include/kolibriLib/graphic/Readme.md

This file was deleted.

18 changes: 10 additions & 8 deletions include/kolibriLib/graphic/background.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -63,8 +63,8 @@ namespace KolibriLib
_ksys_bg_redraw_bar(coord.operator ksys_pos_t(), (coord + size).operator ksys_pos_t());
}

/// @brief
/// @param
/// @brief установить размер фонового изображения.
/// @param size размеры фоного изображения
inline void SetSize(const Size &size)
{
_ksys_bg_set_size (
Expand All @@ -76,13 +76,13 @@ namespace KolibriLib
/// @brief Постовить точку на фоне
/// @param coord координаты точки
/// @param color цвет точки
inline void DrawPoint(const Coord coord, const Colors::Color &color = Globals::SystemColors.work_graph)
inline void DrawPoint(const Coord &coord, const Colors::rgb &color = Globals::SystemColors.work_graph)
{
_ksys_bg_put_pixel (
static_cast<std::uint32_t>(coord.x),
static_cast<std::uint32_t>(coord.y),
static_cast<std::uint32_t>(GetSize().x),
color.operator ksys_color_t()
color.RRGGBB()
);
}

Expand All @@ -92,12 +92,13 @@ namespace KolibriLib
/// @param rgb
inline void DrawImage(const Coord coord, rgb_t (&rgb)[N])
{
_ksys_bg_put_bitmap(
_ksys_bg_put_bitmap (
rgb,
sizeof(rgb_t) * N,
static_cast<std::uint32_t>(coord.x),
static_cast<std::uint32_t>(coord.y),
static_cast<std::uint32_t>(GetSize().x));
static_cast<std::uint32_t>(GetSize().x)
);
}

/// @brief Вывести изображение(rgb)
Expand All @@ -106,12 +107,13 @@ namespace KolibriLib
/// @param N длинна массива rgb
inline void DrawImage(const Coord &coord, rgb_t *rgb, std::size_t N)
{
_ksys_bg_put_bitmap(
_ksys_bg_put_bitmap (
rgb,
sizeof(rgb_t) * N,
static_cast<std::uint32_t>(coord.x),
static_cast<std::uint32_t>(coord.y),
static_cast<std::uint32_t>(GetSize().x));
static_cast<std::uint32_t>(GetSize().x)
);
}

/// @brief Нарисовать линию на фоне
Expand Down
Loading

0 comments on commit 3147b5d

Please sign in to comment.