Use -1 to open menu not specific to a given column.
| 2999 | |
| 3000 | // Use -1 to open menu not specific to a given column. |
| 3001 | void ImGui::TableOpenContextMenu(int column_n) |
| 3002 | { |
| 3003 | ImGuiContext& g = *GImGui; |
| 3004 | ImGuiTable* table = g.CurrentTable; |
| 3005 | if (column_n == -1 && table->CurrentColumn != -1) // When called within a column automatically use this one (for consistency) |
| 3006 | column_n = table->CurrentColumn; |
| 3007 | if (column_n == table->ColumnsCount) // To facilitate using with TableGetHoveredColumn() |
| 3008 | column_n = -1; |
| 3009 | IM_ASSERT(column_n >= -1 && column_n < table->ColumnsCount); |
| 3010 | if (table->Flags & (ImGuiTableFlags_Resizable | ImGuiTableFlags_Reorderable | ImGuiTableFlags_Hideable)) |
| 3011 | { |
| 3012 | table->IsContextPopupOpen = true; |
| 3013 | table->ContextPopupColumn = (ImGuiTableColumnIdx)column_n; |
| 3014 | table->InstanceInteracted = table->InstanceCurrent; |
| 3015 | const ImGuiID context_menu_id = ImHashStr("##ContextMenu", 0, table->ID); |
| 3016 | OpenPopupEx(context_menu_id, ImGuiPopupFlags_None); |
| 3017 | } |
| 3018 | } |
| 3019 | |
| 3020 | // Output context menu into current window (generally a popup) |
| 3021 | // FIXME-TABLE: Ideally this should be writable by the user. Full programmatic access to that data? |
nothing calls this directly
no test coverage detected