forked from Green-Sky/tomato
Squashed 'external/imgui/imgui/' changes from c2d21ab04f2..8199457a7d9
8199457a7d9 Version 1.91.0 ec9a4ef487a Clipper: accept that no item have been submitted if in indeterminate Begin(INT_MAX) mode. (#1311, #3823) 1b44e404449 Demo: re-use tree data. Fix property editor vertical alignment. Tweak recent memory allocation monitor. 1f634f1d94e Eaxmples: Android: Fix build failed issue. (#7832) ce3a8d7c79f Demo: MultiSelect: added tree demo. (#6990, #3823, #1861) c2a3d5e47b0 Comments, minor tweaks to ImGuiTextFilter. df387049268 Added SetNextItemStorageID() for tree nodes. (#7553, #6990, #3823, #1131) b847c414372 MultiSelect: BoxSelect: fixed using in frozen table. (#7821, #5143) + added Demo. 249d5caedbe Tables: storing LastFrozenHeight for frozen requests that don't have actual freezing due to zero scrolling. (#7821, #5143) c7b92560977 Selectable: added ImGuiSelectableFlags_Highlight flag to highlight items independently from the hovered state. (#7820) 96460a8a126 InputText: Added '\' and '/' as word seperator. (#7824, #7704) 79e83d65352 Docs: misc update. d42fa46dc6b Misc micro-optimizations related to hot-path of dealing with a large clipped tree. 692bee5f221 Added GetID(int) variant for consistency. (#7111) b3ba6b30952 Added io.ConfigNavSwapGamepadButtons to swap Activate/Cancel (A<>B) buttons, to match the typical "Nintendo/Japanese consoles" button layout when using Gamepad navigation. (#787, #5723) 3f9a90e2a3c Docs: added extraneous link to Getting Started section. b20f62b162e Obsoleted GetContentRegionMax(). 4227402b2fe Internals: removed GetContentRegionMaxAbs() which was only meaningfully used in place of GetContentRegionAvail(). 055b2e80fbe Moved everyone's best friend GetContentRegionAvail() to a more prominent position. aad86b8756b Obsoleted GetWindowContentRegionMin() and GetWindowContentRegionMax(). 55f54fa512f Internals: comment out obsolete g.ActiveIdUsingNavInputMask obsoleted two years ago. (#4921, #4858, #787, #1599, #323) ed356dc1812 MultiSelect: BoxSelect: fixed box-select from void setting nav id multiple times. 237165a9359 MultiSelect: fixed an issue caused by previous commit. a285835ac4a MultiSelect: add internal MultiSelectAddSetAll() helper. 79b77d91c98 MultiSelect: sequential SetRange merging not generally handled by box-select path, useful for others. e3da939b86f Groups, Tables: fixed EndGroup() failing to correctly capture current table occupied size. (#7543) b67b375ae69 Debug Log: fixed incorrect checkbox layout when partially clipped., doesn't parse 64-bits hex value as ImGuiID lookups. 97c6f4047cc CollapsingHeader: left-side outer extend matches right-side one (moved left by one pixel) 1230b4410cd Internals, TreeNode, Selectable: tweak span_all_columns paths for clarity. 4d8c56c8133 Internals, TreeNode: indent all render block into its own scope (aim is to add a is_visible test there later) fe09ebbe0a1 Backends: OpenGL3: Fixed unsupported option warning with apple clang (#7810) 605c8d71101 Demo: Property Editor: using ImGuiChildFlags_NavFlattened now that a bug is fixed. Fixed static analyzer. 97ff9bd3703 Nav: fixed c licking window decorations (e.g. resize borders) from losing focused item when within a child window using ImGuiChildFlags_NavFlattened. c3dca77a197 Demo: rework Property Editor. fd994943c2d Added a comment hinting at how to set IMGUI_API for shared librairies on e.g. Linux, macOS (#7806) da363363219 TabBar, Style: added style option for the size of the Tab-Bar Overline (#7804) eb72b5a8eee Backends: SDL3: Update for API changes: SDL_GetGamepads() memory ownership change. (#7807) f9cda1fa245 Inputs: added SetItemKeyOwner(ImGuiKey key) in public API. (#456, #2637, #2620, #2891, #3370, #3724, #4828, #5108, #5242, #5641) b6e313bc05d MultiSelect: using ImGuiMultiSelectFlags_NoRangeSelect ensure never having to interpolate between two ImGuiSelectionUserData. 168ef39984c Demo: moved menu bar code to its own function. 57eea6746e6 Demo: moved some fields inside a struct. 2546d0a0dbe Demo: moved ExampleTreeNode, ExampleMemberInfo above in the demo file. Tidying up index. d7e605d4309 Merge branch 'features/range_select' 02c31a8dd1f MultiSelect: added Changelog for the feature. Removed IMGUI_HAS_MULTI_SELECT. 2688562fd2d MultiSelect: Better document how TreeNode() is not trivially usable yet. 7814518049e MultiSelect: ImGuiSelectionBasicStorage: optimized for smaller insertion amounts in larger sets + fix caling batch select with same value. 1b635224465 MultiSelect: Box-Select: handle Esc to disable box-select. 2697cfe3546 MultiSelect: Box-Select: uses SetActiveIdUsingAllKeyboardKeys() to avoid nav interference, much like most drag operations. 7d4de84ee3c MultiSelect: added courtesy ImGuiMultiSelectFlags_NavWrapX flag so we can demo this until a nav api is designed. d411c9054ad MultiSelect: minor tidying up. 3f34c83bc6e MultiSelect: added ImGuiMultiSelectFlags_NoAutoClearOnReselect + tweak flags comments. (#7424) 529c73ba218 MultiSelect: Shift+Tab doesn't enable Shift select on landing item. a8a1f295126 MultiSelect: (breaking) renamed ImGuiMultiSelectFlags_BoxSelect -> ImGuiMultiSelectFlags_BoxSelect2d. Which include not assuming one flag imply the other. c52346850d7 MultiSelect: ImGuiSelectionBasicStorage: added PreserveOrder, maintain implicit order data in storage. df664329cb5 MultiSelect: provide RangeDirection to allow selection handler to handler backward shift+click. 3ac367ff41b MultiSelect: ImGuiSelectionBasicStorage: (breaking) rework GetNextSelectedItem() api to avoid ambiguity/failure when user uses a zero id. f472f170540 Demo: Assets Browser: added a way to disable sorting and hide sorting options. c07864f64ab MultiSelect: ImGuiSelectionBasicStorage: move function bodies to cpp file. 2af3b2ac815 MultiSelect: ImGuiSelectionBasicStorage: simplify by removing compacting code (compacting may be opt-in?). e61612a6873 MultiSelect: ImGuiSelectionBasicStorage: rework to accept massive selections requests without flinching. e1fd25051e1 MultiSelect: ImGuiSelectionBasicStorage: added GetNextSelectedItem() to abstract selection storage from user. Amend Assets Browser demo to handle drag and drop correctly. c3d7aa252b3 MultiSelect: comments, header tweaks., simplication (some of it on wiki). db4898cb913 MultiSelect: added ImGuiSelectionExternalStorage helper. Simplify bool demo. f9caf4447a6 MultiSelect: fixed ImGuiSelectionBasicStorage::Swap() helper. c94cf6f01fe MultiSelect: added ImGuiSelectionBasicStorage::GetStorageIdFromIndex() indirection to be easier on the reader. ab995d3d4f3 MultiSelect: (breaking) Added 'items_count' parameter to BeginMultiSelect(). Will enable extra features, and remove equivalent param from ImGuiSelectionBasicStorage::ApplyRequests(. 443b034895c MultiSelect: mark parent child window as navigable into, with highlight. Assume user will always submit interactive items. f6b5caf82c7 MultiSelect: (breaking) renamed ImGuiMultiSelectFlags_BoxSelect -> ImGuiMultiSelectFlags_BoxSelect1d, ImGuiMultiSelectFlags_BoxSelect2d -> ImGuiMultiSelectFlags_BoxSelect. 7bbbbea2004 MultiSelect: Box-Select: fixes for checkboxes support. Comments. 2f56df48398 MultiSelect: (breaking) renamed ImGuiSelectionBasicStorage::AdapterData to UserData. 1113f13f838 MultiSelect: Box-Select: fixed "when dragging from void" implementation messing with calling BeginMultiSelect() without a selection size. 81548cb6bf3 MultiSelect: added GetMultiSelectState() + store LastSelectionSize as provided by user, convenient for quick debugging and testing. dc0a1682e3b MultiSelect: Box-Select: when dragging from void, first hit item sets NavId by simulating a press, so navigation can resume from that spot. 65ebc0513b2 MultiSelect: Box-Select: minor refactor, tidying up. 9435a3185af RangeSelect/MultiSelect: (Breaking) Added current_selection_size to BeginMultiSelect(). 955210ae5bf MultiSelect: Demo: use Shortcut(). 0be238ec587 MultiSelect: Box-Select: fix preventing focus. amend determination of scope_hovered for decorated/non-child windows + avoid stealing NavId. (#7424) e7a734f78d1 MultiSelect: added ImGuiMultiSelectFlags_NoAutoSelect, ImGuiMultiSelectFlags_NoAutoClear features + added Checkbox Demo a639346fbaf MultiSelect: Demo: make various child windows resizable, with synched heights for the dual list box demo. 2111e3597bc MultiSelect: Comments + tweaked location for widgets to test ImGuiItemFlags_IsMultiSelect to avoid misleading into thinking doing it before ItemAdd() is necessary. dbc67bbf23f MultiSelect: Simplified ImGuiSelectionBasicStorage by using a single SetItemSelected() entry point. f36a03c317a MultiSelect: (Breaking) merge ImGuiSelectionRequestType_Clear and ImGuiSelectionRequestType_SelectAll into ImGuiSelectionRequestType_SetAll., rename ImGuiSelectionRequest::RangeSelected to Selected. b13a78e6b2d MultiSelect: Fixed ImGuiMultiSelectFlags_SelectOnClickRelease over tree node arrow. 9337151a013 MultiSelect: Box-Select: Fixed initial drag from not claiming hovered id, preventing window behind to move for a frame. 3141d87ef81 MultiSelect: Box-Select: Fixed CTRL+drag from void clearing items. 8312c75fef0 MultiSelect: Added ImGuiMultiSelectFlags_NoRangeSelect. Fixed ImGuiMultiSelectFlags_ScopeRect not querying proper window hover. d439f590ab5 MultiSelect: Comments + Assets Browser : Tweak colors. 6c4bf8e56ec MultiSelect: Fixed ImGuiSelectionBasicStorage::ApplyRequests() incorrectly maintaining selection size on SelectAll. f3d77d8e71b MultiSelect: Box-Select: Further refactor to extra mode code away from multi-select function into box-select funcitons. 907268a4305 MultiSelect: Box-Select: Fixed scrolling on high framerates. 5d9de14493c MultiSelect: Box-Select: Refactor: Renames. 75bac1aac67 MultiSelect: Box-Select: Refactor into its own structure, designed for single-instance but closer to being reusable outside Multi-Select. 15391762ddb MultiSelect: Box-Select: Added ImGuiMultiSelectFlags_BoxSelect2d support. Enabled in Asset Browser. Selectable() supports it. 1ac469b50f5 MultiSelect: Box-Select: Fixed holes when using with clipper (in 1D list.) 7546a2d345c MultiSelect: Demo: Assets Browser: track scrolling target so we can roughly land on hovered item. 750e23998f5 MultiSelect: Demo: Assets Browser: added deletion support. Store ID in selection. Moved QueueDeletion to local var to emphasis that this is a user extension. 51fe0bfcf64 MultiSelect: reworked comments in imgui.h now that we have our own section. 0f633c1d99b MultiSelect: move demo's ExampleSelection to main api as a convenient ImGuiSelectionBasicStorage for basic users. e0282347db7 MultiSelect: remove ImGuiSelectionRequest/ImGuiMultiSelectIO details from public api to reduce confusion + comments. 0af6fbb51d5 MultiSelect: added support for nested/stacked BeginMultiSelect(). b747d6fe591 MultiSelect: Demo: rework and move selection adapter inside ExampleSelection. aa4d64be925 MultiSelect: Box-Select: added scroll support. f904a6646c2 MultiSelect: Box-Select: added support for ImGuiMultiSelectFlags_BoxSelect. 90305c57e43 MultiSelect: (breaking) renamed ImGuiMultiSelectFlags_ClearOnClickWindowVoid -> ImGuiMultiSelectFlags_ClearOnClickVoid. Added ImGuiMultiSelectFlags_ScopeWindow, ImGuiMultiSelectFlags_ScopeRect. bf017954830 Demo: Assets Browser: add hit spacing, requierd for box-select patterns. 3d41994a632 MultiSelect: simplify clearing ImGuiMultiSelectTempData. 33fc61a091e MultiSelect: use a single ImGuiMultiSelectIO buffer. 5941edd9f7c MultiSelect: added support for recovery in ErrorCheckEndWindowRecover(). c527cba4700 MultiSelect: we don't need to ever write to EndIO.RangeSrcItem as this is not meant to be used. 6feff6ff051 MultiSelect: (Breaking) io contains a ImVector<ImGuiSelectionRequest> list. a6adfb2b494 MultiSelect: added missing call on Shutdown(). Better reuse selection buffer. c3998b70ccb MultiSelect: clarified purpose and use of IsItemToggledSelection(). Added assert. Moved to multi-selection section of imgui.h. 2765fdb43ea MultiSelect: removed seemingly unnecessary block in BeginMultiSelect(). 88df5901458 Demo: Assets Browser: store items, sorting, type overlay. d18e57e6732 Demo: Assets Browser: Added assets browser demo. 82de6c470b1 MultiSelect: Added ImGuiMultiSelectFlags_SelectOnClickRelease to allow dragging an unselected item without altering selection + update drag and drop demo. 5628dda5a5c MultiSelect: move shared logic to MultiSelectItemHeader(). 9da4efed2a1 MultiSelect: moved RequestClear output so it'll match request list version better. Use Storage->RangeSrcItem in EndMultiSelect(). a6f43dfadda MultiSelect: ImGuiMultiSelectIO's field are not used during loop anymore, stripping them out of comments. dce02f5c4b0 Demo: Dual List Box: Added a dual list box (6648) ba698df7bbd MultiSelect: Demo: Deletion: Various renames to clarify. Use adapter and item list in both ApplyDeletion functions. e1d21092087 MultiSelect: Demo: Deletion: Rework ApplyDeletionPreLoop to use adapter + fix PostLoop not using right value of RequestFocusItem. fa516c3d765 MultiSelect: Demo: Make ExampleSelection use ImGuiID. More self-explanatory. 530155d85aa MultiSelect: Demo: Remove UserDataToIndex from ExampleSelectionAdapter. 8c1f659b3dc MultiSelect: Demo: rework ExampleSelection with an ExampleSelectionAdapter layer, allowing to share more code accross examples using different storage systems. 8fe6b319528 MultiSelect: (Breaking) Removed RangeSrcPassedBy in favor of favoring user to call IncludeByIndex(RangeSrcItem) which is easier/simpler to honor. 6ddc5f38afa MultiSelect: Demo: added simpler demo using Clipper. Clarify RangeSrcPassedBy doc. c3753809b1d MultiSelect: Demo: rework ExampleSelection names to map better to typical user code + variety of Comments tweaks. ff95fdb668a MultiSelect: (Breaking) RequestSetRange's parameter are RangeFirstItem...RangeLastItem (which was always ordered unlike RangeSrcItem...RangeDstItme). Removed RangeDstItem. Removed RangeDirection. af83a3eea44 MultiSelect: clear selection when leaving a scope with a nav directional request. 6821401a3f0 MultiSelect: Tweak debug log to print decimal+hex values for item data. c9eb3714e8b MultiSelect: move HasSelectionData to ImGuiItemFlags to facilitate copying around in standardized fieds. e82b49d2d46 MultiSelect: (Breaking) Use ImGuiSelectionUserData (= ImS64) instead of void* for selection user data. 140a2f0565b MultiSelect: Comments, tweaks. 847b1dde8c5 MultiSelect: (Breaking) Fix + Rename ImGuiMultiSelectFlags_NoMultiSelect to ImGuiMultiSelectFlags_SingleSelect as it seems easier to grasp. 0cf376348bc MultiSelect: Cleanup unused comments/code. ab9326f4ae9 MultiSelect: Fixed right-click handling in MultiSelectItemFooter() when not focused. e3616e151ff MultiSelect: Demo: Delete items from menu. c0035705cae MultiSelect: Further simplication of user code to support Deletion. df1eeb9a20d MultiSelect: Maintain NavIdSelected for user. Simplify deletion demo. 9223ffc2552 MultiSelect: (Breaking) BeginMultiSelect() doesn't need two last params maintained by users. Moving some storage from user to core. Proper deletion demo. 564dde0ee34 MultiSelect: Demo: first-draft of user-side deletion idioms. 387fc138945 MultiSelect: Clarify and better enforce lifetime of BeginMultiSelect() value. 961b81c3628 MultiSelect: Tidying up/simpllifying MultiSelectItemFooter(). 1ea9ca748cd MultiSelect: Remove the need for using IsItemToggledSelection(). Update comments. 6ef70a97fd4 MultiSelect: Remove ImGuiMultiSelectFlags_NoUnselect because I currently can't find use for this specific design. ccf43d6a964 MultiSelect: (Breaking) Renamed 'RangeValue' -> 'RangeSelected' + amend comments. a83326bc529 MultiSelect: (Breaking) Renamed 'RangeSrc -> 'RangeSrcItem', "RangeDst' -> 'RangeDstItem' a39f9e76614 MultiSelect: Internals rename of IO fields to avoid ambiguity with io/rw concepts + memset constructors, tweaks. c61ada200f9 MultiSelect: Demo tweak. Removed multi-scope from Advanced (too messy), made it a seperate mini-demo. 35b5ebc9b55 MultiSelect: (Breaking) Rename ImGuiMultiSelectData to ImGuiMultiSelectIO. 11bcae1ebd4 MultiSelect: refactor before introducing persistant state pool and to facilitate adding recursion + debug log calls. 5d71314f712 MultiSelect: removed DragDropActive/preserve_existing_selection logic which seems unused + comments. 85954c845e3 MultiSelect: Enter can alter selection if current item is not selected. d2f208a30c4 MultiSelect: made SetNextItemSelectionData() optional to allow disjoint selection (e.g. with a CollapsingHeader between items). Amend demo. 815c61b82eb MultiSelect: Fixed needing to set RangeSrcPassedBy when not using clipper. 78cb1661cb5 MultiSelect: Shallow tweaks/refactors. a05700e3272 MultiSelect: Enter doesn't alter selection (unlike Space). 35bbadcf0c7 MultiSelect: Added ImGuiMultiSelectFlags_ClearOnClickWindowVoid. + Demo: showcase multiple selection scopes in same window. b91ae122e15 MultiSelect: Demo: Added pointer indirection and indent level. 19086c1c489 MultiSelect: Added ImGuiMultiSelectFlags_ClearOnEscape (unsure of best design), expose IsFocused for custom shortcuts. 919cac14829 MultiSelect: Demo: Add a simpler version. ad5d3c9bff8 MultiSelect: Fixed issue with Ctrl+click on TreeNode + amend demo to test drag and drop. b9721c1ed71 MultiSelect: Temporary fix/work-around for child/popup to not inherit MultiSelectEnabled flag, until we make mulit-select data stackable. 00c4b8f2a34 MultiSelect: Fix testing key mods from after the nav request (remove need to hold the mod longer) 3ba3f0d905f MultiSelect: Fix Selectable() ambiguous return value, clarify need to use IsItemToggledSelection(). 0479b188d06 MultiSelect: Comments. Tweak demo. 9aeebd24f77 MultiSelect: Fixed CTRL+A not testing focus scope id. Fixed CTRL+A not testing active id. Added demo code. 7abda179af6 MultiSelect: Fix for TreeNode following merge of 011d4755. Demo: basic test for tree nodes. 9c7183dd048 MultiSelect: Transition to use FocusScope bits merged in master. 4afbfd5e719 MultiSelect: Renamed SetNextItemMultiSelectData() to SetNextItemSelectionUserData() 17c4c2154a1 MultiSelect: Demo sharing selection helper code. Fixed static analyzer warnings. 57da88093f5 MultiSelect: Added IMGUI_HAS_MULTI_SELECT define. Fixed right-click toggling selection without clearing active id, could lead to MarkItemEdited() asserting. Fixed demo. 8947c35fa1e MultiSelect: Removed SelectableSpacing as I'm not sure it is of use for now (history insert) 554db6bc0f3 MultiSelect: WIP range-select (#1861) (rebased six millions times) git-subtree-dir: external/imgui/imgui git-subtree-split: 8199457a7d9e453f8d3d9cadc14683fb54a858b5
This commit is contained in:
231
imgui.h
231
imgui.h
@@ -1,4 +1,4 @@
|
||||
// dear imgui, v1.91.0 WIP
|
||||
// dear imgui, v1.91.0
|
||||
// (headers)
|
||||
|
||||
// Help:
|
||||
@@ -27,8 +27,8 @@
|
||||
|
||||
// Library Version
|
||||
// (Integer encoded as XYYZZ for use in #if preprocessor conditionals, e.g. '#if IMGUI_VERSION_NUM >= 12345')
|
||||
#define IMGUI_VERSION "1.91.0 WIP"
|
||||
#define IMGUI_VERSION_NUM 19095
|
||||
#define IMGUI_VERSION "1.91.0"
|
||||
#define IMGUI_VERSION_NUM 19100
|
||||
#define IMGUI_HAS_TABLE
|
||||
|
||||
/*
|
||||
@@ -44,6 +44,7 @@ Index of this file:
|
||||
// [SECTION] ImGuiIO
|
||||
// [SECTION] Misc data structures (ImGuiInputTextCallbackData, ImGuiSizeCallbackData, ImGuiPayload)
|
||||
// [SECTION] Helpers (ImGuiOnceUponAFrame, ImGuiTextFilter, ImGuiTextBuffer, ImGuiStorage, ImGuiListClipper, Math Operators, ImColor)
|
||||
// [SECTION] Multi-Select API flags and structures (ImGuiMultiSelectFlags, ImGuiMultiSelectIO, ImGuiSelectionRequest, ImGuiSelectionBasicStorage, ImGuiSelectionExternalStorage)
|
||||
// [SECTION] Drawing API (ImDrawCallback, ImDrawCmd, ImDrawIdx, ImDrawVert, ImDrawChannel, ImDrawListSplitter, ImDrawFlags, ImDrawListFlags, ImDrawList, ImDrawData)
|
||||
// [SECTION] Font API (ImFontConfig, ImFontGlyph, ImFontGlyphRangesBuilder, ImFontAtlasFlags, ImFontAtlas, ImFont)
|
||||
// [SECTION] Viewports (ImGuiViewportFlags, ImGuiViewport)
|
||||
@@ -174,9 +175,13 @@ struct ImGuiIO; // Main configuration and I/O between your a
|
||||
struct ImGuiInputTextCallbackData; // Shared state of InputText() when using custom ImGuiInputTextCallback (rare/advanced use)
|
||||
struct ImGuiKeyData; // Storage for ImGuiIO and IsKeyDown(), IsKeyPressed() etc functions.
|
||||
struct ImGuiListClipper; // Helper to manually clip large list of items
|
||||
struct ImGuiMultiSelectIO; // Structure to interact with a BeginMultiSelect()/EndMultiSelect() block
|
||||
struct ImGuiOnceUponAFrame; // Helper for running a block of code not more than once a frame
|
||||
struct ImGuiPayload; // User data payload for drag and drop operations
|
||||
struct ImGuiPlatformImeData; // Platform IME data for io.PlatformSetImeDataFn() function.
|
||||
struct ImGuiSelectionBasicStorage; // Optional helper to store multi-selection state + apply multi-selection requests.
|
||||
struct ImGuiSelectionExternalStorage;//Optional helper to apply multi-selection requests to existing randomly accessible storage.
|
||||
struct ImGuiSelectionRequest; // A selection request (stored in ImGuiMultiSelectIO)
|
||||
struct ImGuiSizeCallbackData; // Callback data when using SetNextWindowSizeConstraints() (rare/advanced use)
|
||||
struct ImGuiStorage; // Helper for key->value storage (container sorted by key)
|
||||
struct ImGuiStoragePair; // Helper for key->value storage (pair)
|
||||
@@ -227,6 +232,7 @@ typedef int ImGuiInputTextFlags; // -> enum ImGuiInputTextFlags_ // Flags: f
|
||||
typedef int ImGuiItemFlags; // -> enum ImGuiItemFlags_ // Flags: for PushItemFlag(), shared by all items
|
||||
typedef int ImGuiKeyChord; // -> ImGuiKey | ImGuiMod_XXX // Flags: for IsKeyChordPressed(), Shortcut() etc. an ImGuiKey optionally OR-ed with one or more ImGuiMod_XXX values.
|
||||
typedef int ImGuiPopupFlags; // -> enum ImGuiPopupFlags_ // Flags: for OpenPopup*(), BeginPopupContext*(), IsPopupOpen()
|
||||
typedef int ImGuiMultiSelectFlags; // -> enum ImGuiMultiSelectFlags_// Flags: for BeginMultiSelect()
|
||||
typedef int ImGuiSelectableFlags; // -> enum ImGuiSelectableFlags_ // Flags: for Selectable()
|
||||
typedef int ImGuiSliderFlags; // -> enum ImGuiSliderFlags_ // Flags: for DragFloat(), DragInt(), SliderFloat(), SliderInt() etc.
|
||||
typedef int ImGuiTabBarFlags; // -> enum ImGuiTabBarFlags_ // Flags: for BeginTabBar()
|
||||
@@ -262,6 +268,11 @@ typedef ImWchar32 ImWchar;
|
||||
typedef ImWchar16 ImWchar;
|
||||
#endif
|
||||
|
||||
// Multi-Selection item index or identifier when using BeginMultiSelect()
|
||||
// - Used by SetNextItemSelectionUserData() + and inside ImGuiMultiSelectIO structure.
|
||||
// - Most users are likely to use this store an item INDEX but this may be used to store a POINTER/ID as well. Read comments near ImGuiMultiSelectIO for details.
|
||||
typedef ImS64 ImGuiSelectionUserData;
|
||||
|
||||
// Callback and functions types
|
||||
typedef int (*ImGuiInputTextCallback)(ImGuiInputTextCallbackData* data); // Callback function for ImGui::InputText()
|
||||
typedef void (*ImGuiSizeCallback)(ImGuiSizeCallbackData* data); // Callback function for ImGui::SetNextWindowSizeConstraints()
|
||||
@@ -381,10 +392,10 @@ namespace ImGui
|
||||
IMGUI_API bool IsWindowFocused(ImGuiFocusedFlags flags=0); // is current window focused? or its root/child, depending on flags. see flags for options.
|
||||
IMGUI_API bool IsWindowHovered(ImGuiHoveredFlags flags=0); // is current window hovered and hoverable (e.g. not blocked by a popup/modal)? See ImGuiHoveredFlags_ for options. IMPORTANT: If you are trying to check whether your mouse should be dispatched to Dear ImGui or to your underlying app, you should not use this function! Use the 'io.WantCaptureMouse' boolean for that! Refer to FAQ entry "How can I tell whether to dispatch mouse/keyboard to Dear ImGui or my application?" for details.
|
||||
IMGUI_API ImDrawList* GetWindowDrawList(); // get draw list associated to the current window, to append your own drawing primitives
|
||||
IMGUI_API ImVec2 GetWindowPos(); // get current window position in screen space (note: it is unlikely you need to use this. Consider using current layout pos instead, GetCursorScreenPos())
|
||||
IMGUI_API ImVec2 GetWindowSize(); // get current window size (note: it is unlikely you need to use this. Consider using GetCursorScreenPos() and e.g. GetContentRegionAvail() instead)
|
||||
IMGUI_API float GetWindowWidth(); // get current window width (shortcut for GetWindowSize().x)
|
||||
IMGUI_API float GetWindowHeight(); // get current window height (shortcut for GetWindowSize().y)
|
||||
IMGUI_API ImVec2 GetWindowPos(); // get current window position in screen space (IT IS UNLIKELY YOU EVER NEED TO USE THIS. Consider always using GetCursorScreenPos() and GetContentRegionAvail() instead)
|
||||
IMGUI_API ImVec2 GetWindowSize(); // get current window size (IT IS UNLIKELY YOU EVER NEED TO USE THIS. Consider always using GetCursorScreenPos() and GetContentRegionAvail() instead)
|
||||
IMGUI_API float GetWindowWidth(); // get current window width (IT IS UNLIKELY YOU EVER NEED TO USE THIS). Shortcut for GetWindowSize().x.
|
||||
IMGUI_API float GetWindowHeight(); // get current window height (IT IS UNLIKELY YOU EVER NEED TO USE THIS). Shortcut for GetWindowSize().y.
|
||||
|
||||
// Window manipulation
|
||||
// - Prefer using SetNextXXX functions (before Begin) rather that SetXXX functions (after Begin).
|
||||
@@ -406,14 +417,6 @@ namespace ImGui
|
||||
IMGUI_API void SetWindowCollapsed(const char* name, bool collapsed, ImGuiCond cond = 0); // set named window collapsed state
|
||||
IMGUI_API void SetWindowFocus(const char* name); // set named window to be focused / top-most. use NULL to remove focus.
|
||||
|
||||
// Content region
|
||||
// - Retrieve available space from a given point. GetContentRegionAvail() is frequently useful.
|
||||
// - Those functions are bound to be redesigned (they are confusing, incomplete and the Min/Max return values are in local window coordinates which increases confusion)
|
||||
IMGUI_API ImVec2 GetContentRegionAvail(); // == GetContentRegionMax() - GetCursorPos()
|
||||
IMGUI_API ImVec2 GetContentRegionMax(); // current content boundaries (typically window boundaries including scrolling, or current column boundaries), in windows coordinates
|
||||
IMGUI_API ImVec2 GetWindowContentRegionMin(); // content boundaries min for the full window (roughly (0,0)-Scroll), in window coordinates
|
||||
IMGUI_API ImVec2 GetWindowContentRegionMax(); // content boundaries max for the full window (roughly (0,0)+Size-Scroll) where Size can be overridden with SetNextWindowContentSize(), in window coordinates
|
||||
|
||||
// Windows Scrolling
|
||||
// - Any change of Scroll will be applied at the beginning of next frame in the first call to Begin().
|
||||
// - You may instead use SetNextWindowScroll() prior to calling Begin() to avoid this delay, as an alternative to using SetScrollX()/SetScrollY().
|
||||
@@ -462,19 +465,22 @@ namespace ImGui
|
||||
// - By "cursor" we mean the current output position.
|
||||
// - The typical widget behavior is to output themselves at the current cursor position, then move the cursor one line down.
|
||||
// - You can call SameLine() between widgets to undo the last carriage return and output at the right of the preceding widget.
|
||||
// - YOU CAN DO 99% OF WHAT YOU NEED WITH ONLY GetCursorScreenPos() and GetContentRegionAvail().
|
||||
// - Attention! We currently have inconsistencies between window-local and absolute positions we will aim to fix with future API:
|
||||
// - Absolute coordinate: GetCursorScreenPos(), SetCursorScreenPos(), all ImDrawList:: functions. -> this is the preferred way forward.
|
||||
// - Window-local coordinates: SameLine(), GetCursorPos(), SetCursorPos(), GetCursorStartPos(), GetContentRegionMax(), GetWindowContentRegion*(), PushTextWrapPos()
|
||||
// - GetCursorScreenPos() = GetCursorPos() + GetWindowPos(). GetWindowPos() is almost only ever useful to convert from window-local to absolute coordinates.
|
||||
IMGUI_API ImVec2 GetCursorScreenPos(); // cursor position in absolute coordinates (prefer using this, also more useful to work with ImDrawList API).
|
||||
IMGUI_API void SetCursorScreenPos(const ImVec2& pos); // cursor position in absolute coordinates
|
||||
IMGUI_API ImVec2 GetCursorPos(); // [window-local] cursor position in window coordinates (relative to window position)
|
||||
// - Window-local coordinates: SameLine(offset), GetCursorPos(), SetCursorPos(), GetCursorStartPos(), PushTextWrapPos()
|
||||
// - Window-local coordinates: GetContentRegionMax(), GetWindowContentRegionMin(), GetWindowContentRegionMax() --> all obsoleted. YOU DON'T NEED THEM.
|
||||
// - GetCursorScreenPos() = GetCursorPos() + GetWindowPos(). GetWindowPos() is almost only ever useful to convert from window-local to absolute coordinates. Try not to use it.
|
||||
IMGUI_API ImVec2 GetCursorScreenPos(); // cursor position, absolute coordinates. THIS IS YOUR BEST FRIEND (prefer using this rather than GetCursorPos(), also more useful to work with ImDrawList API).
|
||||
IMGUI_API void SetCursorScreenPos(const ImVec2& pos); // cursor position, absolute coordinates. THIS IS YOUR BEST FRIEND.
|
||||
IMGUI_API ImVec2 GetContentRegionAvail(); // available space from current position. THIS IS YOUR BEST FRIEND.
|
||||
IMGUI_API ImVec2 GetCursorPos(); // [window-local] cursor position in window-local coordinates. This is not your best friend.
|
||||
IMGUI_API float GetCursorPosX(); // [window-local] "
|
||||
IMGUI_API float GetCursorPosY(); // [window-local] "
|
||||
IMGUI_API void SetCursorPos(const ImVec2& local_pos); // [window-local] "
|
||||
IMGUI_API void SetCursorPosX(float local_x); // [window-local] "
|
||||
IMGUI_API void SetCursorPosY(float local_y); // [window-local] "
|
||||
IMGUI_API ImVec2 GetCursorStartPos(); // [window-local] initial cursor position, in window coordinates
|
||||
IMGUI_API ImVec2 GetCursorStartPos(); // [window-local] initial cursor position, in window-local coordinates. Call GetCursorScreenPos() after Begin() to get the absolute coordinates version.
|
||||
|
||||
// Other layout functions
|
||||
IMGUI_API void Separator(); // separator, generally horizontal. inside a menu bar or in horizontal layout mode, this becomes a vertical separator.
|
||||
@@ -511,6 +517,7 @@ namespace ImGui
|
||||
IMGUI_API ImGuiID GetID(const char* str_id); // calculate unique ID (hash of whole ID stack + given parameter). e.g. if you want to query into ImGuiStorage yourself
|
||||
IMGUI_API ImGuiID GetID(const char* str_id_begin, const char* str_id_end);
|
||||
IMGUI_API ImGuiID GetID(const void* ptr_id);
|
||||
IMGUI_API ImGuiID GetID(int int_id);
|
||||
|
||||
// Widgets: Text
|
||||
IMGUI_API void TextUnformatted(const char* text, const char* text_end = NULL); // raw text without formatting. Roughly equivalent to Text("%s", text) but: A) doesn't require null terminated string if 'text_end' is specified, B) it's faster, no memory copy is done, no buffer size limits, recommended for long chunks of text.
|
||||
@@ -654,6 +661,7 @@ namespace ImGui
|
||||
IMGUI_API bool CollapsingHeader(const char* label, ImGuiTreeNodeFlags flags = 0); // if returning 'true' the header is open. doesn't indent nor push on ID stack. user doesn't have to call TreePop().
|
||||
IMGUI_API bool CollapsingHeader(const char* label, bool* p_visible, ImGuiTreeNodeFlags flags = 0); // when 'p_visible != NULL': if '*p_visible==true' display an additional small close button on upper right of the header which will set the bool to false when clicked, if '*p_visible==false' don't display the header.
|
||||
IMGUI_API void SetNextItemOpen(bool is_open, ImGuiCond cond = 0); // set next TreeNode/CollapsingHeader open state.
|
||||
IMGUI_API void SetNextItemStorageID(ImGuiID storage_id); // set id to use for open/close storage (default to same as item id).
|
||||
|
||||
// Widgets: Selectables
|
||||
// - A selectable highlights when hovered, and can display another color when selected.
|
||||
@@ -661,6 +669,18 @@ namespace ImGui
|
||||
IMGUI_API bool Selectable(const char* label, bool selected = false, ImGuiSelectableFlags flags = 0, const ImVec2& size = ImVec2(0, 0)); // "bool selected" carry the selection state (read-only). Selectable() is clicked is returns true so you can modify your selection state. size.x==0.0: use remaining width, size.x>0.0: specify width. size.y==0.0: use label height, size.y>0.0: specify height
|
||||
IMGUI_API bool Selectable(const char* label, bool* p_selected, ImGuiSelectableFlags flags = 0, const ImVec2& size = ImVec2(0, 0)); // "bool* p_selected" point to the selection state (read-write), as a convenient helper.
|
||||
|
||||
// Multi-selection system for Selectable(), Checkbox(), TreeNode() functions [BETA]
|
||||
// - This enables standard multi-selection/range-selection idioms (CTRL+Mouse/Keyboard, SHIFT+Mouse/Keyboard, etc.) in a way that also allow a clipper to be used.
|
||||
// - ImGuiSelectionUserData is often used to store your item index within the current view (but may store something else).
|
||||
// - Read comments near ImGuiMultiSelectIO for instructions/details and see 'Demo->Widgets->Selection State & Multi-Select' for demo.
|
||||
// - TreeNode() is technically supported but... using this correctly is more complicated. You need some sort of linear/random access to your tree,
|
||||
// which is suited to advanced trees setups already implementing filters and clipper. We will work simplifying the current demo.
|
||||
// - 'selection_size' and 'items_count' parameters are optional and used by a few features. If they are costly for you to compute, you may avoid them.
|
||||
IMGUI_API ImGuiMultiSelectIO* BeginMultiSelect(ImGuiMultiSelectFlags flags, int selection_size = -1, int items_count = -1);
|
||||
IMGUI_API ImGuiMultiSelectIO* EndMultiSelect();
|
||||
IMGUI_API void SetNextItemSelectionUserData(ImGuiSelectionUserData selection_user_data);
|
||||
IMGUI_API bool IsItemToggledSelection(); // Was the last item selection state toggled? Useful if you need the per-item information _before_ reaching EndMultiSelect(). We only returns toggle _event_ in order to handle clipping correctly.
|
||||
|
||||
// Widgets: List Boxes
|
||||
// - This is essentially a thin wrapper to using BeginChild/EndChild with the ImGuiChildFlags_FrameStyle flag for stylistic changes + displaying a label.
|
||||
// - You can submit contents and manage your selection state however you want it, by creating e.g. Selectable() or any other items.
|
||||
@@ -961,6 +981,14 @@ namespace ImGui
|
||||
IMGUI_API bool Shortcut(ImGuiKeyChord key_chord, ImGuiInputFlags flags = 0);
|
||||
IMGUI_API void SetNextItemShortcut(ImGuiKeyChord key_chord, ImGuiInputFlags flags = 0);
|
||||
|
||||
// Inputs Utilities: Key/Input Ownership [BETA]
|
||||
// - One common use case would be to allow your items to disable standard inputs behaviors such
|
||||
// as Tab or Alt key handling, Mouse Wheel scrolling, etc.
|
||||
// e.g. Button(...); SetItemKeyOwner(ImGuiKey_MouseWheelY); to make hovering/activating a button disable wheel for scrolling.
|
||||
// - Reminder ImGuiKey enum include access to mouse buttons and gamepad, so key ownership can apply to them.
|
||||
// - Many related features are still in imgui_internal.h. For instance, most IsKeyXXX()/IsMouseXXX() functions have an owner-id-aware version.
|
||||
IMGUI_API void SetItemKeyOwner(ImGuiKey key); // Set key owner to last item ID if it is hovered or active. Equivalent to 'if (IsItemHovered() || IsItemActive()) { SetKeyOwner(key, GetItemID());'.
|
||||
|
||||
// Inputs Utilities: Mouse specific
|
||||
// - To refer to a mouse button, you may use named enums in your code e.g. ImGuiMouseButton_Left, ImGuiMouseButton_Right.
|
||||
// - You can also use regular integer: it is forever guaranteed that 0=Left, 1=Right, 2=Middle.
|
||||
@@ -1059,7 +1087,7 @@ enum ImGuiWindowFlags_
|
||||
|
||||
// Obsolete names
|
||||
#ifndef IMGUI_DISABLE_OBSOLETE_FUNCTIONS
|
||||
ImGuiWindowFlags_AlwaysUseWindowPadding = 1 << 30, // Obsoleted in 1.90: Use ImGuiChildFlags_AlwaysUseWindowPadding in BeginChild() call.
|
||||
ImGuiWindowFlags_AlwaysUseWindowPadding = 1 << 30, // Obsoleted in 1.90.0: Use ImGuiChildFlags_AlwaysUseWindowPadding in BeginChild() call.
|
||||
ImGuiWindowFlags_NavFlattened = 1 << 31, // Obsoleted in 1.90.9: Use ImGuiChildFlags_NavFlattened in BeginChild() call.
|
||||
#endif
|
||||
};
|
||||
@@ -1084,7 +1112,7 @@ enum ImGuiChildFlags_
|
||||
ImGuiChildFlags_AutoResizeY = 1 << 5, // Enable auto-resizing height. Read "IMPORTANT: Size measurement" details above.
|
||||
ImGuiChildFlags_AlwaysAutoResize = 1 << 6, // Combined with AutoResizeX/AutoResizeY. Always measure size even when child is hidden, always return true, always disable clipping optimization! NOT RECOMMENDED.
|
||||
ImGuiChildFlags_FrameStyle = 1 << 7, // Style the child window like a framed item: use FrameBg, FrameRounding, FrameBorderSize, FramePadding instead of ChildBg, ChildRounding, ChildBorderSize, WindowPadding.
|
||||
ImGuiChildFlags_NavFlattened = 1 << 8, // Share focus scope, allow gamepad/keyboard navigation to cross over parent border to this child or between sibling child windows.
|
||||
ImGuiChildFlags_NavFlattened = 1 << 8, // [BETA] Share focus scope, allow gamepad/keyboard navigation to cross over parent border to this child or between sibling child windows.
|
||||
};
|
||||
|
||||
// Flags for ImGui::PushItemFlag()
|
||||
@@ -1201,6 +1229,7 @@ enum ImGuiSelectableFlags_
|
||||
ImGuiSelectableFlags_AllowDoubleClick = 1 << 2, // Generate press events on double clicks too
|
||||
ImGuiSelectableFlags_Disabled = 1 << 3, // Cannot be selected, display grayed out text
|
||||
ImGuiSelectableFlags_AllowOverlap = 1 << 4, // (WIP) Hit testing to allow subsequent widgets to overlap this one
|
||||
ImGuiSelectableFlags_Highlight = 1 << 5, // Make the item be displayed as if it is hovered
|
||||
|
||||
#ifndef IMGUI_DISABLE_OBSOLETE_FUNCTIONS
|
||||
ImGuiSelectableFlags_DontClosePopups = ImGuiSelectableFlags_NoAutoClosePopups, // Renamed in 1.91.0
|
||||
@@ -1680,6 +1709,7 @@ enum ImGuiStyleVar_
|
||||
ImGuiStyleVar_TabRounding, // float TabRounding
|
||||
ImGuiStyleVar_TabBorderSize, // float TabBorderSize
|
||||
ImGuiStyleVar_TabBarBorderSize, // float TabBarBorderSize
|
||||
ImGuiStyleVar_TabBarOverlineSize, // float TabBarOverlineSize
|
||||
ImGuiStyleVar_TableAngledHeadersAngle, // float TableAngledHeadersAngle
|
||||
ImGuiStyleVar_TableAngledHeadersTextAlign,// ImVec2 TableAngledHeadersTextAlign
|
||||
ImGuiStyleVar_ButtonTextAlign, // ImVec2 ButtonTextAlign
|
||||
@@ -2123,12 +2153,13 @@ struct ImGuiStyle
|
||||
float TabBorderSize; // Thickness of border around tabs.
|
||||
float TabMinWidthForCloseButton; // Minimum width for close button to appear on an unselected tab when hovered. Set to 0.0f to always show when hovering, set to FLT_MAX to never show close button unless selected.
|
||||
float TabBarBorderSize; // Thickness of tab-bar separator, which takes on the tab active color to denote focus.
|
||||
float TabBarOverlineSize; // Thickness of tab-bar overline, which highlights the selected tab-bar.
|
||||
float TableAngledHeadersAngle; // Angle of angled headers (supported values range from -50.0f degrees to +50.0f degrees).
|
||||
ImVec2 TableAngledHeadersTextAlign;// Alignment of angled headers within the cell
|
||||
ImGuiDir ColorButtonPosition; // Side of the color button in the ColorEdit4 widget (left/right). Defaults to ImGuiDir_Right.
|
||||
ImVec2 ButtonTextAlign; // Alignment of button text when button is larger than text. Defaults to (0.5f, 0.5f) (centered).
|
||||
ImVec2 SelectableTextAlign; // Alignment of selectable text. Defaults to (0.0f, 0.0f) (top-left aligned). It's generally important to keep this left-aligned if you want to lay multiple items on a same line.
|
||||
float SeparatorTextBorderSize; // Thickkness of border in SeparatorText()
|
||||
float SeparatorTextBorderSize; // Thickness of border in SeparatorText()
|
||||
ImVec2 SeparatorTextAlign; // Alignment of text within the separator. Defaults to (0.0f, 0.5f) (left aligned, center).
|
||||
ImVec2 SeparatorTextPadding; // Horizontal offset of text from each edge of the separator + spacing on other axis. Generally small values. .y is recommended to be == FramePadding.y.
|
||||
ImVec2 DisplayWindowPadding; // Apply to regular windows: amount which we enforce to keep visible when moving near edges of your screen.
|
||||
@@ -2197,6 +2228,7 @@ struct ImGuiIO
|
||||
// Miscellaneous options
|
||||
bool MouseDrawCursor; // = false // Request ImGui to draw a mouse cursor for you (if you are on a platform without a mouse cursor). Cannot be easily renamed to 'io.ConfigXXX' because this is frequently used by backend implementations.
|
||||
bool ConfigMacOSXBehaviors; // = defined(__APPLE__) // Swap Cmd<>Ctrl keys + OS X style text editing cursor movement using Alt instead of Ctrl, Shortcuts using Cmd/Super instead of Ctrl, Line/Text Start and End using Cmd+Arrows instead of Home/End, Double click selects by word instead of selecting whole text, Multi-selection in lists uses Cmd/Super instead of Ctrl.
|
||||
bool ConfigNavSwapGamepadButtons; // = false // Swap Activate<>Cancel (A<>B) buttons, matching typical "Nintendo/Japanese style" gamepad layout.
|
||||
bool ConfigInputTrickleEventQueue; // = true // Enable input queue trickling: some types of events submitted during the same frame (e.g. button down + up) will be spread over multiple frames, improving interactions with low framerates.
|
||||
bool ConfigInputTextCursorBlink; // = true // Enable blinking cursor (optional as some users consider it to be distracting).
|
||||
bool ConfigInputTextEnterKeepActive; // = false // [BETA] Pressing Enter will keep item active and select contents (single-line only).
|
||||
@@ -2702,6 +2734,154 @@ struct ImColor
|
||||
static ImColor HSV(float h, float s, float v, float a = 1.0f) { float r, g, b; ImGui::ColorConvertHSVtoRGB(h, s, v, r, g, b); return ImColor(r, g, b, a); }
|
||||
};
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// [SECTION] Multi-Select API flags and structures (ImGuiMultiSelectFlags, ImGuiSelectionRequestType, ImGuiSelectionRequest, ImGuiMultiSelectIO, ImGuiSelectionBasicStorage)
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
// Multi-selection system
|
||||
// Documentation at: https://github.com/ocornut/imgui/wiki/Multi-Select
|
||||
// - Refer to 'Demo->Widgets->Selection State & Multi-Select' for demos using this.
|
||||
// - This system implements standard multi-selection idioms (CTRL+Mouse/Keyboard, SHIFT+Mouse/Keyboard, etc)
|
||||
// with support for clipper (skipping non-visible items), box-select and many other details.
|
||||
// - Selectable(), Checkbox() are supported but custom widgets may use it as well.
|
||||
// - TreeNode() is technically supported but... using this correctly is more complicated: you need some sort of linear/random access to your tree,
|
||||
// which is suited to advanced trees setups also implementing filters and clipper. We will work toward simplifying and demoing it.
|
||||
// - In the spirit of Dear ImGui design, your code owns actual selection data.
|
||||
// This is designed to allow all kinds of selection storage you may use in your application e.g. set/map/hash.
|
||||
// About ImGuiSelectionBasicStorage:
|
||||
// - This is an optional helper to store a selection state and apply selection requests.
|
||||
// - It is used by our demos and provided as a convenience to quickly implement multi-selection.
|
||||
// Usage:
|
||||
// - Identify submitted items with SetNextItemSelectionUserData(), most likely using an index into your current data-set.
|
||||
// - Store and maintain actual selection data using persistent object identifiers.
|
||||
// - Usage flow:
|
||||
// BEGIN - (1) Call BeginMultiSelect() and retrieve the ImGuiMultiSelectIO* result.
|
||||
// - (2) Honor request list (SetAll/SetRange requests) by updating your selection data. Same code as Step 6.
|
||||
// - (3) [If using clipper] You need to make sure RangeSrcItem is always submitted. Calculate its index and pass to clipper.IncludeItemByIndex(). If storing indices in ImGuiSelectionUserData, a simple clipper.IncludeItemByIndex(ms_io->RangeSrcItem) call will work.
|
||||
// LOOP - (4) Submit your items with SetNextItemSelectionUserData() + Selectable()/TreeNode() calls.
|
||||
// END - (5) Call EndMultiSelect() and retrieve the ImGuiMultiSelectIO* result.
|
||||
// - (6) Honor request list (SetAll/SetRange requests) by updating your selection data. Same code as Step 2.
|
||||
// If you submit all items (no clipper), Step 2 and 3 are optional and will be handled by each item themselves. It is fine to always honor those steps.
|
||||
// About ImGuiSelectionUserData:
|
||||
// - This can store an application-defined identifier (e.g. index or pointer) submitted via SetNextItemSelectionUserData().
|
||||
// - In return we store them into RangeSrcItem/RangeFirstItem/RangeLastItem and other fields in ImGuiMultiSelectIO.
|
||||
// - Most applications will store an object INDEX, hence the chosen name and type. Storing an index is natural, because
|
||||
// SetRange requests will give you two end-points and you will need to iterate/interpolate between them to update your selection.
|
||||
// - However it is perfectly possible to store a POINTER or another IDENTIFIER inside ImGuiSelectionUserData.
|
||||
// Our system never assume that you identify items by indices, it never attempts to interpolate between two values.
|
||||
// - If you enable ImGuiMultiSelectFlags_NoRangeSelect then it is guaranteed that you will never have to interpolate
|
||||
// between two ImGuiSelectionUserData, which may be a convenient way to use part of the feature with less code work.
|
||||
// - As most users will want to store an index, for convenience and to reduce confusion we use ImS64 instead of void*,
|
||||
// being syntactically easier to downcast. Feel free to reinterpret_cast and store a pointer inside.
|
||||
|
||||
// Flags for BeginMultiSelect()
|
||||
enum ImGuiMultiSelectFlags_
|
||||
{
|
||||
ImGuiMultiSelectFlags_None = 0,
|
||||
ImGuiMultiSelectFlags_SingleSelect = 1 << 0, // Disable selecting more than one item. This is available to allow single-selection code to share same code/logic if desired. It essentially disables the main purpose of BeginMultiSelect() tho!
|
||||
ImGuiMultiSelectFlags_NoSelectAll = 1 << 1, // Disable CTRL+A shortcut to select all.
|
||||
ImGuiMultiSelectFlags_NoRangeSelect = 1 << 2, // Disable Shift+selection mouse/keyboard support (useful for unordered 2D selection). With BoxSelect is also ensure contiguous SetRange requests are not combined into one. This allows not handling interpolation in SetRange requests.
|
||||
ImGuiMultiSelectFlags_NoAutoSelect = 1 << 3, // Disable selecting items when navigating (useful for e.g. supporting range-select in a list of checkboxes).
|
||||
ImGuiMultiSelectFlags_NoAutoClear = 1 << 4, // Disable clearing selection when navigating or selecting another one (generally used with ImGuiMultiSelectFlags_NoAutoSelect. useful for e.g. supporting range-select in a list of checkboxes).
|
||||
ImGuiMultiSelectFlags_NoAutoClearOnReselect = 1 << 5, // Disable clearing selection when clicking/selecting an already selected item.
|
||||
ImGuiMultiSelectFlags_BoxSelect1d = 1 << 6, // Enable box-selection with same width and same x pos items (e.g. full row Selectable()). Box-selection works better with little bit of spacing between items hit-box in order to be able to aim at empty space.
|
||||
ImGuiMultiSelectFlags_BoxSelect2d = 1 << 7, // Enable box-selection with varying width or varying x pos items support (e.g. different width labels, or 2D layout/grid). This is slower: alters clipping logic so that e.g. horizontal movements will update selection of normally clipped items.
|
||||
ImGuiMultiSelectFlags_BoxSelectNoScroll = 1 << 8, // Disable scrolling when box-selecting near edges of scope.
|
||||
ImGuiMultiSelectFlags_ClearOnEscape = 1 << 9, // Clear selection when pressing Escape while scope is focused.
|
||||
ImGuiMultiSelectFlags_ClearOnClickVoid = 1 << 10, // Clear selection when clicking on empty location within scope.
|
||||
ImGuiMultiSelectFlags_ScopeWindow = 1 << 11, // Scope for _BoxSelect and _ClearOnClickVoid is whole window (Default). Use if BeginMultiSelect() covers a whole window or used a single time in same window.
|
||||
ImGuiMultiSelectFlags_ScopeRect = 1 << 12, // Scope for _BoxSelect and _ClearOnClickVoid is rectangle encompassing BeginMultiSelect()/EndMultiSelect(). Use if BeginMultiSelect() is called multiple times in same window.
|
||||
ImGuiMultiSelectFlags_SelectOnClick = 1 << 13, // Apply selection on mouse down when clicking on unselected item. (Default)
|
||||
ImGuiMultiSelectFlags_SelectOnClickRelease = 1 << 14, // Apply selection on mouse release when clicking an unselected item. Allow dragging an unselected item without altering selection.
|
||||
//ImGuiMultiSelectFlags_RangeSelect2d = 1 << 15, // Shift+Selection uses 2d geometry instead of linear sequence, so possible to use Shift+up/down to select vertically in grid. Analogous to what BoxSelect does.
|
||||
ImGuiMultiSelectFlags_NavWrapX = 1 << 16, // [Temporary] Enable navigation wrapping on X axis. Provided as a convenience because we don't have a design for the general Nav API for this yet. When the more general feature be public we may obsolete this flag in favor of new one.
|
||||
};
|
||||
|
||||
// Main IO structure returned by BeginMultiSelect()/EndMultiSelect().
|
||||
// This mainly contains a list of selection requests.
|
||||
// - Use 'Demo->Tools->Debug Log->Selection' to see requests as they happen.
|
||||
// - Some fields are only useful if your list is dynamic and allows deletion (getting post-deletion focus/state right is shown in the demo)
|
||||
// - Below: who reads/writes each fields? 'r'=read, 'w'=write, 'ms'=multi-select code, 'app'=application/user code.
|
||||
struct ImGuiMultiSelectIO
|
||||
{
|
||||
//------------------------------------------// BeginMultiSelect / EndMultiSelect
|
||||
ImVector<ImGuiSelectionRequest> Requests; // ms:w, app:r / ms:w app:r // Requests to apply to your selection data.
|
||||
ImGuiSelectionUserData RangeSrcItem; // ms:w app:r / // (If using clipper) Begin: Source item (often the first selected item) must never be clipped: use clipper.IncludeItemByIndex() to ensure it is submitted.
|
||||
ImGuiSelectionUserData NavIdItem; // ms:w, app:r / // (If using deletion) Last known SetNextItemSelectionUserData() value for NavId (if part of submitted items).
|
||||
bool NavIdSelected; // ms:w, app:r / app:r // (If using deletion) Last known selection state for NavId (if part of submitted items).
|
||||
bool RangeSrcReset; // app:w / ms:r // (If using deletion) Set before EndMultiSelect() to reset ResetSrcItem (e.g. if deleted selection).
|
||||
int ItemsCount; // ms:w, app:r / app:r // 'int items_count' parameter to BeginMultiSelect() is copied here for convenience, allowing simpler calls to your ApplyRequests handler. Not used internally.
|
||||
};
|
||||
|
||||
// Selection request type
|
||||
enum ImGuiSelectionRequestType
|
||||
{
|
||||
ImGuiSelectionRequestType_None = 0,
|
||||
ImGuiSelectionRequestType_SetAll, // Request app to clear selection (if Selected==false) or select all items (if Selected==true). We cannot set RangeFirstItem/RangeLastItem as its contents is entirely up to user (not necessarily an index)
|
||||
ImGuiSelectionRequestType_SetRange, // Request app to select/unselect [RangeFirstItem..RangeLastItem] items (inclusive) based on value of Selected. Only EndMultiSelect() request this, app code can read after BeginMultiSelect() and it will always be false.
|
||||
};
|
||||
|
||||
// Selection request item
|
||||
struct ImGuiSelectionRequest
|
||||
{
|
||||
//------------------------------------------// BeginMultiSelect / EndMultiSelect
|
||||
ImGuiSelectionRequestType Type; // ms:w, app:r / ms:w, app:r // Request type. You'll most often receive 1 Clear + 1 SetRange with a single-item range.
|
||||
bool Selected; // ms:w, app:r / ms:w, app:r // Parameter for SetAll/SetRange requests (true = select, false = unselect)
|
||||
ImS8 RangeDirection; // / ms:w app:r // Parameter for SetRange request: +1 when RangeFirstItem comes before RangeLastItem, -1 otherwise. Useful if you want to preserve selection order on a backward Shift+Click.
|
||||
ImGuiSelectionUserData RangeFirstItem; // / ms:w, app:r // Parameter for SetRange request (this is generally == RangeSrcItem when shift selecting from top to bottom).
|
||||
ImGuiSelectionUserData RangeLastItem; // / ms:w, app:r // Parameter for SetRange request (this is generally == RangeSrcItem when shift selecting from bottom to top). Inclusive!
|
||||
};
|
||||
|
||||
// Optional helper to store multi-selection state + apply multi-selection requests.
|
||||
// - Used by our demos and provided as a convenience to easily implement basic multi-selection.
|
||||
// - Iterate selection with 'void* it = NULL; ImGuiID id; while (selection.GetNextSelectedItem(&it, &id)) { ... }'
|
||||
// Or you can check 'if (Contains(id)) { ... }' for each possible object if their number is not too high to iterate.
|
||||
// - USING THIS IS NOT MANDATORY. This is only a helper and not a required API.
|
||||
// To store a multi-selection, in your application you could:
|
||||
// - Use this helper as a convenience. We use our simple key->value ImGuiStorage as a std::set<ImGuiID> replacement.
|
||||
// - Use your own external storage: e.g. std::set<MyObjectId>, std::vector<MyObjectId>, interval trees, intrusively stored selection etc.
|
||||
// In ImGuiSelectionBasicStorage we:
|
||||
// - always use indices in the multi-selection API (passed to SetNextItemSelectionUserData(), retrieved in ImGuiMultiSelectIO)
|
||||
// - use the AdapterIndexToStorageId() indirection layer to abstract how persistent selection data is derived from an index.
|
||||
// - use decently optimized logic to allow queries and insertion of very large selection sets.
|
||||
// - do not preserve selection order.
|
||||
// Many combinations are possible depending on how you prefer to store your items and how you prefer to store your selection.
|
||||
// Large applications are likely to eventually want to get rid of this indirection layer and do their own thing.
|
||||
// See https://github.com/ocornut/imgui/wiki/Multi-Select for details and pseudo-code using this helper.
|
||||
struct ImGuiSelectionBasicStorage
|
||||
{
|
||||
// Members
|
||||
int Size; // // Number of selected items, maintained by this helper.
|
||||
bool PreserveOrder; // = false // GetNextSelectedItem() will return ordered selection (currently implemented by two additional sorts of selection. Could be improved)
|
||||
void* UserData; // = NULL // User data for use by adapter function // e.g. selection.UserData = (void*)my_items;
|
||||
ImGuiID (*AdapterIndexToStorageId)(ImGuiSelectionBasicStorage* self, int idx); // e.g. selection.AdapterIndexToStorageId = [](ImGuiSelectionBasicStorage* self, int idx) { return ((MyItems**)self->UserData)[idx]->ID; };
|
||||
int _SelectionOrder;// [Internal] Increasing counter to store selection order
|
||||
ImGuiStorage _Storage; // [Internal] Selection set. Think of this as similar to e.g. std::set<ImGuiID>. Prefer not accessing directly: iterate with GetNextSelectedItem().
|
||||
|
||||
// Methods
|
||||
ImGuiSelectionBasicStorage();
|
||||
IMGUI_API void ApplyRequests(ImGuiMultiSelectIO* ms_io); // Apply selection requests coming from BeginMultiSelect() and EndMultiSelect() functions. It uses 'items_count' passed to BeginMultiSelect()
|
||||
IMGUI_API bool Contains(ImGuiID id) const; // Query if an item id is in selection.
|
||||
IMGUI_API void Clear(); // Clear selection
|
||||
IMGUI_API void Swap(ImGuiSelectionBasicStorage& r); // Swap two selections
|
||||
IMGUI_API void SetItemSelected(ImGuiID id, bool selected); // Add/remove an item from selection (generally done by ApplyRequests() function)
|
||||
IMGUI_API bool GetNextSelectedItem(void** opaque_it, ImGuiID* out_id); // Iterate selection with 'void* it = NULL; ImGuiId id; while (selection.GetNextSelectedItem(&it, &id)) { ... }'
|
||||
inline ImGuiID GetStorageIdFromIndex(int idx) { return AdapterIndexToStorageId(this, idx); } // Convert index to item id based on provided adapter.
|
||||
};
|
||||
|
||||
// Optional helper to apply multi-selection requests to existing randomly accessible storage.
|
||||
// Convenient if you want to quickly wire multi-select API on e.g. an array of bool or items storing their own selection state.
|
||||
struct ImGuiSelectionExternalStorage
|
||||
{
|
||||
// Members
|
||||
void* UserData; // User data for use by adapter function // e.g. selection.UserData = (void*)my_items;
|
||||
void (*AdapterSetItemSelected)(ImGuiSelectionExternalStorage* self, int idx, bool selected); // e.g. AdapterSetItemSelected = [](ImGuiSelectionExternalStorage* self, int idx, bool selected) { ((MyItems**)self->UserData)[idx]->Selected = selected; }
|
||||
|
||||
// Methods
|
||||
IMGUI_API ImGuiSelectionExternalStorage();
|
||||
IMGUI_API void ApplyRequests(ImGuiMultiSelectIO* ms_io); // Apply selection requests by using AdapterSetItemSelected() calls
|
||||
};
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// [SECTION] Drawing API (ImDrawCmd, ImDrawIdx, ImDrawVert, ImDrawChannel, ImDrawListSplitter, ImDrawListFlags, ImDrawList, ImDrawData)
|
||||
// Hold a series of drawing commands. The user provides a renderer for ImDrawData which essentially contains an array of ImDrawList.
|
||||
@@ -3323,6 +3503,9 @@ namespace ImGui
|
||||
static inline void PopButtonRepeat() { PopItemFlag(); }
|
||||
static inline void PushTabStop(bool tab_stop) { PushItemFlag(ImGuiItemFlags_NoTabStop, !tab_stop); }
|
||||
static inline void PopTabStop() { PopItemFlag(); }
|
||||
IMGUI_API ImVec2 GetContentRegionMax(); // Content boundaries max (e.g. window boundaries including scrolling, or current column boundaries). You should never need this. Always use GetCursorScreenPos() and GetContentRegionAvail()!
|
||||
IMGUI_API ImVec2 GetWindowContentRegionMin(); // Content boundaries min for the window (roughly (0,0)-Scroll), in window-local coordinates. You should never need this. Always use GetCursorScreenPos() and GetContentRegionAvail()!
|
||||
IMGUI_API ImVec2 GetWindowContentRegionMax(); // Content boundaries max for the window (roughly (0,0)+Size-Scroll), in window-local coordinates. You should never need this. Always use GetCursorScreenPos() and GetContentRegionAvail()!
|
||||
// OBSOLETED in 1.90.0 (from September 2023)
|
||||
static inline bool BeginChildFrame(ImGuiID id, const ImVec2& size, ImGuiWindowFlags window_flags = 0) { return BeginChild(id, size, ImGuiChildFlags_FrameStyle, window_flags); }
|
||||
static inline void EndChildFrame() { EndChild(); }
|
||||
|
||||
Reference in New Issue
Block a user