408 |
408 |
409 // set the cell value |
409 // set the cell value |
410 // depending on the type, we create different cell controls |
410 // depending on the type, we create different cell controls |
411 UiModelType type = model->types[col]; |
411 UiModelType type = model->types[col]; |
412 switch (type) { |
412 switch (type) { |
|
413 case UI_STRING_FREE: |
413 case UI_STRING: { |
414 case UI_STRING: { |
414 TextBlock cell = TextBlock(); |
415 TextBlock cell = TextBlock(); |
415 cell.Padding(cellpadding); |
416 cell.Padding(cellpadding); |
416 cell.VerticalAlignment(VerticalAlignment::Stretch); |
417 cell.VerticalAlignment(VerticalAlignment::Stretch); |
417 textblock_set_str(cell, (char*)getvalue(elm, model_col)); |
418 char *val = (char*)getvalue(elm, model_col); |
|
419 textblock_set_str(cell, val); |
418 cellBorder.Child(cell); |
420 cellBorder.Child(cell); |
|
421 if (type == UI_STRING_FREE && val) { |
|
422 free(val); |
|
423 } |
419 |
424 |
420 break; |
425 break; |
421 } |
426 } |
422 case UI_INTEGER: { |
427 case UI_INTEGER: { |
423 TextBlock cell = TextBlock(); |
428 TextBlock cell = TextBlock(); |
436 IconElement icon = iconConstr->getIcon(); |
441 IconElement icon = iconConstr->getIcon(); |
437 cellBorder.Child(icon); |
442 cellBorder.Child(icon); |
438 } |
443 } |
439 break; |
444 break; |
440 } |
445 } |
|
446 case UI_ICON_TEXT_FREE: |
441 case UI_ICON_TEXT: { |
447 case UI_ICON_TEXT: { |
442 StackPanel cellPanel = StackPanel(); |
448 StackPanel cellPanel = StackPanel(); |
443 cellPanel.Spacing(2); |
449 cellPanel.Spacing(2); |
444 cellPanel.Padding(cellpadding); |
450 cellPanel.Padding(cellpadding); |
445 cellPanel.VerticalAlignment(VerticalAlignment::Stretch); |
451 cellPanel.VerticalAlignment(VerticalAlignment::Stretch); |