Tables: changelog. removed TableGetHoveredColumn() from public API in favor of using TableGetColumnFlags(). renamed ImGuiTableSortSpecsColumn to ImGuiTableColumnSortSpecs.

This commit is contained in:
ocornut
2020-12-04 17:54:40 +01:00
parent 7a61f3407b
commit 6e38026627
6 changed files with 43 additions and 17 deletions

View File

@ -38,12 +38,21 @@
// and require you either enable those, either provide your own via IM_VEC2_CLASS_EXTRA in imconfig.h.
// Because we can't assume anything about your support of maths operators, we cannot use them in imgui_demo.cpp.
// Navigating this file:
// - In Visual Studio IDE: CTRL+comma ("Edit.NavigateTo") can follow symbols in comments, whereas CTRL+F12 ("Edit.GoToImplementation") cannot.
// - With Visual Assist installed: ALT+G ("VAssistX.GoToImplementation") can also follow symbols in comments.
/*
Index of this file:
// [SECTION] Forward Declarations, Helpers
// [SECTION] Demo Window / ShowDemoWindow()
// - sub section: ShowDemoWindowWidgets()
// - sub section: ShowDemoWindowLayout()
// - sub section: ShowDemoWindowPopups()
// - sub section: ShowDemoWindowTables()
// - sub section: ShowDemoWindowMisc()
// [SECTION] About Window / ShowAboutWindow()
// [SECTION] Style Editor / ShowStyleEditor()
// [SECTION] Example App: Main Menu Bar / ShowExampleAppMainMenuBar()
@ -3303,7 +3312,7 @@ struct MyItem
{
// Here we identify columns using the ColumnUserID value that we ourselves passed to TableSetupColumn()
// We could also choose to identify columns based on their index (sort_spec->ColumnIndex), which is simpler!
const ImGuiTableSortSpecsColumn* sort_spec = &s_current_sort_specs->Specs[n];
const ImGuiTableColumnSortSpecs* sort_spec = &s_current_sort_specs->Specs[n];
int delta = 0;
switch (sort_spec->ColumnUserID)
{
@ -3755,7 +3764,7 @@ static void ShowDemoWindowTables()
sprintf(buf, "Hello %d,%d", column, row);
ImGui::Button(buf, ImVec2(-FLT_MIN, 0.0f));
}
//if (ImGui::TableGetHoveredColumn() == column)
//if (ImGui::TableGetColumnFlags() & ImGuiTableColumnFlags_IsHovered)
// ImGui::TableSetBgColor(ImGuiTableBgTarget_CellBg, IM_COL32(0, 100, 0, 255));
}
}
@ -4460,10 +4469,12 @@ static void ShowDemoWindowTables()
// [2.3] Right-click anywhere in columns to open another custom popup
// (instead of testing for !IsAnyItemHovered() we could also call OpenPopup() with ImGuiPopupFlags_NoOpenOverExistingPopup
// to manage popup priority as the popups triggers, here "are we hovering a column" are overlapping)
const int hovered_column = ImGui::TableGetHoveredColumn();
int hovered_column = -1;
for (int column = 0; column < COLUMNS_COUNT + 1; column++)
{
ImGui::PushID(column);
if (ImGui::TableGetColumnFlags(column) & ImGuiTableColumnFlags_IsHovered)
hovered_column = column;
if (hovered_column == column && !ImGui::IsAnyItemHovered() && ImGui::IsMouseReleased(1))
ImGui::OpenPopup("MyPopup");
if (ImGui::BeginPopup("MyPopup"))
@ -4480,7 +4491,7 @@ static void ShowDemoWindowTables()
}
ImGui::EndTable();
ImGui::Text("TableGetHoveredColumn() returned: %d", hovered_column);
ImGui::Text("Hovered column: %d", hovered_column);
}
ImGui::TreePop();
}