mirror of
https://github.com/Drezil/imgui.git
synced 2025-07-16 09:43:13 +02:00
Merge branch 'master' into docking
# Conflicts: # imgui.h # imgui_internal.h
This commit is contained in:
@ -3652,7 +3652,7 @@ static void ShowDemoWindowTables()
|
||||
// If there is not enough available width to fit all columns, they will however be resized down.
|
||||
// FIXME-TABLE: Providing a stretch-on-init would make sense especially for tables which don't have saved settings
|
||||
HelpMarker(
|
||||
"Using _Resizable + _ColumnsWidthFixedX flags.\n"
|
||||
"Using _Resizable + _ColumnsWidthFixed flags.\n"
|
||||
"Fixed-width columns generally makes more sense if you want to use horizontal scrolling.\n\n"
|
||||
"Double-click a column border to auto-fit the column to its contents.");
|
||||
static ImGuiTableFlags flags = ImGuiTableFlags_Resizable | ImGuiTableFlags_ColumnsWidthFixed | ImGuiTableFlags_BordersOuter | ImGuiTableFlags_BordersV | ImGuiTableFlags_ContextMenuInBody;
|
||||
@ -3785,7 +3785,8 @@ static void ShowDemoWindowTables()
|
||||
"e.g.:\n"
|
||||
"- BorderOuterV\n"
|
||||
"- any form of row selection\n"
|
||||
"Because of this, activating BorderOuterV sets the default to PadOuterX. Using PadOuterX or NoPadOuterX you can override the default.\n");
|
||||
"Because of this, activating BorderOuterV sets the default to PadOuterX. Using PadOuterX or NoPadOuterX you can override the default.\n\n"
|
||||
"Actual padding values are using style.CellPadding.");
|
||||
|
||||
PushStyleCompact();
|
||||
ImGui::CheckboxFlags("ImGuiTableFlags_PadOuterX", &flags, ImGuiTableFlags_PadOuterX);
|
||||
@ -4087,7 +4088,7 @@ static void ShowDemoWindowTables()
|
||||
HelpMarker("This section allows you to interact and see the effect of StretchX vs FixedX sizing policies depending on whether Scroll is enabled and the contents of your columns.");
|
||||
enum ContentsType { CT_ShortText, CT_LongText, CT_Button, CT_FillButton, CT_InputText };
|
||||
static ImGuiTableFlags flags = ImGuiTableFlags_ScrollY | ImGuiTableFlags_BordersOuter | ImGuiTableFlags_RowBg;
|
||||
static int contents_type = CT_Button;
|
||||
static int contents_type = CT_LongText;
|
||||
static int column_count = 3;
|
||||
|
||||
PushStyleCompact();
|
||||
@ -4633,8 +4634,6 @@ static void ShowDemoWindowTables()
|
||||
ImGui::SetNextItemOpen(open_action != 0);
|
||||
if (ImGui::TreeNode("Sorting"))
|
||||
{
|
||||
HelpMarker("Use Shift+Click to sort on multiple columns");
|
||||
|
||||
// Create item list
|
||||
static ImVector<MyItem> items;
|
||||
if (items.Size == 0)
|
||||
@ -4650,10 +4649,16 @@ static void ShowDemoWindowTables()
|
||||
}
|
||||
}
|
||||
|
||||
ImGuiTableFlags flags =
|
||||
ImGuiTableFlags_Resizable | ImGuiTableFlags_Reorderable | ImGuiTableFlags_Hideable | ImGuiTableFlags_MultiSortable
|
||||
// Options
|
||||
static ImGuiTableFlags flags =
|
||||
ImGuiTableFlags_Resizable | ImGuiTableFlags_Reorderable | ImGuiTableFlags_Hideable | ImGuiTableFlags_Sortable | ImGuiTableFlags_SortMulti
|
||||
| ImGuiTableFlags_RowBg | ImGuiTableFlags_BordersOuter | ImGuiTableFlags_BordersV | ImGuiTableFlags_NoBordersInBody
|
||||
| ImGuiTableFlags_ScrollY;
|
||||
ImGui::CheckboxFlags("ImGuiTableFlags_SortMulti", &flags, ImGuiTableFlags_SortMulti);
|
||||
ImGui::SameLine(); HelpMarker("When sorting is enabled: hold shift when clicking headers to sort on multiple column. TableGetSortSpecs() may return specs where (SpecsCount > 1).");
|
||||
ImGui::CheckboxFlags("ImGuiTableFlags_SortTristate", &flags, ImGuiTableFlags_SortTristate);
|
||||
ImGui::SameLine(); HelpMarker("When sorting is enabled: allow no sorting, disable default sorting. TableGetSortSpecs() may return specs where (SpecsCount == 0).");
|
||||
|
||||
if (ImGui::BeginTable("##table", 4, flags, ImVec2(0, TEXT_BASE_HEIGHT * 15), 0.0f))
|
||||
{
|
||||
// Declare columns
|
||||
@ -4712,11 +4717,11 @@ static void ShowDemoWindowTables()
|
||||
if (ImGui::TreeNode("Advanced"))
|
||||
{
|
||||
static ImGuiTableFlags flags =
|
||||
ImGuiTableFlags_Resizable | ImGuiTableFlags_Reorderable | ImGuiTableFlags_Hideable | ImGuiTableFlags_MultiSortable
|
||||
ImGuiTableFlags_Resizable | ImGuiTableFlags_Reorderable | ImGuiTableFlags_Hideable
|
||||
| ImGuiTableFlags_Sortable | ImGuiTableFlags_SortMulti
|
||||
| ImGuiTableFlags_RowBg | ImGuiTableFlags_Borders | ImGuiTableFlags_NoBordersInBody
|
||||
| ImGuiTableFlags_ScrollX | ImGuiTableFlags_ScrollY
|
||||
| ImGuiTableFlags_ColumnsWidthFixed
|
||||
;
|
||||
| ImGuiTableFlags_ColumnsWidthFixed;
|
||||
|
||||
enum ContentsType { CT_Text, CT_Button, CT_SmallButton, CT_FillButton, CT_Selectable, CT_SelectableSpanRow };
|
||||
static int contents_type = CT_Button;
|
||||
@ -4744,7 +4749,6 @@ static void ShowDemoWindowTables()
|
||||
ImGui::CheckboxFlags("ImGuiTableFlags_Reorderable", &flags, ImGuiTableFlags_Reorderable);
|
||||
ImGui::CheckboxFlags("ImGuiTableFlags_Hideable", &flags, ImGuiTableFlags_Hideable);
|
||||
ImGui::CheckboxFlags("ImGuiTableFlags_Sortable", &flags, ImGuiTableFlags_Sortable);
|
||||
ImGui::CheckboxFlags("ImGuiTableFlags_MultiSortable", &flags, ImGuiTableFlags_MultiSortable);
|
||||
ImGui::CheckboxFlags("ImGuiTableFlags_NoSavedSettings", &flags, ImGuiTableFlags_NoSavedSettings);
|
||||
ImGui::CheckboxFlags("ImGuiTableFlags_ContextMenuInBody", &flags, ImGuiTableFlags_ContextMenuInBody);
|
||||
ImGui::TreePop();
|
||||
@ -4805,6 +4809,15 @@ static void ShowDemoWindowTables()
|
||||
ImGui::TreePop();
|
||||
}
|
||||
|
||||
if (ImGui::TreeNodeEx("Sorting:", ImGuiTreeNodeFlags_DefaultOpen))
|
||||
{
|
||||
ImGui::CheckboxFlags("ImGuiTableFlags_SortMulti", &flags, ImGuiTableFlags_SortMulti);
|
||||
ImGui::SameLine(); HelpMarker("When sorting is enabled: hold shift when clicking headers to sort on multiple column. TableGetSortSpecs() may return specs where (SpecsCount > 1).");
|
||||
ImGui::CheckboxFlags("ImGuiTableFlags_SortTristate", &flags, ImGuiTableFlags_SortTristate);
|
||||
ImGui::SameLine(); HelpMarker("When sorting is enabled: allow no sorting, disable default sorting. TableGetSortSpecs() may return specs where (SpecsCount == 0).");
|
||||
ImGui::TreePop();
|
||||
}
|
||||
|
||||
if (ImGui::TreeNodeEx("Other:", ImGuiTreeNodeFlags_DefaultOpen))
|
||||
{
|
||||
ImGui::Checkbox("show_headers", &show_headers);
|
||||
@ -4860,13 +4873,13 @@ static void ShowDemoWindowTables()
|
||||
// Declare columns
|
||||
// We use the "user_id" parameter of TableSetupColumn() to specify a user id that will be stored in the sort specifications.
|
||||
// This is so our sort function can identify a column given our own identifier. We could also identify them based on their index!
|
||||
ImGui::TableSetupScrollFreeze(freeze_cols, freeze_rows);
|
||||
ImGui::TableSetupColumn("ID", ImGuiTableColumnFlags_DefaultSort | ImGuiTableColumnFlags_WidthFixed | ImGuiTableColumnFlags_NoHide, -1.0f, MyItemColumnID_ID);
|
||||
ImGui::TableSetupColumn("Name", ImGuiTableColumnFlags_WidthFixed, -1.0f, MyItemColumnID_Name);
|
||||
ImGui::TableSetupColumn("Action", ImGuiTableColumnFlags_NoSort | ImGuiTableColumnFlags_WidthFixed, -1.0f, MyItemColumnID_Action);
|
||||
ImGui::TableSetupColumn("Quantity (Long Label)", ImGuiTableColumnFlags_PreferSortDescending | ImGuiTableColumnFlags_WidthStretch, 1.0f, MyItemColumnID_Quantity);// , ImGuiTableColumnFlags_WidthAutoResize);
|
||||
ImGui::TableSetupColumn("Description", ImGuiTableColumnFlags_WidthStretch, 1.0f, MyItemColumnID_Description);
|
||||
ImGui::TableSetupColumn("Hidden", ImGuiTableColumnFlags_DefaultHide | ImGuiTableColumnFlags_NoSort);
|
||||
ImGui::TableSetupScrollFreeze(freeze_cols, freeze_rows);
|
||||
|
||||
// Sort our data if sort specs have been changed!
|
||||
ImGuiTableSortSpecs* sorts_specs = ImGui::TableGetSortSpecs();
|
||||
|
Reference in New Issue
Block a user