Use -1 to open menu not specific to a given column.
| 2982 | |
| 2983 | // Use -1 to open menu not specific to a given column. |
| 2984 | void ImGui::TableOpenContextMenu(int column_n) |
| 2985 | { |
| 2986 | ImGuiContext& g = *GImGui; |
| 2987 | ImGuiTable* table = g.CurrentTable; |
| 2988 | if (column_n == -1 && table->CurrentColumn != -1) // When called within a column automatically use this one (for consistency) |
| 2989 | column_n = table->CurrentColumn; |
| 2990 | if (column_n == table->ColumnsCount) // To facilitate using with TableGetHoveredColumn() |
| 2991 | column_n = -1; |
| 2992 | IM_ASSERT(column_n >= -1 && column_n < table->ColumnsCount); |
| 2993 | if (table->Flags & (ImGuiTableFlags_Resizable | ImGuiTableFlags_Reorderable | ImGuiTableFlags_Hideable)) |
| 2994 | { |
| 2995 | table->IsContextPopupOpen = true; |
| 2996 | table->ContextPopupColumn = (ImGuiTableColumnIdx)column_n; |
| 2997 | table->InstanceInteracted = table->InstanceCurrent; |
| 2998 | const ImGuiID context_menu_id = ImHashStr("##ContextMenu", 0, table->ID); |
| 2999 | OpenPopupEx(context_menu_id, ImGuiPopupFlags_None); |
| 3000 | } |
| 3001 | } |
| 3002 | |
| 3003 | // Output context menu into current window (generally a popup) |
| 3004 | // FIXME-TABLE: Ideally this should be writable by the user. Full programmatic access to that data? |
nothing calls this directly
no test coverage detected