extend cell value wrapper functions

Sun, 13 Sep 2026 10:53:14 +0200

author
Olaf Wintermann <olaf.wintermann@gmail.com>
date
Sun, 13 Sep 2026 10:53:14 +0200
changeset 1252
40f17cf43302
parent 1251
a1623c48c998
child 1253
50cc04d5e86c

extend cell value wrapper functions

ui/common/wrapper.c file | annotate | diff | comparison | revisions
ui/common/wrapper.h file | annotate | diff | comparison | revisions
ui/ui/list.h file | annotate | diff | comparison | revisions
--- a/ui/common/wrapper.c	Sun Sep 13 10:39:34 2026 +0200
+++ b/ui/common/wrapper.c	Sun Sep 13 10:53:14 2026 +0200
@@ -391,7 +391,11 @@
 }
 
 UiBool ui_cell_value_is_int(UiCellValue *value) {
-    return FALSE; // TODO
+    return value->type == UI_INTEGER_EDITABLE;
+}
+
+UiBool ui_cell_value_is_bool(UiCellValue *value) {
+    return value->type == UI_BOOL_EDITABLE;
 }
 
 const char* ui_cell_value_get_string(UiCellValue *value) {
@@ -401,3 +405,7 @@
 int64_t ui_cell_value_get_int(UiCellValue *value) {
     return value->i;
 }
+
+UiBool ui_cell_value_get_bool(UiCellValue *value) {
+    return value->b;
+}
--- a/ui/common/wrapper.h	Sun Sep 13 10:39:34 2026 +0200
+++ b/ui/common/wrapper.h	Sun Sep 13 10:53:14 2026 +0200
@@ -106,10 +106,6 @@
 UIEXPORT void ui_textstyle_set_color(UiTextStyle *style, int r, int g, int b);
 UIEXPORT void ui_textstyle_enable_color(UiTextStyle *style, UiBool enable);
 
-UIEXPORT UiBool ui_cell_value_is_string(UiCellValue *value);
-UIEXPORT UiBool ui_cell_value_is_int(UiCellValue *value);
-UIEXPORT const char* ui_cell_value_get_string(UiCellValue *value);
-UIEXPORT int64_t ui_cell_value_get_int(UiCellValue *value);
 
 
 #ifdef __cplusplus
--- a/ui/ui/list.h	Sun Sep 13 10:39:34 2026 +0200
+++ b/ui/ui/list.h	Sun Sep 13 10:53:14 2026 +0200
@@ -55,6 +55,7 @@
     UI_ICON_TEXT,
     UI_ICON_TEXT_FREE,
     UI_STRING_EDITABLE,
+    UI_INTEGER_EDITABLE,
     UI_BOOL_EDITABLE
 } UiModelType;
 
@@ -434,6 +435,14 @@
 UIEXPORT void ui_sublist_item_set_eventdata(UiSubListItem *item, void *eventdata);
 
 
+/* common */
+
+UIEXPORT UiBool ui_cell_value_is_string(UiCellValue *value);
+UIEXPORT UiBool ui_cell_value_is_int(UiCellValue *value);
+UIEXPORT UiBool ui_cell_value_is_bool(UiCellValue *value);
+UIEXPORT const char* ui_cell_value_get_string(UiCellValue *value);
+UIEXPORT int64_t ui_cell_value_get_int(UiCellValue *value);
+UIEXPORT UiBool ui_cell_value_get_bool(UiCellValue *value);
 
 /*
  * Only relevant for some language bindings

mercurial