Commit Graph

1085 Commits

Author SHA1 Message Date
ocornut e1fd25051e MultiSelect: ImGuiSelectionBasicStorage: added GetNextSelectedItem() to abstract selection storage from user. Amend Assets Browser demo to handle drag and drop correctly. 2024-07-18 18:19:21 +02:00
ocornut c3d7aa252b MultiSelect: comments, header tweaks., simplication (some of it on wiki). 2024-07-18 18:19:21 +02:00
ocornut db4898cb91 MultiSelect: added ImGuiSelectionExternalStorage helper. Simplify bool demo. 2024-07-18 18:19:20 +02:00
ocornut c94cf6f01f MultiSelect: added ImGuiSelectionBasicStorage::GetStorageIdFromIndex() indirection to be easier on the reader.
Tempting to make it a virtual.
2024-07-18 18:19:20 +02:00
ocornut ab995d3d4f MultiSelect: (breaking) Added 'items_count' parameter to BeginMultiSelect(). Will enable extra features, and remove equivalent param from ImGuiSelectionBasicStorage::ApplyRequests(. 2024-07-18 18:19:20 +02:00
ocornut 443b034895 MultiSelect: mark parent child window as navigable into, with highlight. Assume user will always submit interactive items. 2024-07-18 18:19:20 +02:00
ocornut f6b5caf82c MultiSelect: (breaking) renamed ImGuiMultiSelectFlags_BoxSelect -> ImGuiMultiSelectFlags_BoxSelect1d, ImGuiMultiSelectFlags_BoxSelect2d -> ImGuiMultiSelectFlags_BoxSelect.
ImGuiMultiSelectFlags_BoxSelect1d being an optimization it is the optional flag.
2024-07-18 18:19:20 +02:00
ocornut 7bbbbea200 MultiSelect: Box-Select: fixes for checkboxes support. Comments. 2024-07-18 18:19:20 +02:00
ocornut 2f56df4839 MultiSelect: (breaking) renamed ImGuiSelectionBasicStorage::AdapterData to UserData. 2024-07-18 18:19:20 +02:00
ocornut 1113f13f83 MultiSelect: Box-Select: fixed "when dragging from void" implementation messing with calling BeginMultiSelect() without a selection size. 2024-07-18 18:19:20 +02:00
ocornut 81548cb6bf MultiSelect: added GetMultiSelectState() + store LastSelectionSize as provided by user, convenient for quick debugging and testing. 2024-07-18 18:19:20 +02:00
ocornut dc0a1682e3 MultiSelect: Box-Select: when dragging from void, first hit item sets NavId by simulating a press, so navigation can resume from that spot. 2024-07-18 18:19:20 +02:00
ocornut 65ebc0513b MultiSelect: Box-Select: minor refactor, tidying up. 2024-07-18 18:19:20 +02:00
ocornut 9435a3185a RangeSelect/MultiSelect: (Breaking) Added current_selection_size to BeginMultiSelect().
Required for shortcut routing so we can e.g. have Escape be used to clear selection THEN to exit child window.
2024-07-18 18:19:19 +02:00
ocornut 0be238ec58 MultiSelect: Box-Select: fix preventing focus. amend determination of scope_hovered for decorated/non-child windows + avoid stealing NavId. (#7424) 2024-07-18 18:19:19 +02:00
ocornut e7a734f78d MultiSelect: added ImGuiMultiSelectFlags_NoAutoSelect, ImGuiMultiSelectFlags_NoAutoClear features + added Checkbox Demo
Refer to "widgets_multiselect_checkboxes" in imgui_test_suite.
2024-07-18 18:19:19 +02:00
ocornut 2111e3597b MultiSelect: Comments + tweaked location for widgets to test ImGuiItemFlags_IsMultiSelect to avoid misleading into thinking doing it before ItemAdd() is necessary. 2024-07-18 18:19:19 +02:00
ocornut dbc67bbf23 MultiSelect: Simplified ImGuiSelectionBasicStorage by using a single SetItemSelected() entry point. 2024-07-18 18:19:19 +02:00
ocornut f36a03c317 MultiSelect: (Breaking) merge ImGuiSelectionRequestType_Clear and ImGuiSelectionRequestType_SelectAll into ImGuiSelectionRequestType_SetAll., rename ImGuiSelectionRequest::RangeSelected to Selected.
The reasoning is that it makes it easier/faster to write an adhoc ImGuiMultiSelectIO handler (e.g. trying to apply multi-select to checkboxes)
2024-07-18 18:19:19 +02:00
ocornut b13a78e6b2 MultiSelect: Fixed ImGuiMultiSelectFlags_SelectOnClickRelease over tree node arrow. 2024-07-18 18:19:19 +02:00
ocornut 9337151a01 MultiSelect: Box-Select: Fixed initial drag from not claiming hovered id, preventing window behind to move for a frame. 2024-07-18 18:19:19 +02:00
ocornut 3141d87ef8 MultiSelect: Box-Select: Fixed CTRL+drag from void clearing items. 2024-07-18 18:19:18 +02:00
ocornut 8312c75fef MultiSelect: Added ImGuiMultiSelectFlags_NoRangeSelect. Fixed ImGuiMultiSelectFlags_ScopeRect not querying proper window hover. 2024-07-18 18:19:18 +02:00
ocornut d439f590ab MultiSelect: Comments + Assets Browser : Tweak colors. 2024-07-18 18:19:18 +02:00
ocornut 6c4bf8e56e MultiSelect: Fixed ImGuiSelectionBasicStorage::ApplyRequests() incorrectly maintaining selection size on SelectAll. 2024-07-18 18:19:18 +02:00
ocornut f3d77d8e71 MultiSelect: Box-Select: Further refactor to extra mode code away from multi-select function into box-select funcitons. 2024-07-18 18:19:18 +02:00
ocornut 907268a430 MultiSelect: Box-Select: Fixed scrolling on high framerates. 2024-07-18 18:19:18 +02:00
ocornut 5d9de14493 MultiSelect: Box-Select: Refactor: Renames.
Split into two commits to facilite looking into previous one if needed.
2024-07-18 18:19:18 +02:00
ocornut 75bac1aac6 MultiSelect: Box-Select: Refactor into its own structure, designed for single-instance but closer to being reusable outside Multi-Select.
Kept same member names.
2024-07-18 18:19:18 +02:00
ocornut 15391762dd MultiSelect: Box-Select: Added ImGuiMultiSelectFlags_BoxSelect2d support. Enabled in Asset Browser. Selectable() supports it. 2024-07-18 18:19:18 +02:00
ocornut 1ac469b50f MultiSelect: Box-Select: Fixed holes when using with clipper (in 1D list.)
Clipper accounts for Selectable() layout oddity as BoxSelect is sensitive to it.
Also tweaked scroll triggering region inward.
Rename ImGuiMultiSelectFlags_NoBoxSelectScroll to ImGuiMultiSelectFlags_BoxSelectNoScroll.
Fixed use with ImGuiMultiSelectFlags_SinglaSelect.
2024-07-18 18:19:18 +02:00
ocornut 51fe0bfcf6 MultiSelect: reworked comments in imgui.h now that we have our own section. 2024-07-18 18:19:17 +02:00
ocornut 0f633c1d99 MultiSelect: move demo's ExampleSelection to main api as a convenient ImGuiSelectionBasicStorage for basic users. 2024-07-18 18:19:17 +02:00
ocornut e0282347db MultiSelect: remove ImGuiSelectionRequest/ImGuiMultiSelectIO details from public api to reduce confusion + comments. 2024-07-18 18:19:17 +02:00
ocornut 0af6fbb51d MultiSelect: added support for nested/stacked BeginMultiSelect().
Mimicking table logic, reusing amortized buffers.
2024-07-18 18:19:17 +02:00
ocornut aa4d64be92 MultiSelect: Box-Select: added scroll support. 2024-07-18 18:19:17 +02:00
ocornut f904a6646c MultiSelect: Box-Select: added support for ImGuiMultiSelectFlags_BoxSelect.
(v11)
FIXME: broken on clipping demo.
2024-07-18 18:19:17 +02:00
ocornut 90305c57e4 MultiSelect: (breaking) renamed ImGuiMultiSelectFlags_ClearOnClickWindowVoid -> ImGuiMultiSelectFlags_ClearOnClickVoid. Added ImGuiMultiSelectFlags_ScopeWindow, ImGuiMultiSelectFlags_ScopeRect. 2024-07-18 18:19:17 +02:00
ocornut 3d41994a63 MultiSelect: simplify clearing ImGuiMultiSelectTempData. 2024-07-18 18:19:17 +02:00
ocornut 33fc61a091 MultiSelect: use a single ImGuiMultiSelectIO buffer.
+ using local storage var in EndMultiSelect(), should be no-op.
2024-07-18 18:19:17 +02:00
ocornut c527cba470 MultiSelect: we don't need to ever write to EndIO.RangeSrcItem as this is not meant to be used. 2024-07-18 18:19:16 +02:00
ocornut 6feff6ff05 MultiSelect: (Breaking) io contains a ImVector<ImGuiSelectionRequest> list. 2024-07-18 18:19:16 +02:00
ocornut c3998b70cc MultiSelect: clarified purpose and use of IsItemToggledSelection(). Added assert. Moved to multi-selection section of imgui.h. 2024-07-18 18:19:16 +02:00
ocornut 2765fdb43e MultiSelect: removed seemingly unnecessary block in BeginMultiSelect().
- EndIO.RangeSelected always set along with EndIO.RequestSetRange
- Trying to assert for the assignment making a difference when EndIO.RequestSetRange is already set couldn't find a case (tests passing).
2024-07-18 18:19:16 +02:00
ocornut 82de6c470b MultiSelect: Added ImGuiMultiSelectFlags_SelectOnClickRelease to allow dragging an unselected item without altering selection + update drag and drop demo. 2024-07-18 18:19:16 +02:00
ocornut 5628dda5a5 MultiSelect: move shared logic to MultiSelectItemHeader().
No logic change AFAIK but added an indent level in MultiSelectItemHeader(). Logic changes will come in next commit.
2024-07-18 18:19:16 +02:00
ocornut 9da4efed2a MultiSelect: moved RequestClear output so it'll match request list version better. Use Storage->RangeSrcItem in EndMultiSelect(). 2024-07-18 18:19:16 +02:00
ocornut 8fe6b31952 MultiSelect: (Breaking) Removed RangeSrcPassedBy in favor of favoring user to call IncludeByIndex(RangeSrcItem) which is easier/simpler to honor.
Especially as recent changes made it required to also update RangeSrcPassedBy after last clipper Step.
Should now be simpler.
2024-07-18 18:19:15 +02:00
ocornut ff95fdb668 MultiSelect: (Breaking) RequestSetRange's parameter are RangeFirstItem...RangeLastItem (which was always ordered unlike RangeSrcItem...RangeDstItme). Removed RangeDstItem. Removed RangeDirection. 2024-07-18 18:19:15 +02:00
ocornut af83a3eea4 MultiSelect: clear selection when leaving a scope with a nav directional request.
May need to clarify how to depends on actions being performed (e.g. click doesn't).
May become optional?
2024-07-18 18:19:15 +02:00
ocornut 6821401a3f MultiSelect: Tweak debug log to print decimal+hex values for item data.
Struggled to get standard PRIX64 to work on CI.
2024-07-18 18:19:15 +02:00
ocornut c9eb3714e8 MultiSelect: move HasSelectionData to ImGuiItemFlags to facilitate copying around in standardized fieds.
Required/motivated to simplify support for ImGuiTreeNodeFlags_NavLeftJumpsBackHere (bc3c0ce) in this branch.
2024-07-18 18:19:15 +02:00
ocornut e82b49d2d4 MultiSelect: (Breaking) Use ImGuiSelectionUserData (= ImS64) instead of void* for selection user data.
Less confusing for most users, less casting.
2024-07-18 18:19:15 +02:00
ocornut 140a2f0565 MultiSelect: Comments, tweaks.
+ Alignment to reduce noise on next commit.
2024-07-18 18:19:15 +02:00
ocornut 847b1dde8c MultiSelect: (Breaking) Fix + Rename ImGuiMultiSelectFlags_NoMultiSelect to ImGuiMultiSelectFlags_SingleSelect as it seems easier to grasp.
Feature was broken by "Tidying up..." June 30 commit.
2024-07-18 18:19:15 +02:00
ocornut 0cf376348b MultiSelect: Cleanup unused comments/code. 2024-07-18 18:19:14 +02:00
ocornut ab9326f4ae MultiSelect: Fixed right-click handling in MultiSelectItemFooter() when not focused. 2024-07-18 18:19:14 +02:00
ocornut df1eeb9a20 MultiSelect: Maintain NavIdSelected for user. Simplify deletion demo. 2024-07-18 18:19:14 +02:00
ocornut 9223ffc255 MultiSelect: (Breaking) BeginMultiSelect() doesn't need two last params maintained by users. Moving some storage from user to core. Proper deletion demo. 2024-07-18 18:19:14 +02:00
ocornut 387fc13894 MultiSelect: Clarify and better enforce lifetime of BeginMultiSelect() value. 2024-07-18 18:19:14 +02:00
ocornut 961b81c362 MultiSelect: Tidying up/simpllifying MultiSelectItemFooter().
Intended to be entirely a no-op, merely a transform of source code for simplification. But committing separatey from behavior change in previous change.
2024-07-18 18:19:14 +02:00
ocornut 1ea9ca748c MultiSelect: Remove the need for using IsItemToggledSelection(). Update comments.
This is the simple version that past our tests. MultiSelectItemFooter() is in need of a cleanup.
2024-07-18 18:19:14 +02:00
ocornut 6ef70a97fd MultiSelect: Remove ImGuiMultiSelectFlags_NoUnselect because I currently can't find use for this specific design.
And/or it seem partly broken.
2024-07-18 18:19:14 +02:00
ocornut ccf43d6a96 MultiSelect: (Breaking) Renamed 'RangeValue' -> 'RangeSelected' + amend comments. 2024-07-18 18:19:14 +02:00
ocornut a83326bc52 MultiSelect: (Breaking) Renamed 'RangeSrc -> 'RangeSrcItem', "RangeDst' -> 'RangeDstItem'
This is necessary to have consistent names in upcoming fields (NavIdItem etc.)
2024-07-18 18:19:13 +02:00
ocornut a39f9e7661 MultiSelect: Internals rename of IO fields to avoid ambiguity with io/rw concepts + memset constructors, tweaks.
debug
2024-07-18 18:19:13 +02:00
ocornut 35b5ebc9b5 MultiSelect: (Breaking) Rename ImGuiMultiSelectData to ImGuiMultiSelectIO. 2024-07-18 18:19:13 +02:00
ocornut 11bcae1ebd MultiSelect: refactor before introducing persistant state pool and to facilitate adding recursion + debug log calls.
This is mostly the noisy/shallow stuff committed here, to get this out of the way.
2024-07-18 18:19:13 +02:00
ocornut 5d71314f71 MultiSelect: removed DragDropActive/preserve_existing_selection logic which seems unused + comments.
Can't find trace of early prototype for range-select but I couldn't find way to trigger this anymore. May be wrong. Will find out.
2024-07-18 18:19:13 +02:00
ocornut 85954c845e MultiSelect: Enter can alter selection if current item is not selected. 2024-07-18 18:19:13 +02:00
ocornut d2f208a30c MultiSelect: made SetNextItemSelectionData() optional to allow disjoint selection (e.g. with a CollapsingHeader between items). Amend demo. 2024-07-18 18:19:13 +02:00
ocornut 815c61b82e MultiSelect: Fixed needing to set RangeSrcPassedBy when not using clipper. 2024-07-18 18:19:13 +02:00
ocornut 78cb1661cb MultiSelect: Shallow tweaks/refactors.
Including moving IsFocused back internally for now.
2024-07-18 18:19:13 +02:00
ocornut a05700e327 MultiSelect: Enter doesn't alter selection (unlike Space).
Fix for changes done in 5606.
2024-07-18 18:19:13 +02:00
ocornut 35bbadcf0c MultiSelect: Added ImGuiMultiSelectFlags_ClearOnClickWindowVoid. + Demo: showcase multiple selection scopes in same window. 2024-07-18 18:19:13 +02:00
ocornut 19086c1c48 MultiSelect: Added ImGuiMultiSelectFlags_ClearOnEscape (unsure of best design), expose IsFocused for custom shortcuts. 2024-07-18 18:19:12 +02:00
ocornut 919cac1482 MultiSelect: Demo: Add a simpler version. 2024-07-18 18:19:12 +02:00
ocornut ad5d3c9bff MultiSelect: Fixed issue with Ctrl+click on TreeNode + amend demo to test drag and drop. 2024-07-18 18:19:12 +02:00
ocornut b9721c1ed7 MultiSelect: Temporary fix/work-around for child/popup to not inherit MultiSelectEnabled flag, until we make mulit-select data stackable. 2024-07-18 18:19:12 +02:00
omar 00c4b8f2a3 MultiSelect: Fix testing key mods from after the nav request (remove need to hold the mod longer) 2024-07-18 18:19:12 +02:00
omar 3ba3f0d905 MultiSelect: Fix Selectable() ambiguous return value, clarify need to use IsItemToggledSelection(). 2024-07-18 18:19:12 +02:00
omar 0479b188d0 MultiSelect: Comments. Tweak demo. 2024-07-18 18:19:12 +02:00
omar 9aeebd24f7 MultiSelect: Fixed CTRL+A not testing focus scope id. Fixed CTRL+A not testing active id. Added demo code.
Comments.
2024-07-18 18:19:12 +02:00
ocornut 7abda179af MultiSelect: Fix for TreeNode following merge of 011d4755. Demo: basic test for tree nodes. 2024-07-18 18:19:12 +02:00
omar 9c7183dd04 MultiSelect: Transition to use FocusScope bits merged in master.
Preserve ability to shift+arrow into an item that is part of FocusScope but doesn't carry a selection without breaking selection.
2024-07-18 18:19:12 +02:00
omar 4afbfd5e71 MultiSelect: Renamed SetNextItemMultiSelectData() to SetNextItemSelectionUserData() 2024-07-18 18:19:12 +02:00
omar 17c4c2154a MultiSelect: Demo sharing selection helper code. Fixed static analyzer warnings. 2024-07-18 18:19:12 +02:00
omar 57da88093f MultiSelect: Added IMGUI_HAS_MULTI_SELECT define. Fixed right-click toggling selection without clearing active id, could lead to MarkItemEdited() asserting. Fixed demo. 2024-07-18 18:19:11 +02:00
ocornut 8947c35fa1 MultiSelect: Removed SelectableSpacing as I'm not sure it is of use for now (history insert) 2024-07-18 18:19:11 +02:00
omar 554db6bc0f MultiSelect: WIP range-select (#1861) (rebased six millions times) 2024-07-18 18:19:11 +02:00
ocornut 070c046cd1 Internals: rename recently added TreeNodeIsOpen() -> TreeNodeGetOpen(). (#7553, #1131, #2958, #2079, #722)
Amend ac7d6fb
2024-07-17 20:01:55 +02:00
ocornut 7c6d4ff28d TreeNode: Internals: facilitate dissociating item ID from storage ID (useful for 1861) 2024-07-17 19:20:39 +02:00
ocornut 669021be4c Style: close button and collapse/window-menu button hover highlight made rectangular instead of round.
The reason they were round in the first place was to work better with rounded windows/frames.
However since the 4a8142449 rework #6749 we can naturally use a tigher bounding box and it seems to work ok either way.
2024-07-17 15:56:34 +02:00
ocornut 4247f190c2 Demo: Property Editor: rearrange code + replace use of bool to proper ImGuiChildFlags.
Amend 46691d1
2024-07-17 13:52:30 +02:00
ocornut 9c1f922b02 Fixed pvs-studio warning. 2024-07-16 17:19:12 +02:00
ocornut 3de75138d1 (Breaking) Renamed ImGuiSelectableFlags_DontClosePopups to ImGuiSelectableFlags_NoAutoClosePopups. (#1379, #1468, #2200, #4936, #5216, #7302, #7573) 2024-07-15 18:46:34 +02:00
ocornut 0de88a928d Added ImGuiItemFlags_AutoClosePopups as a replacement for internal's ImGuiItemFlags_SelectableDontClosePopup. (#1379, #1468, #2200, #4936, #5216, #7302, #7573) 2024-07-15 18:46:34 +02:00
ocornut 7e0800e718 Added PushItemFlag(), PopItemFlag(), ImGuiItemFlags. 2024-07-15 18:38:18 +02:00
ocornut bc9e5b62b6 Added ImGuiDataType_Bool for convenience. 2024-07-15 16:49:35 +02:00
ocornut ac7d6fb5ca Internals: Added TreeNodeIsOpen() to facilitate discoverability. (#7553, #1131, #2958, #2079, #722) 2024-07-15 11:31:00 +02:00