| 61 | } |
| 62 | |
| 63 | ListViewColumn ListViewColumnFromJS(JSContext* ctx, JSValue d) |
| 64 | { |
| 65 | ListViewColumn result; |
| 66 | result.CanSort = AsOrDefault(ctx, d, "canSort", false); |
| 67 | JSValue sortOrderVal = JS_GetPropertyStr(ctx, d, "sortOrder"); |
| 68 | result.SortOrder = ColumnSortOrderFromJS(ctx, sortOrderVal); |
| 69 | JS_FreeValue(ctx, sortOrderVal); |
| 70 | result.Header = AsOrDefault(ctx, d, "header", ""); |
| 71 | result.HeaderTooltip = AsOrDefault(ctx, d, "headerTooltip", ""); |
| 72 | result.MinWidth = JSToOptionalInt(ctx, d, "minWidth"); |
| 73 | result.MaxWidth = JSToOptionalInt(ctx, d, "maxWidth"); |
| 74 | result.RatioWidth = JSToOptionalInt(ctx, d, "ratioWidth"); |
| 75 | |
| 76 | auto width = JSToOptionalInt(ctx, d, "width"); |
| 77 | if (width.has_value()) |
| 78 | { |
| 79 | result.MinWidth = width.value(); |
| 80 | result.MaxWidth = result.MinWidth; |
| 81 | result.RatioWidth = std::nullopt; |
| 82 | } |
| 83 | else if (!result.RatioWidth) |
| 84 | { |
| 85 | result.RatioWidth = 1; |
| 86 | } |
| 87 | return result; |
| 88 | } |
| 89 | |
| 90 | JSValue ListViewColumnToJS(JSContext* ctx, const ListViewColumn& value) |
| 91 | { |
no test coverage detected