ui/common/wrapper.c

changeset 110
c00e968d018b
parent 109
c3dfcb8f0be7
child 112
c3f2f16fa4b8
equal deleted inserted replaced
109:c3dfcb8f0be7 110:c00e968d018b
234 234
235 int* ui_list_selection_get_rows(UiListSelection *sel) { 235 int* ui_list_selection_get_rows(UiListSelection *sel) {
236 return sel->rows; 236 return sel->rows;
237 } 237 }
238 238
239 UIEXPORT void ui_list_set_selected_indices(UiList *list, int *indices, int num) {
240 UiListSelection sel;
241 sel.rows = indices;
242 sel.count = num;
243 if(list->setselection) {
244 list->setselection(list, sel);
245 }
246 }
247
239 void ui_list_selection_free(UiListSelection *sel) { 248 void ui_list_selection_free(UiListSelection *sel) {
240 ui_listselection_free(*sel); 249 ui_listselection_free(*sel);
241 free(sel); 250 free(sel);
242 } 251 }
243 252
251 if(index >= 0 && index < flist->nfiles) { 260 if(index >= 0 && index < flist->nfiles) {
252 return flist->files[index]; 261 return flist->files[index];
253 } 262 }
254 return NULL; 263 return NULL;
255 } 264 }
265
266 /* ---------------------------- UiTextStyle ---------------------------- */
267
268 void ui_textstyle_set_bold(UiTextStyle *style, UiBool set) {
269 if(set) {
270 style->text_style |= UI_TEXT_STYLE_BOLD;
271 } else {
272 style->text_style &= ~UI_TEXT_STYLE_BOLD;
273 }
274 }
275
276 void ui_textstyle_set_underline(UiTextStyle *style, UiBool set) {
277 if(set) {
278 style->text_style |= UI_TEXT_STYLE_UNDERLINE;
279 } else {
280 style->text_style &= ~UI_TEXT_STYLE_UNDERLINE;
281 }
282 }
283
284 void ui_textstyle_set_italic(UiTextStyle *style, UiBool set) {
285 if(set) {
286 style->text_style |= UI_TEXT_STYLE_ITALIC;
287 } else {
288 style->text_style &= ~UI_TEXT_STYLE_ITALIC;
289 }
290 }
291
292 void ui_textstyle_set_color(UiTextStyle *style, int r, int g, int b) {
293 style->fg_set = TRUE;
294 style->fg.red = r;
295 style->fg.green = g;
296 style->fg.blue = b;
297 }
298
299 void ui_textstyle_enable_color(UiTextStyle *style, UiBool enable) {
300 style->fg_set = enable;
301 }
302
303
304 /* ---------------------------- UiCellValue ---------------------------- */
305
306 UiBool ui_cell_value_is_string(UiCellValue *value) {
307 return value->type == UI_STRING_EDITABLE;
308 }
309
310 UiBool ui_cell_value_is_int(UiCellValue *value) {
311 return FALSE; // TODO
312 }
313
314 const char* ui_cell_value_get_string(UiCellValue *value) {
315 return value->string;
316 }
317
318 int64_t ui_cell_value_get_int(UiCellValue *value) {
319 return value->i;
320 }

mercurial