Commit Graph

1569 Commits

Author SHA1 Message Date
ocornut
fa2e5710ac MenuBar: Fixed an issue where layouting an item in the menu-bar would erroneously egister contents size. (#6789)
In dire need of removing BeginGroup()/EndGroup() from menu-bar code, fo r sanity.
2023-09-06 15:35:03 +02:00
ocornut
fb9b006865 Version 1.90 WIP 2023-09-05 16:46:52 +02:00
ocornut
fef3389157 Version 1.89.9 2023-09-04 14:30:32 +02:00
ocornut
7b5fb33296 Tables: Internals: renamed CellPaddingY to RowCellPaddingY. 2023-09-04 12:14:41 +02:00
ocornut
e8a5c9e1b8 Tables: Made it possible to change style.CellPadding.y between rows. Added demo. 2023-09-04 11:23:54 +02:00
ocornut
f93d0befaf Slider: fixed support for ImGuiItemFlags_ReadOnly/ImGuiSliderFlags_ReadOnly although it is technically unused/undocumented. (#6758)
Amend fdc526e8f
2023-08-29 12:19:15 +02:00
ocornut
33ea1e8b78 ColorEdit, ColorPicker: Manipulating options popup don't mark item as edited. (#6722) 2023-08-28 10:38:13 +02:00
ocornut
ba1fa904a9 IO: Exposed io.PlatformLocaleDecimalPoint to configure decimal point ('.' or ','). (#6719, #2278)
Amend 13f718337
2023-08-17 13:12:21 +02:00
ocornut
1362fc0c56 Debug, Internals: Added DebugDrawCursorPos(), DebugDrawLineExtents() helpers. 2023-08-09 11:14:44 +02:00
ocornut
bc3c0ce772 Nav, TreeNode: Pressing Left with ImGuiTreeNodeFlags_NavLeftJumpsBackHere now goes through proper navigation logic: honor scrolling and selection. (#1079, #1131)
Added a stack for this purpose which other features might build on (e.g. #2920). However this is currently gated by many tests and not a performance concern, but making stack happen all the time may be undesirable.
2023-08-08 14:07:00 +02:00
ocornut
cf3726bcbc Internals: rename bg/fg drawlist holders in structs to reduce confusion. 2023-08-06 19:46:27 +02:00
ocornut
d6d94d90bf Version 1.89.9 WIP
+ Minor typo fixes
2023-08-03 19:19:21 +02:00
ocornut
f7eea63872 Version v1.89.8 2023-08-01 12:53:57 +02:00
ocornut
52125a54a5 Tables: added TableGetHoveredRow() in imgui_internal.h. (#6250, #6347, #6588, #3740)
Works with one-frame delay inconsistent with other functions, may be too bug-prone.
2023-07-13 19:23:48 +02:00
ocornut
dbeeeae593 ImDrawData: Slight refactor so internal logic uses same logic as AddDrawList(). (#6406, #4879, #1878)
# Conflicts:
#	imgui.cpp
#	imgui_internal.h
2023-07-12 18:11:42 +02:00
ocornut
c649aca20a ImDrawData: changed CmdLists from raw array to ImVector<> owned by ImDrawData itself. Faclitate user-manipulation of the array (#6406, #4879, #1878) + deep swap. (#6597, #6475, #6167, #5776, #5109, #4763, #3515, #1860)
+ Metrics: avoid misleadingly iterating all layers of DrawDataBuilder as everything is flattened into Layers[0] at this point.

# Conflicts:
#	imgui.cpp
#	imgui_internal.h
2023-07-12 18:11:42 +02:00
ocornut
cc4c37dbac Nav: PageUp/PageDown always set NavJustMovedTo even when landing on same spot (which can trigger a selection).
This is mostly expected for range-select.
+ Rename ImGuiNavMoveFlags_Tabbing -> ImGuiNavMoveFlags_IsTabbing
2023-07-11 16:49:26 +02:00
ocornut
3fe4319314 Version 1.89.8 WIP 2023-07-05 14:17:46 +02:00
ocornut
cb9015e254 Version 1.89.7 2023-07-04 14:56:09 +02:00
ocornut
1029f57b8a Inputs, Tooltip: Rework stationary timer logic as it broke on high-framerates with lower rate of mouse inputs. (#1485) 2023-07-03 12:17:46 +02:00
ocornut
4dee919bc0 (Breaking) Internals: added ImGuiItemFlags param to ItemHoverable(), so it can be called from ButtonBehavior() not following an ItemAdd().
This also allow moving AllowOverlap logic from ButtonBehavior() to ItemHoverable(), allowing other widgets to honor it. (#6512, #3909, #517)
2023-06-28 14:42:14 +02:00
ocornut
8439a73645 Overlap: Added 'SetNextItemAllowOverlap()' as a replacement for 'SetItemAllowOverlap()'. (#6512, #3909, #517)
# Conflicts:
#	imgui.cpp
#	imgui_widgets.cpp
2023-06-28 14:40:47 +02:00
ocornut
a9a5cbf431 Overlap: Internals: add NextItemData.ItemFlags to facilitate implementation of SetNextItemAllowOverlap() + potentially remove extra_flags from ItemAdd(). (#6512, #3909) 2023-06-28 14:40:47 +02:00
ocornut
51f564eea6 (Breaking) Overlap: Renamed 'ImGuiTreeNodeFlags_AllowItemOverlap' to 'ImGuiTreeNodeFlags_AllowOverlap', 'ImGuiSelectableFlags_AllowItemOverlap' to 'ImGuiSelectableFlags_AllowOverlap'. Kept redirecting enums (will obsolete). (#6512, #3909, #517)
+ Internals: Renamed 'ImGuiButtonFlags_AllowItemOverlap' to 'ImGuiButtonFlags_AllowOverlap' without redirection.
2023-06-28 14:37:05 +02:00
ocornut
9214c28aad IsWindowHovered, IsItemHovered: Assert when passed any unsupported flags. 2023-06-20 15:04:15 +02:00
ocornut
e7a4327eb8 IsWindowHovered: Added support for ImGuiHoveredFlags_Stationary. 2023-06-20 15:04:14 +02:00
ocornut
b3b8cbd001 IsItemHovered, Tooltips: Added ImGuiHoveredFlags_ForTooltip, ImGuiHoveredFlags_Stationary. (#1485)
Update demo accordingly.
2023-06-20 15:04:14 +02:00
ocornut
d96bbf0aae TreeNode: Added undocumented ImGuiTreeNodeFlags_UpsideDownArrow flag. (#6517)
+ Minor tweak comment/layout in ImGuiIO
2023-06-19 14:33:23 +02:00
ocornut
194916135a Internals: renamed HoverDelay fields. 2023-06-16 16:56:33 +02:00
ocornut
15d74bad1d Internals: Tooltips: renamed internal flags (expecting to expose later when we publish priority stuff). 2023-06-16 16:55:51 +02:00
ocornut
eec344cc1e Tweak HoverDelayClearTimer. Not exposing since I am unsure logic is viable (and is rather complex with upcoming addition of stationary logic). (#1485)
+ Tweaked default value of io.HoverDelayNormal from 0.30 to 0.35.
2023-06-14 18:29:49 +02:00
ocornut
6cabad6e7a Encode version string in binary to facilitate identification when demo/tools are striped + amend About window. 2023-06-14 16:18:40 +02:00
ocornut
956a1a17fb Internals: add ImGuiNavMoveFlags_NoSelect and use in FocusItem().
(amend 31f11cf which broke raage-select)
2023-06-01 15:50:14 +02:00
ocornut
31f11cf304 Internals: Added FocusItem(). Made activation explicit/opt-in via ImGuiNavMoveFlags_Activate. Rename ActivateItem() to ActivateItemByID(). 2023-06-01 15:35:01 +02:00
ocornut
61ebb37843 Version 1.89.7 WIP 2023-06-01 11:22:43 +02:00
ocornut
5319d1cffa Version 1.89.6 2023-05-31 14:47:32 +02:00
ocornut
47579f8a40 Nav: set NavJustMovedToXXX fields on NavInit result + BeginChild() clears ActiveId on N+1 on entering instead of waiting for ID to elapse on N+2.
# Conflicts:
#	imgui_internal.h
2023-05-23 16:28:53 +02:00
ocornut
45c8c3b611 Listbox: commented out obsolete/redirecting functions that were marked obsolete more than two years ago: ListBoxHeader(), ListBoxFooter().
+ Added default parameter to SeparatorEx() amend 2c558d5
2023-05-22 10:09:20 +02:00
ocornut
df8667b18b Comments/typos tweaks 2023-05-20 18:07:31 +02:00
ocornut
2c558d5741 Internals: SeparatorEx(): expose thickness + add misc comments relating to Separators. 2023-05-20 16:25:14 +02:00
GamingMinds-DanielC
e489e40a85 Clipper: Amend ecb0aaa (#6424, #3841) 2023-05-15 14:06:16 +02:00
ocornut
bcfc1ad8f6 Nav: Forwarded (wrap/loop) request don't mistakenly wreck reference pos.
Amend 6656553
2023-05-10 15:22:17 +02:00
ocornut
6656553fa4 Nav: Record/restore preferred position on each given axis.
Tagging #6344 #6003 #2694 #1688 as it relates to scoring, however this doesn't technically fix any of them fully yet.
But e.g. once we restore axial path for #2694 this commit will allow going back and forth to initial location.
2023-05-09 17:26:27 +02:00
ocornut
eed7b0e9c5 Nav: remove other-axis clamping, now that columns themselves are clamped. (#2221)
Amend 00d3f92 + older f2d14724, 0cc20fca8
+ Add ImGuiNavMoveFlags_WrapMask_ for good measure.
2023-04-24 20:04:05 +02:00
ocornut
01ca196530 Focus: move focused child restore code in FocusWindow() with ImGuiFocusRequestFlags_RestoreFocusedChild flag. (#6357)
# Conflicts:
#	imgui.cpp
2023-04-21 19:07:08 +02:00
ocornut
30eceaf95f Focus: start moving modal check into FocusWindow(), add ImGuiFocusRequestFlags_UnlessBelowModal (currently opt-in, should try to make opt-out). (#6357, #4317) 2023-04-21 19:06:11 +02:00
ocornut
f0fe1957a8 Focus: merge extra param for FocusTopMostWindowUnderOne() from docking branch to facilitate merge. 2023-04-21 19:05:58 +02:00
ocornut
00d3f9295e Nav: Fixed navigation within tables/columns where item boundaries goes beyond columns limits. (#2221) 2023-04-20 16:42:52 +02:00
ocornut
8d9e50c807 Nav: fixed IMGUI_DEBUG_NAV_SCORING not setting NavMoveClipDir, leading to debug result not matching real results. 2023-04-20 16:04:05 +02:00
ocornut
064153fca4 Version 1.89.6 WIP 2023-04-17 14:40:00 +02:00
ocornut
1ebb913827 Version 1.89.5 2023-04-13 16:17:49 +02:00
ocornut
995f92a456 Nav: Made PageUp/PageDown/Home/End navigation also scroll parent windows.
+ Added ImGuiDebugLogFlags_EventSelection unused in this branch.
2023-04-12 21:38:47 +02:00
ocornut
18d72a9142 Inputs: added a unique event identifier in ImGuiInputEvent. 2023-04-11 15:07:42 +02:00
ocornut
a16f99c6a2 IO: Added io.AddMouseSourceEvent() and ImGuiMouseSource enum. (#2702, #2334, #2372, #3453, #5693) 2023-04-04 20:18:57 +02:00
ocornut
5f301914a0 TabBar: Tab-bars with ImGuiTabBarFlags_FittingPolicyScroll can be scrolled with horizontal mouse-wheel (or Shift + WheelY). (#2702) 2023-03-29 17:10:03 +02:00
ocornut
89d09070e3 Nav: Made Ctrl+Tab/Ctrl+Shift+Tab windowing register ownership to held modifier. (#4828, #3255, #5641) 2023-03-22 15:42:14 +01:00
ocornut
e55a0ef107 IO: avoid changing context in AddKeyAnalogEvent(). Amend 7269498. (#6199, #6256, #4921, #5856) 2023-03-21 14:32:37 +01:00
ocornut
5a2b1e8482 InputText: Fixed a tricky edge case, ensuring value is always written back on the frame where IsItemDeactivated() returns true (#4714)
Altered ItemAdd() clipping rule to keep previous-frame ActiveId unclipped to support that late commit.

Also, MarkItemEdited() may in theory need to do:
if (g.ActiveIdPreviousFrame == id)
        g.ActiveIdPreviousFrameHasBeenEditedBefore = true;
But this should already be set so not adding now.
2023-03-16 21:12:57 +01:00
ocornut
314e6443c9 Internals: removed ImGuiInputSource_Nav enum,
Essentially finishing the work of removing Nav a dual input source (with e.g. removal of NavInput[]).
2023-03-16 20:28:05 +01:00
ocornut
24a44b9abe Version 1.89.5 WIP 2023-03-15 12:25:20 +01:00
ocornut
f3f6295d53 Version 1.89.4
Commented out obsolete enums/functions names: ImGuiSliderFlags_ClampOnInput, ImGuiInputTextFlags_AlwaysInsertMode, ImDrawList::AddBezierCurve(), ImDrawList::PathBezierCurveTo()()
2023-03-14 16:36:19 +01:00
ocornut
cc2177de15 Debug Tools: Added io.ConfigDebugBeginReturnValueOnce / io.ConfigDebugBeginReturnValueLoop options. 2023-03-14 15:25:13 +01:00
ocornut
e83fb468c6 Renamed PushAllowKeyboardFocus()/PopAllowKeyboardFocus() to PushTabStop()/PopTabStop(). (#3092) 2023-03-09 18:53:57 +01:00
ocornut
3b2f617652 BeginTooltip: Added 'bool' return value to BeginTooltip() for API consistency. Updated demo.
Add SetWindowHiddendAndSkipItemsForCurrentFrame().
2023-03-09 15:16:40 +01:00
Marc Delorme
c8ad25caa6 Make classes not depend on the implicit GImGui context (#5856, #6199): ImGuiWindow, ImGuiInputTextCallbackData, ImGuiListClipper, ImGuiStackSizes
This commit is a preparation toward adding ImGui apis with explicit context
and making ImGui applications being able to use multiple context at the same time
whatever their concurrency model.

This commit modifies ImGuiInputTextCallback, ImGuiListClipper and ImGuiStackSize so those classes do not to depend on GImGui context anymore.

About ImGuiInputTextCallback:
- ImGuiInputTextCallback depends on ImGuiContext because it has a
  `InsertChars` method adding character to `g.InputTextState`
- To make ImGuiInputTextCallback aware of which context to use, the
  appropriate context is given as argument of ImGuiInputTextCallback
  constructor.

About ImGuiListClipper:
- ImGuiListClipper apply to a context through its `Begin`, `End`, and `Step`
  method.
- To make ImGuiListClipper aware of which context to use, the
  appropriate context is given as argument of ImGuiListClipper
  constructor.
- Since the behavior is different than previously the class has been
  renamed ImGuiListClipperEx
- In order to preserve backward compatibility, a subclass of ImGuiListClipperEx
  named ImGuiListClipper has been defined and forward the implicit context
  to ImGuiListClipperEx parent.

About ImGuiTextFilter:
- ImGuiTextFilter depends on the implicit context because the Draw(..)
  method call ImGui::InputText(...)
- Instead from that commit the Draw(...) method takes an explicit context
  as first argument
- Since the behavior is different than previously the class has been
  renamed ImGuiTextFilterEx
- In order to preserve backward compatibility, a subclass of ImGuiTextFilterEx
  named ImGuiTextFilter has been defined. This subclass has a draw method
  override which and forward the implicit context to the parent class Draw(...)

About ImGuiStackSizes:
- ImGuiStackSizes was depending on ImGuiContext because of its
  `SetToCurrentState` and `CompareWithCurrentState` method
- ImGuiStackSizes is an helper object use
  for comparing state of context. It does not necessarily need to
  compare the same context. For that reason, as opposed to previous
  classes it takes the context it wants to compare to as argument of
  its method.
- For this occasion `SetToCurrentState` and `CompareWithCurrentState`
  have been renamed `SetToContextState` and `CompareWithContextState`
  to match the new method signature.

ImGuiListClipper

ImGuiInputTextCallbackData
2023-03-08 15:55:38 +01:00
Marc Delorme
10ace228bc Make classes not depend on the implicit GImGui context (#6199, #5856, #6199): ImGuiIO
This commit is a preparation toward adding ImGui apis with explicit context
and making ImGui applications being able to use multiple context at the same time
whatever their concurrency model.

About ImGuiIO:
- ImGuiIO depends on ImGuiContext because some of its method want to event to `g.InputEventQueue`.
- To make ImGuiIO aware of the context to use, context which creates the ImGuiIO is given as argument of ImGuiIO constructor.
- The assert `IM_ASSERT(&g.IO == this && "Can only add events to current context.")` has been removed since it does not make sense anymore

NOTE: ImGuiIO could be completely independent of ImGuiContext if the InputEventQueue was moved from ImGuiContext to ImGuiIO, but since
ImGuiIO is a public class it would expose InputEvent type. Solving this problem is out of the current scope, but it is interesting to notice.
2023-03-08 15:39:22 +01:00
ocornut
c9a53aa74d Nav: Made Enter key submit the same type of Activation event as Space key. (#5606)
Instead of adding NavActivateInputId support in ButtonBehavior() started untangling the mess.
2023-03-07 18:41:49 +01:00
ocornut
b4b79584d1 Internals: added GetStyleVarInfo(). exposed previously .cpp only ImGuiStyleVarInfo as ImGuiDataVarInfo. 2023-03-07 14:40:55 +01:00
ocornut
b6586bb06d TestEngine: update IMGUI_TEST_ENGINE_ITEM_ADD() hooks to support passing item in flags. 2023-03-06 18:10:04 +01:00
ocornut
1c29a8ed18 Debug Log: auto-disable ImGuiDebugLogFlags_EventClipper to reduce spam. 2023-03-06 18:09:49 +01:00
ocornut
bfce7750b1 Simpified code in GetKeyData() and used ImGuiKey_KeysData_OFFSET for consistency. Rework demo, Comments. Moved ImGuiKey_KeysData_OFFSET to internal.h (#4921, #6191) 2023-02-24 13:05:32 +01:00
ocornut
696a533532 TestEngine: added ImGuiItemStatusFlags_Inputable flag report to facilitate fuzzing. 2023-02-16 12:15:06 +01:00
ocornut
a1b8457cb5 Moved the optional "courtesy maths operators" (#define IMGUI_DEFINE_MATH_OPERATORS) implementation from imgui_internal.h in imgui.h. (#6164, #6137, #5966, #2832) 2023-02-15 19:23:12 +01:00
ocornut
204cb4d226 Version 1.89.4 WIP 2023-02-15 15:35:56 +01:00
ocornut
458a109031 Version 1.89.3 2023-02-14 16:00:18 +01:00
ocornut
fa0852f9e5 ColorEdit, ColorPicker: Fixed hue/saturation preservation logic from interfering with the displayed value (but not stored value) of others widgets instances. (#6155)
Amend 30546bc0, accb0261b, 38d22bc4
2023-02-14 15:35:00 +01:00
ocornut
f0ac68ad35 Internal: Settings: amend 0b86513 revert to use FindWindowSettingsByID().
Namely for docking system.
2023-02-10 17:01:14 +01:00
ocornut
082b20e46b Internals: Settings: added ClearWindowSettings(). Extract part of CreateNewWindow() into InitOrLoadWindowSettings().
Designed to that if the window reappear in the session it won't take an additional slot.
2023-02-10 16:46:31 +01:00
ocornut
b2ebd03b16 Internals: Settings: moved Windows setting to their sub-section. 2023-02-10 16:06:39 +01:00
ocornut
0b865136e3 Internals: Settings: Added FindWindowSettingsByName() (replacing old version by ID) FindWindowSettingsByWindow() + remove unnecessary FindOrCreateWindowSettings().
In 1 code path we do a redundant hash but this happens only once per window per session so we are ok.
2023-02-10 16:06:29 +01:00
ocornut
99c0bd65df Added SeparatorText() widget. (#1643) 2023-02-10 12:16:41 +01:00
ocornut
e816bc6723 Merge misc changes from docking branch to reduce small drift.
In particular:
- imgui.cpp : move UpdateInputEvents() higher in NewFrame() to match docking + update RenderMouseCursor() to match.
- imgui_draw.cpp: ImDrawList::_ResetForNewFrame() change from c807192ab
- Backends: SDL2. Add MouseWindowID + change SDL_CaptureMouse() test to match docking branch. Not strictly necessary but aimed at reducing drift because we go on and fork this file.
+ moved responsability of checking valid names to TabBarGetTabName() to simplify both branches.
2023-02-07 13:22:23 +01:00
ocornut
d6ea56dfd9 Tables: amend f799a29 with a better solution + fix potential overflow (#6140) 2023-02-03 22:50:43 +01:00
ocornut
f799a293c8 Tables: Solved an ID conflict issue with multiple-instances of a same table. Storing instance id for convenience. (#6140)
TableGetColumnResizeID() are still using an incorrect table, but having only one-level left tends to cancel things out.
2023-02-03 20:03:03 +01:00
nahkhiir
2efebe3315 ShowFontAtlas, Demo: optionally use style text color for tint. (#6129) 2023-01-31 18:12:42 +01:00
ocornut
867bdbecb3 Text: fixed issue in RenderText() leading to IM_ASSERT_PARANOID() triggering if enabled. (#6132, #5720, #5919)
Amend 3482d4ec, bd96f6e
2023-01-31 14:41:16 +01:00
ocornut
d719776460 Internals: added 'ImGuiButtonFlags flags' to ImageButtonEx(). (#6126) 2023-01-31 11:30:27 +01:00
ocornut
3d8885cbbd TabBar: Internals: add GetCurrentTabBar(), TabBarFindTabByOrder(), TabBarGetCurrentTab(), TabBarGetTabOrder(), TabBarGetTabName(), TabBarQueueFocus() + clear LastTabItemIdx on EndTabBar(). (#5853, #5997)
ImGuiTabBar::GetTabOrder() -> TabBarGetTabOrder().
ImGuiTabBar::GetTabName() -> TabBarGetTabName()
2023-01-24 19:41:20 +01:00
ocornut
91667430a8 Tables: increase table columns limit from 64 to 512 using bit array allocated in contiguous memory +. (#6094, #5305, #4876, #3572) 2023-01-21 00:41:54 +01:00
ocornut
14908cba8f Internals: ImBitArray, ImBitVector: using macro helper for common op + disable stack checks on MSVC agressive debug builds. 2023-01-21 00:41:50 +01:00
ocornut
db55422870 Tables: removed hot RequestOutputMaskByIndex bit-array as majority of code-paths are already touching the cold parts.
Only exception being TableSetColumnIndex() with same column number but that's an odd case.
Will break PR #6094 #3572 #5305 #4876 but those not need to be necessarily updated: we got enough reference to finish that feature.
2023-01-20 17:57:13 +01:00
ocornut
51c97a41aa PlotHistogram, PlotLines: Passing negative sizes honor alignment like other widgets. 2023-01-18 15:13:23 +01:00
ocornut
482ac70a0b Version 1.89.3 WIP 2023-01-11 15:52:30 +01:00
ocornut
d7c8516a4b Version 1.89.2 2023-01-05 15:49:29 +01:00
ocornut
e06bbe05e1 Revert most/part of "Shortcut: added Shortcut() function and ImGuiInputFlags in public API + Demo." (#456, #2637)
This reverts commit 0949acb6e6.

# Conflicts:
#	imgui.h
2023-01-05 15:21:48 +01:00
ocornut
03add24acf Selectable: Internals: removed unused ImGuiSelectableFlags_DrawHoveredWhenHeld flag.
Needlessly introduced in baae057a from WIP tables branch at the time, ended up unused by Tables.
A comment "I find it counter intuitive that hovering supersedes activation." in #3516 led me to this however this is not the cause of said issue.
2023-01-05 11:28:05 +01:00
Manuel Floruß
328695bd47 Provide a non-empty definition for IMGUI_DEBUG_PRINTF when disabled. (#5978)
Fixes MSVC warning C4390 when /W3 is specified. Reworked from original PR: (void)0 provides better codegen by do-while.
Similar to #5901
2023-01-02 16:02:56 +01:00
ocornut
59b63defe5 Misc shallow merge/sync from docking designed to faciliate cross-merging between docking and string_view. 2022-12-08 21:14:39 +01:00
ocornut
317b33d647 Tables: fixed matching width of synchronized tables when only some (not all) instances have a vertical scrollbar. (#5920) 2022-12-08 20:06:26 +01:00
ocornut
0949acb6e6 Shortcut: added Shortcut() function and ImGuiInputFlags in public API + Demo. (#456, #2637) 2022-12-08 18:54:41 +01:00