mirror of
https://github.com/ocornut/imgui.git
synced 2026-01-11 00:04:24 +00:00
MultiSelect: Added ImGuiMultiSelectFlags_ClearOnEscape (unsure of best design), expose IsFocused for custom shortcuts.
This commit is contained in:
parent
919cac1482
commit
19086c1c48
3 changed files with 27 additions and 13 deletions
5
imgui.h
5
imgui.h
|
|
@ -2725,7 +2725,7 @@ struct ImColor
|
|||
#define IMGUI_HAS_MULTI_SELECT // Multi-Select/Range-Select WIP branch // <-- This is currently _not_ in the top of imgui.h to prevent merge conflicts.
|
||||
|
||||
// Flags for BeginMultiSelect().
|
||||
// This system is designed to allow mouse/keyboard multi-selection, including support for range-selection (SHIFT + click),
|
||||
// This system is designed to allow mouse/keyboard multi-selection, including support for range-selection (SHIFT+click and SHIFT+keyboard),
|
||||
// which is difficult to re-implement manually. If you disable multi-selection with ImGuiMultiSelectFlags_NoMultiSelect
|
||||
// (which is provided for consistency and flexibility), the whole BeginMultiSelect() system becomes largely overkill as
|
||||
// you can handle single-selection in a simpler manner by just calling Selectable() and reacting on clicks yourself.
|
||||
|
|
@ -2735,6 +2735,7 @@ enum ImGuiMultiSelectFlags_
|
|||
ImGuiMultiSelectFlags_NoMultiSelect = 1 << 0,
|
||||
ImGuiMultiSelectFlags_NoUnselect = 1 << 1, // Disable unselecting items with CTRL+Click, CTRL+Space etc.
|
||||
ImGuiMultiSelectFlags_NoSelectAll = 1 << 2, // Disable CTRL+A shortcut to set RequestSelectAll
|
||||
ImGuiMultiSelectFlags_ClearOnEscape = 1 << 3, // Enable ESC shortcut to clear selection
|
||||
};
|
||||
|
||||
// Abstract:
|
||||
|
|
@ -2773,6 +2774,7 @@ enum ImGuiMultiSelectFlags_
|
|||
// If you submit all items (no clipper), Step 2 and 3 and will be handled by Selectable() on a per-item basis.
|
||||
struct ImGuiMultiSelectData
|
||||
{
|
||||
bool IsFocused; // Begin // Set if currently focusing the selection scope (any item of the selection). May be used if you have custom shortcut associated to selection.
|
||||
bool RequestClear; // Begin, End // Request user to clear selection
|
||||
bool RequestSelectAll; // Begin, End // Request user to select all
|
||||
bool RequestSetRange; // End // Request user to set or clear selection in the [RangeSrc..RangeDst] range
|
||||
|
|
@ -2785,6 +2787,7 @@ struct ImGuiMultiSelectData
|
|||
ImGuiMultiSelectData() { Clear(); }
|
||||
void Clear()
|
||||
{
|
||||
IsFocused = false;
|
||||
RequestClear = RequestSelectAll = RequestSetRange = RangeSrcPassedBy = RangeValue = false;
|
||||
RangeSrc = RangeDst = NULL;
|
||||
RangeDirection = 0;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue