Sun, 31 Aug 2025 10:31:42 +0200
add textstyle wrapper functions
| ui/common/wrapper.c | file | annotate | diff | comparison | revisions | |
| ui/common/wrapper.h | file | annotate | diff | comparison | revisions |
--- a/ui/common/wrapper.c Sun Aug 31 09:44:53 2025 +0200 +++ b/ui/common/wrapper.c Sun Aug 31 10:31:42 2025 +0200 @@ -262,3 +262,40 @@ } return NULL; } + +/* ---------------------------- UiTextStyle ---------------------------- */ + +void ui_textstyle_set_bold(UiTextStyle *style, UiBool set) { + if(set) { + style->text_style |= UI_TEXT_STYLE_BOLD; + } else { + style->text_style &= ~UI_TEXT_STYLE_BOLD; + } +} + +void ui_textstyle_set_underline(UiTextStyle *style, UiBool set) { + if(set) { + style->text_style |= UI_TEXT_STYLE_UNDERLINE; + } else { + style->text_style &= ~UI_TEXT_STYLE_UNDERLINE; + } +} + +void ui_textstyle_set_italic(UiTextStyle *style, UiBool set) { + if(set) { + style->text_style |= UI_TEXT_STYLE_ITALIC; + } else { + style->text_style &= ~UI_TEXT_STYLE_ITALIC; + } +} + +void ui_textstyle_set_color(UiTextStyle *style, int r, int g, int b) { + style->fg_set = TRUE; + style->fg.red = r; + style->fg.green = g; + style->fg.blue = b; +} + +void ui_textstyle_enable_color(UiTextStyle *style, UiBool enable) { + style->fg_set = enable; +}
--- a/ui/common/wrapper.h Sun Aug 31 09:44:53 2025 +0200 +++ b/ui/common/wrapper.h Sun Aug 31 10:31:42 2025 +0200 @@ -83,6 +83,12 @@ UIEXPORT int ui_filelist_count(UiFileList *flist); UIEXPORT char* ui_filelist_get(UiFileList *flist, int index); +UIEXPORT void ui_textstyle_set_bold(UiTextStyle *style, UiBool set); +UIEXPORT void ui_textstyle_set_underline(UiTextStyle *style, UiBool set); +UIEXPORT void ui_textstyle_set_italic(UiTextStyle *style, UiBool set); +UIEXPORT void ui_textstyle_set_color(UiTextStyle *style, int r, int g, int b); +UIEXPORT void ui_textstyle_enable_color(UiTextStyle *style, UiBool enable); + #ifdef __cplusplus }