| 3417 | } |
| 3418 | |
| 3419 | static void TableSettingsHandler_WriteAll(ImGuiContext* ctx, ImGuiSettingsHandler* handler, ImGuiTextBuffer* buf) |
| 3420 | { |
| 3421 | ImGuiContext& g = *ctx; |
| 3422 | for (ImGuiTableSettings* settings = g.SettingsTables.begin(); settings != NULL; settings = g.SettingsTables.next_chunk(settings)) |
| 3423 | { |
| 3424 | if (settings->ID == 0) // Skip ditched settings |
| 3425 | continue; |
| 3426 | |
| 3427 | // TableSaveSettings() may clear some of those flags when we establish that the data can be stripped |
| 3428 | // (e.g. Order was unchanged) |
| 3429 | const bool save_size = (settings->SaveFlags & ImGuiTableFlags_Resizable) != 0; |
| 3430 | const bool save_visible = (settings->SaveFlags & ImGuiTableFlags_Hideable) != 0; |
| 3431 | const bool save_order = (settings->SaveFlags & ImGuiTableFlags_Reorderable) != 0; |
| 3432 | const bool save_sort = (settings->SaveFlags & ImGuiTableFlags_Sortable) != 0; |
| 3433 | if (!save_size && !save_visible && !save_order && !save_sort) |
| 3434 | continue; |
| 3435 | |
| 3436 | buf->reserve(buf->size() + 30 + settings->ColumnsCount * 50); // ballpark reserve |
| 3437 | buf->appendf("[%s][0x%08X,%d]\n", handler->TypeName, settings->ID, settings->ColumnsCount); |
| 3438 | if (settings->RefScale != 0.0f) |
| 3439 | buf->appendf("RefScale=%g\n", settings->RefScale); |
| 3440 | ImGuiTableColumnSettings* column = settings->GetColumnSettings(); |
| 3441 | for (int column_n = 0; column_n < settings->ColumnsCount; column_n++, column++) |
| 3442 | { |
| 3443 | // "Column 0 UserID=0x42AD2D21 Width=100 Visible=1 Order=0 Sort=0v" |
| 3444 | bool save_column = column->UserID != 0 || save_size || save_visible || save_order || (save_sort && column->SortOrder != -1); |
| 3445 | if (!save_column) |
| 3446 | continue; |
| 3447 | buf->appendf("Column %-2d", column_n); |
| 3448 | if (column->UserID != 0) buf->appendf(" UserID=%08X", column->UserID); |
| 3449 | if (save_size && column->IsStretch) buf->appendf(" Weight=%.4f", column->WidthOrWeight); |
| 3450 | if (save_size && !column->IsStretch) buf->appendf(" Width=%d", (int)column->WidthOrWeight); |
| 3451 | if (save_visible) buf->appendf(" Visible=%d", column->IsEnabled); |
| 3452 | if (save_order) buf->appendf(" Order=%d", column->DisplayOrder); |
| 3453 | if (save_sort && column->SortOrder != -1) buf->appendf(" Sort=%d%c", column->SortOrder, (column->SortDirection == ImGuiSortDirection_Ascending) ? 'v' : '^'); |
| 3454 | buf->append("\n"); |
| 3455 | } |
| 3456 | buf->append("\n"); |
| 3457 | } |
| 3458 | } |
| 3459 | |
| 3460 | void ImGui::TableSettingsAddSettingsHandler() |
| 3461 | { |
nothing calls this directly
no test coverage detected