ui/common/wrapper.c

changeset 110
c00e968d018b
parent 109
c3dfcb8f0be7
child 112
c3f2f16fa4b8
--- a/ui/common/wrapper.c	Sun Aug 24 15:24:16 2025 +0200
+++ b/ui/common/wrapper.c	Sat Oct 04 14:52:59 2025 +0200
@@ -236,6 +236,15 @@
     return sel->rows;
 }
 
+UIEXPORT void ui_list_set_selected_indices(UiList *list, int *indices, int num) {
+    UiListSelection sel;
+    sel.rows = indices;
+    sel.count = num;
+    if(list->setselection) {
+        list->setselection(list, sel);
+    }
+}
+
 void ui_list_selection_free(UiListSelection *sel) {
     ui_listselection_free(*sel);
     free(sel);
@@ -253,3 +262,59 @@
     }
     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;
+}
+
+
+/* ---------------------------- UiCellValue ---------------------------- */
+
+UiBool ui_cell_value_is_string(UiCellValue *value) {
+   return value->type == UI_STRING_EDITABLE;
+}
+
+UiBool ui_cell_value_is_int(UiCellValue *value) {
+    return FALSE; // TODO
+}
+
+const char* ui_cell_value_get_string(UiCellValue *value) {
+    return value->string;
+}
+
+int64_t ui_cell_value_get_int(UiCellValue *value) {
+    return value->i;
+}

mercurial