MCPcopy Create free account
hub / github.com/BlitterStudio/amiberry / TableSetupColumnFlags

Function TableSetupColumnFlags

external/imgui/imgui_tables.cpp:790–843  ·  view source on GitHub ↗

Adjust flags: default width mode + stretch columns are not allowed when auto extending

Source from the content-addressed store, hash-verified

788
789// Adjust flags: default width mode + stretch columns are not allowed when auto extending
790static void TableSetupColumnFlags(ImGuiTable* table, ImGuiTableColumn* column, ImGuiTableColumnFlags flags_in)
791{
792 ImGuiTableColumnFlags flags = flags_in;
793
794 // Sizing Policy
795 if ((flags & ImGuiTableColumnFlags_WidthMask_) == 0)
796 {
797 const ImGuiTableFlags table_sizing_policy = (table->Flags & ImGuiTableFlags_SizingMask_);
798 if (table_sizing_policy == ImGuiTableFlags_SizingFixedFit || table_sizing_policy == ImGuiTableFlags_SizingFixedSame)
799 flags |= ImGuiTableColumnFlags_WidthFixed;
800 else
801 flags |= ImGuiTableColumnFlags_WidthStretch;
802 }
803 else
804 {
805 IM_ASSERT(ImIsPowerOfTwo(flags & ImGuiTableColumnFlags_WidthMask_)); // Check that only 1 of each set is used.
806 }
807
808 // Resize
809 if ((table->Flags & ImGuiTableFlags_Resizable) == 0)
810 flags |= ImGuiTableColumnFlags_NoResize;
811
812 // Sorting
813 if ((flags & ImGuiTableColumnFlags_NoSortAscending) && (flags & ImGuiTableColumnFlags_NoSortDescending))
814 flags |= ImGuiTableColumnFlags_NoSort;
815
816 // Indentation
817 if ((flags & ImGuiTableColumnFlags_IndentMask_) == 0)
818 flags |= (table->Columns.index_from_ptr(column) == 0) ? ImGuiTableColumnFlags_IndentEnable : ImGuiTableColumnFlags_IndentDisable;
819
820 // Alignment
821 //if ((flags & ImGuiTableColumnFlags_AlignMask_) == 0)
822 // flags |= ImGuiTableColumnFlags_AlignCenter;
823 //IM_ASSERT(ImIsPowerOfTwo(flags & ImGuiTableColumnFlags_AlignMask_)); // Check that only 1 of each set is used.
824
825 // Preserve status flags
826 column->Flags = flags | (column->Flags & ImGuiTableColumnFlags_StatusMask_);
827
828 // Build an ordered list of available sort directions
829 column->SortDirectionsAvailCount = column->SortDirectionsAvailMask = column->SortDirectionsAvailList = 0;
830 if (table->Flags & ImGuiTableFlags_Sortable)
831 {
832 int count = 0, mask = 0, list = 0;
833 if ((flags & ImGuiTableColumnFlags_PreferSortAscending) != 0 && (flags & ImGuiTableColumnFlags_NoSortAscending) == 0) { mask |= 1 << ImGuiSortDirection_Ascending; list |= ImGuiSortDirection_Ascending << (count << 1); count++; }
834 if ((flags & ImGuiTableColumnFlags_PreferSortDescending) != 0 && (flags & ImGuiTableColumnFlags_NoSortDescending) == 0) { mask |= 1 << ImGuiSortDirection_Descending; list |= ImGuiSortDirection_Descending << (count << 1); count++; }
835 if ((flags & ImGuiTableColumnFlags_PreferSortAscending) == 0 && (flags & ImGuiTableColumnFlags_NoSortAscending) == 0) { mask |= 1 << ImGuiSortDirection_Ascending; list |= ImGuiSortDirection_Ascending << (count << 1); count++; }
836 if ((flags & ImGuiTableColumnFlags_PreferSortDescending) == 0 && (flags & ImGuiTableColumnFlags_NoSortDescending) == 0) { mask |= 1 << ImGuiSortDirection_Descending; list |= ImGuiSortDirection_Descending << (count << 1); count++; }
837 if ((table->Flags & ImGuiTableFlags_SortTristate) || count == 0) { mask |= 1 << ImGuiSortDirection_None; count++; }
838 column->SortDirectionsAvailList = (ImU8)list;
839 column->SortDirectionsAvailMask = (ImU8)mask;
840 column->SortDirectionsAvailCount = (ImU8)count;
841 ImGui::TableFixColumnSortDirection(table, column);
842 }
843}
844
845// Layout columns for the frame. This is in essence the followup to BeginTable() and this is our largest function.
846// Runs on the first call to TableNextRow(), to give a chance for TableSetupColumn() and other TableSetupXXXXX() functions to be called first.

Callers 2

TableUpdateLayoutMethod · 0.85
TableSetupColumnMethod · 0.85

Calls 1

ImIsPowerOfTwoFunction · 0.85

Tested by

no test coverage detected