Commit Graph

875 Commits

Author SHA1 Message Date
ocornut
83cee9e091 InputText: replaced some uses of SetKeyOwner() + IsKeyPressed() with Shortcut()
Which makes it easier to hook/disable those keys from outside if needed.
2022-11-16 17:09:14 +01:00
ocornut
81160fee56 Version 1.89
+ fix warning from a582d92
2022-11-15 15:20:36 +01:00
ocornut
4d6a9ef93f Inputs: added routing priorities. (#456, #2637, #3724)
- and ImGuiInputFlags_RouteUnlessBgFocused
- will be useful for blind menu handlers.
2022-11-08 20:37:58 +01:00
ocornut
7ff2d3353c Inputs: added wip/experiment routing system: Shortcut(), RoutingFocused policy, SetShortcutRouting(). (#456, #2637, #3724)
- InputText() uses Shortcut().
2022-11-08 20:37:58 +01:00
ocornut
4448d975d1 Inputs: added wip/internal Input Owner system. (#456, #2637, #2620, #2891, #3370, #4828, #5108, #5242, #5641)
- Added SetKeyOwner(), SetItemKeyOwner(), TestKeyOwner().
- Added new IsKeyXXX IsMouseXXX functions with ImGuID owner_id and flags.
- Obsoleted SetItemUsingMouseWheel(). (#2891)
- Removed IsKeyPresseedEx() which was a recent internal addition 2022-07-08 deemed to be temporary exactly for this.
- Added ImGuiButtonFlags_NoSetKeyOwner, ImGuiButtonFlags_NoTestKeyOwner
- Added ImGuiSelectableFlags_NoSetKeyOwner.
- Added ImGuiInputFlags_LockThisFrame, ImGuiInputFlags_LockUntilRelease for for SetKeyOwner(), SetItemKeyOwner().
- Added ImGuiInputFlags_CondXXX values for SetItemKeyOwner().
2022-11-08 18:47:36 +01:00
ocornut
529cba19b0 Debug Tools: Added DebugLocateItem()/DebugLocateItemOnHover() to visually locate items when hovering a 0xXXXXXXXX value. (#5855, #2673, #4631) 2022-11-04 16:06:34 +01:00
ocornut
9f66a3a9ed Internals: rework FocusScope system, current scope doesn't need to be in window + child doesn't inherit.
Intended as part of work for input routing + blind menu processing shortcuts. Some of this commit will be stripped by next commit.
Intent was to sort windows along with focus scope to build a hierarchy, but for our needs we'd need a persistant one, so scrapping the idea. Not squashing this with next commit to keep a bit of history for future references.
2022-11-04 12:19:20 +01:00
ocornut
1eac0024c0 InputText: copy and select all shortcuts don't need repeat (tho it was harmless0 2022-11-03 18:33:43 +01:00
ocornut
431fc6a7f6 Internals: using ItemAdd() consistently for internal items: windows & tables resize grips/borders, ScrollbarEx().
This put an extra flag check in ItemAdd() but essentially reduce inconsistency with windows decorations not using this. Useful for debugging.
It however buries the info/blurs the line about what it means to not use ItemAdd() since they are now doing it much less.
2022-10-24 22:54:29 +02:00
ocornut
bc918404fe Internals: using ImToUpper() since std one does too many things.
As a bonus side-effect may remove reliance on ctype.h (will see if CI complains)
2022-10-21 16:13:52 +02:00
ocornut
9a35bfea39 Internals: added temporary ImGuiItemStatusFlags_Visible (used internally - please do not use).
Used by BeginMenu() as I'm experimenting with blind menus honoring shortcuts.
Extra comments about KeyMap and ImGuiKeys
2022-10-21 14:57:10 +02:00
ocornut
e3fa56ae05 BeginMenu(): Menus: Fixed a one-frame issue where SetNextWindowXXX data are not consumed by a BeginMenu().
+ Shallow tweaks to reduce diff of future branches. Removing early return also facilitate some changes.
2022-10-19 14:12:04 +02:00
ocornut
81176737f8 Menus: Fixed using IsItemHovered()/IsItemClicked() on BeginMenu(). (#5775) 2022-10-14 17:39:04 +02:00
ocornut
3e8d198133 Removed runtime patching of obsolete/invalid "%f"/"%.0f" types of format strings for DragInt()/SliderInt(). 2022-10-12 23:09:09 +02:00
ocornut
85a368b58d Fixed ImGuiWindowFlags_UnsavedDocument clipping label in docked windows with no close button. (#5745)
+ TabBar: starts displaying the unsaved document marker with a frame delay to match how close button is processed, otherwise the transition would be noticeable.
2022-10-04 18:03:56 +02:00
ocornut
0749453355 Menus, Nav: Fixed not being able to close a menu with Left arrow when parent is not a popup. (#5730) 2022-09-29 19:51:54 +02:00
ocornut
bd2355a047 Menus, Nav: Fixed using left/right navigation when appending to an existing menu (multiple BeginMenu() call with same names). (#1207) 2022-09-29 19:25:26 +02:00
ocornut
3532ed1621 Menus, Nav: Fixed keyboard/gamepad navigation occasionally erroneously landing on menu-item in parent when the parent is not a popup. (#5730)
Replace BeginMenu/MenuItem swapping g.NavWindow with a more adequate ImGuiItemFlags_NoWindowHoverableCheck.
Expecting more subtle issues to stem from this.
Note that NoWindowHoverableCheck is not supported by IsItemHovered() but then IsItemHovered() on BeginMenu() never worked: fix should be easy in BeginMenu() + add test is IsItemHovered(), will do later
2022-09-29 18:44:19 +02:00
ocornut
d5d705069d Various comments
As it turns out, functions like IsItemHovered() won't work on an open BeginMenu() because LastItemData is overriden by BeginPopup(). Probably an easy fix.
2022-09-29 18:44:19 +02:00
ocornut
d17627b9c6 InputText: leave state->Flags uncleared for the purpose of backends emitting an on-screen keyboard for passwords. (#5724) 2022-09-28 17:38:41 +02:00
ocornut
04316bd223 ColorEdit3: fixed id collision leading to an assertion. (#5707) 2022-09-26 16:32:09 +02:00
ocornut
fd408c9790 Renamed and merged keyboard modifiers key enums and flags into a same set:. ImGuiKey_ModXXX -> ImGuiMod_XXX and ImGuiModFlags_XXX -> ImGuiMod_XXX. (#4921, #456)
Changed signature of GetKeyChordName() to use ImGuiKeyChord.
Additionally SetActiveIdUsingAllKeyboardKeys() doesn't set ImGuiKey_ModXXX but we never need/use those and the system will be changed in upcoming commits.
2022-09-26 10:43:26 +02:00
ocornut
85f327d8d3 InputText: added ImGuiInputTextFlags_EscapeClearsAll (#5688) 2022-09-21 16:23:44 +02:00
ocornut
60ab8a94a7 InputText: fixed minor one-frame selection glitch when reverting with Escape + disable cursor rendering on revert frame. (#3008)
Amend bdbb2b21, 83efdcec
2022-09-20 15:46:32 +02:00
ocornut
52d9ee0dc2 Tabs: Fixed ShrinkWidths() redistribution of remainder leading to infinite bug (second fix). (#5652, #5262)
Amend b137f31
2022-09-09 20:01:59 +02:00
ocornut
3e6f948851 Tabs: Enforcing minimum size of 1.0f, fixed asserting on zero-tab widths. (#5572)
Also fixed SetNextItemWidth(0.0f) not being consistent with tabs. (#5262)
2022-09-07 12:42:42 +02:00
ocornut
b137f31b8c Tabs: Fixed ShrinkWidths() redistribution of remainder leading to infinite bug + over redistribution. (#5652)
Amend c4b91017
2022-09-07 12:22:49 +02:00
ocornut
2171375f93 InputText: clarified that callbacks cannot modify buffer when using the ReadOnly flag. 2022-09-06 14:33:02 +02:00
Constantine Tarasenkov
b87e58fab3 ImGui::InputText: added support for shift+click style selection. (#5619)
(Amend, force-push: sorry wrong edit by omar)
2022-09-05 18:27:58 +02:00
ocornut
9e1ccf8fab Commented out redirecting functions/enums names that were marked obsolete in 1.77 and 1.78 (June 2020): (#3361)
- DragScalar(), DragScalarN(), DragFloat(), DragFloat2(), DragFloat3(), DragFloat4() with signature ending with (..., float power = 1.0f)
- SliderScalar(), SliderScalarN(), SliderFloat(), SliderFloat2(), SliderFloat3(), SliderFloat4() with signatures ending with (..., float power = 1.0f)
- BeginPopupContextWindow(const char*, ImGuiMouseButton, bool)
2022-09-05 14:38:00 +02:00
ocornut
9445776d61 Nav: Fixed an issue opening a menu with Right key from a non-menu window. 2022-09-01 20:42:10 +02:00
ocornut
03fc9a0b17 Menus: Fixed gaps in closing logic. (#5614)
The _MenuBar test introduced in c2cb2a69 doesn't appear to be meaningful.
2022-09-01 20:42:07 +02:00
Rokas Kupstys
b3ea01d86f Menus: Fix sub-menu inhibition stopping working in some cases. (Amend WIP) (#2517, #5614, noticed in #5546)
Amend bda2cde6
Fixes the case where following menu hover sequence results in incorrect RestoreNavWindow (previously SourceWindow) pointing to opened sub-menu:
1. Hover "Menu -> Options" - Open ##Menu_01 window
2. Hover "Menu -> Colors"  - SourceWindow incorrectly points to ##Menu_01 window
2022-09-01 17:02:46 +02:00
ocornut
e13913ed57 IsItemHovered: Added ImGuiHoveredFlags_DelayNormal, ImGuiHoveredFlags_DelayShort, ImGuiHoveredFlags_NoSharedDelay. (#1485)
IsItemHovered() can't have a non-zero default, but higher-level tooltip helpers may enable a different default later.
2022-08-24 21:32:13 +02:00
ocornut
cdebd70e15 Fix PVS-Studio static analyzer warning for "buffer underflow"
Amend 4e8e177c
2022-08-20 23:08:19 +02:00
ocornut
5b0510c5b7 TestEngine: facilitate aiming at InputScalar() using wildcards + removed unnecessary IDStack.size hack (require TestEngine latest) 2022-08-20 22:55:51 +02:00
ocornut
268565079c InputText: numerical fields automatically accept full-width characters (U+FF01..U+FF5E) by converting them to half-width (U+0021..U+007E). 2022-08-08 17:06:11 +02:00
ocornut
4a2ae06ca4 Changed signature of ImageButton() function: Added 'const char* str_id' parameter + removed 'int frame_padding = -1' parameter. (#5533, #4471, #2464, #1390).
Also removed frame_padding parameter from ImageButtonEx(), amend e0ec69d8.
2022-08-03 21:04:33 +02:00
Rokas Kupstys
e926a664d5 TabBar: Allow closing entire TabBar (possible docking only) when it contains user-appended buttons. (#5515)
In docking branch we mass-call TabBarCloseTab(). Amend b26f1530. Standardize Changelog entries.
2022-08-02 19:30:01 +02:00
ocornut
e99c4fc668 Nav: fixes keyboard/gamepad nav actions running without the corresponding config flags (#5504). Fixes 8b8a61b. #4921, #4858, #787, #1599, #323)
NavUpdate() can now clears ImGuiInputSource_None.
2022-07-25 17:19:45 +02:00
ocornut
8b8a61bdf9 Removed io.NavInputs[] and ImGuiNavInput enum. Kept inline redirection code. (#4921, #4858, #787, #1599, #323) 2022-07-08 16:02:07 +02:00
ocornut
f9ccdba352 Nav: Fix regression 93f02ee + Internals: Remove ImGuiNavReadMode_Pressed, ImGuiNavReadMode_Released.
Toward using keys.
2022-07-06 17:03:50 +02:00
ocornut
0b2da67912 Internals: clarified that GetInputTextState(0) can not return a pointer. Replaced a use of __APPLE__ with io.ConfigMacOSXBehaviors. 2022-07-05 14:40:09 +02:00
ocornut
609b935a8c InputText: added experimental io.ConfigInputTextEnterKeepActive feature to make pressing Enter keep the input active and select all text. 2022-06-30 15:47:54 +02:00
ocornut
0afc6cd310 Internals: InputTextEx() renames for correctness. enter_pressed -> validated, is_validate_enter -> is_enter_pressed 2022-06-30 15:31:42 +02:00
ocornut
873e9d35ac Internals: renamed TreeNodeBehaviorIsOpen() to TreeNodeUpdateNextOpen(). Added internal TreeNodeSetOpen(id). (#5423) 2022-06-28 16:11:31 +02:00
ocornut
24dfe6db8a Version 1.89 WIP 2022-06-27 16:55:55 +02:00
ocornut
9aae45eb4a Version 1.88
(fix "Show Debug Log" checkbox in Metrics window)
2022-06-21 18:11:50 +02:00
ocornut
d51e5d2898 TabItem: revert support for SetNextItemOpen(true) at it creates too much ambiguity with p_open/close button vs Selected state. (#5262)
Revert a small part of 4b97296.
2022-06-21 17:20:06 +02:00
ocornut
c4b9101759 TabBar: Tweak shrinking policy so that while resizing tabs that don't need shrinking keep their initial width more precisely.
Has been the case before but adding support for SetNextItemWidth() #5262 made this more noticeable.
2022-06-21 17:13:13 +02:00
ocornut
4b97296148 TabBar: TabItem() now reacts to SetNextItemWidth() and SetNextItemOpen(true). (#5262) 2022-06-21 17:13:12 +02:00
ocornut
d3fd2630b7 Sliders: An initial click within the knob/grab doesn't shift its position. (#1946, #5328) + Adjust default GrabMinSize. 2022-06-20 18:13:10 +02:00
ocornut
f27af1b20a Internals: SliderBehaviorT: Minor refactor, clearer 0.0/1.0 early out. Should be no-op from user's point of view.
ScaleValueFromRatioT() had early 0.0/1.0 ratio tests, shifting most of function by one indent.
2022-06-20 16:57:04 +02:00
ocornut
07efd7cc20 Renamed IMGUI_DISABLE_METRICS_WINDOW to IMGUI_DISABLE_DEBUG_TOOLS. 2022-06-15 16:02:55 +02:00
ocornut
27343efb0b Nav, Focus: Changed SetKeyboardFocusHere() to not behave if a drag or window moving is in progress + move KeepAliveID() call from Scrollbar() to ScrollbarEx() 2022-06-15 15:25:07 +02:00
ocornut
6cac48df32 Drag, Slider: rework slightly or CTRL+Click or SetKeyboardFocusHere() will show 1 change of active id in the log (rather than a set,clear,set sequence) 2022-06-15 11:52:46 +02:00
ocornut
1d6e34f3f9 Debug: Added ShowDebugLogWindow().
Internal: renamed old IMGUI_DEBUG_LOG() to IMGUI_DEBUG_PRINT().
Amended once.
2022-06-13 19:05:55 +02:00
Rokas Kupstys
0b1bcfcc20 Menus: Separate menu sets by nav layer. (#3496, #4797) + Demo: Remove incorrect and useless suggestion to use PushID().
Fixes a common case where opening menu in one nav layer and hovering a menu in another nav layer would open that menu without a click.
2022-06-08 17:17:54 +02:00
ocornut
a35e876978 InputText: Amends and tidying up: Fixed undo/redo state corruption when editing buffer in user callback. (#4947, #4949) 2022-06-08 15:27:36 +02:00
Joshua Webb
530332dfbc InputText: Fixed undo/redo state corruption when editing buffer in user callback. (#4947, #4949) 2022-06-08 15:27:10 +02:00
ocornut
23a785aeb3 Internals: wrapped used of g.TempBuffer into ImFormatStringToTempBuffer/ImFormatStringToTempBufferV helpers.
This leaves us room for growing the buffer if needed, and gives us a resizable buffer available for other work.
2022-06-07 19:20:03 +02:00
ocornut
64d6c30562 InputText: Fixed an undo-state corruption issue when editing buffer before reactivating item. (#4947) + Metrics: Added "InputText" section. 2022-06-07 15:34:21 +02:00
ocornut
74f02703e6 Misc comments + Demo: use IsItemVisible() when using direct ImDrawList calls. 2022-06-07 11:48:05 +02:00
ocornut
697ce2d67b InputText: Fixed a one-frame display glitch where pressing Escape to revert after a deletion would lead to small garbage being displayed for one frame. (#3008)
Curiously very old, amend 83efdce and bdbb2b2. Using stb_ functions updated ->CurLenA without updating ->TextA, leading to `buf_display_end = buf_display + state->CurLenA;` in the display.
Since f3ab5e62 they are 1 case out of 4 which didn't apply back to ->TextA and this is essentially the one where we ensure appliance. Another solution would be to alter the lower display code, but applying to TextA makes things more consistent.
2022-05-25 18:39:00 +02:00
ocornut
9779cc2fe2 Internals: shallow changes to simplify diff of upcoming commits. Should have no side-effect. 2022-05-06 14:20:01 +02:00
ocornut
314c7bd12f Internals: renamed ImGuiInputReadMode to ImGuiNavReadMode (internals) to avoid ambiguity with upcoming flags. + minor tweak 2022-04-28 17:29:47 +02:00
ocornut
5b29d14783 Layout: Fixed mixing up SameLine() and SetCursorPos() together. SameLine() is a stateful.
+ minor unrelatedcomments.
2022-04-22 17:48:06 +02:00
ocornut
eda7792b15 Internals: swapped blocks in TextEx() to make it easier to step through common cases. Tweak demo. 2022-04-14 18:36:27 +02:00
ocornut
6d15a506fa Internals: removed GetIDNoKeepAlive() now that it is the same as GetID(). (#5181)
Amend 9038678
2022-04-12 14:49:21 +02:00
ocornut
2c03aac6d3 Renamed ImGuiKeyModFlags to ImGuiModFlags (Breaking but technically never advertised type) 2022-04-05 15:45:00 +02:00
ocornut
a472e8834b InputScalar: Automatically allow hexadecimal/scientific input when format is adequate. 2022-04-05 15:13:37 +02:00
ocornut
c521883be4 Sliders, Drags: Fixed manual input when using hexadecimal display format string. (#5165, #3133)
InputScalar: Fixed manual input when using %03d style width in display format string.
(amended once)
2022-04-04 18:42:04 +02:00
ocornut
508c9aaf60 Sliders, Drags: Fixed using hexadecimal display format strings (pretty much never worked). (#5165, #3133)
Ditched unnecessary code. When transitioning from float in 3e8087458 we added an unnecessary path there, which evolved in c5fb92955.
2022-04-04 14:43:30 +02:00
ocornut
2747a8ca40 Turned ImVec2 to const ref to RenderChar(), RenderText(), ColorButton(), PushClipRect(). for consistency. Comments about polygon filling winding order. 2022-03-29 12:13:31 +02:00
ocornut
0dec430707 Menus: Adjusted BeginMenu() closing logic so hovering void or non-MenuItem() in parent window always lead to menu closure. 2022-03-28 12:33:58 +02:00
ocornut
dfbe938e54 InputText: Fixed pressing Tab emitting two tabs characters. (#2467, #1336)
Using Tab keys entirely now, ignoring Tab character. Technically affect who owns the repeat rate.
2022-03-24 12:04:49 +01:00
ocornut
fd06ed833b Misc: tweaks + fix warnings on backends withtout -wno-memaccess (#4995, #5104) 2022-03-13 17:57:32 +07:00
ocornut
0f14933577 Tables: Fixed incorrect border height used for logic when resizing one of several synchronized instance of a same table ID, when instances have a different height. (#3955, #3565) 2022-03-01 18:47:03 +01:00
ocornut
54fb051e52 ColorEdit: Fixed text baseline alignment after a SameLine() after a ColorEdit() with visible label. 2022-02-28 16:12:43 +01:00
ocornut
29d462ebce Set HoveredID even when g.NavDisableMouseHover is set by gamepad/keyboard navigation. This will facilitate the use of future InputOwner API based on HoveredID/ActiveID.
Note that this widen the small gap between polling g.HoveredID and using IsItemHovered() the later does various filtering.
Added IsItemHovered(ImGuiHoveredFlags_NoNavOverride) to disable that specific state redirect/filter.
Side-effect: fix EndGroup() use of combining HoveredId values when gamepad/keyboard nav is active. Unlikely to have user-visible side effect since IsItemHovered() would have filtered out anyway.
Side-effect: fix IsAnyItemHovered() when gamepad/keyboard is active (but this wasn't the primary intent of this change).
Side-effect: fix using SetItemUsingMouseWheel() while hovering an item and gamepad/keyboard is active. (#2891)
2022-02-17 18:39:03 +01:00
Borislav Stanimirov
955aacfbc5
GCC: Disable deprecated-enum-enum-conversion for gcc as well (#4997) 2022-02-09 09:47:11 +01:00
ocornut
88de982071 Version 1.88 WIP 2022-02-08 14:45:26 +01:00
ocornut
c71a50deb5 Version 1.87 2022-02-07 18:16:54 +01:00
ocornut
35e197f413 TestEngine: fixed InvisibleButton() and ArrowButton() not calling the info macro. 2022-02-01 11:52:38 +01:00
ocornut
8555335935 Shallow alignment of ImGuiKey stuff + moving some in internals. Internals: add offset to ImBitArray<>, simpify ActiveIdUsingKeyInputMask. 2022-01-25 18:11:34 +01:00
ocornut
b17b2fb732 Popups: Fixed an issue when reopening a same popup multiple times would offset them by 1 pixel on the right. (#4936)
Passing explicit ImGuiPopupFlags_MouseButtonRight to OpenPopupOnItemClick() calls somehow document the unusual (due to legacy) default value.
2022-01-24 13:24:54 +01:00
ocornut
91ae56af45 Removed support for legacy arithmetic operators (+*/) when inputing text into a slider/drag. (#4917, #3184) 2022-01-19 15:10:42 +01:00
thedmd
3b66929301 Inputs: Extra Keys / AddKeyEvent(): Added ImGuiKey values, io.AddKeyEvent(), GetKeyName(), IMGUI_DISABLE_OBSOLETE_KEYIO. Obsoleted GetKeyIndex(), io.KeyMap[], io.KeysDown[]. (#2625, #4858, #2787) 2022-01-10 15:09:56 +01:00
ocornut
afffcd5810 Inputs: rename ImGuiKey_KeyPadEnter > ImGuiKey_KeypadEnter (#2625) 2022-01-06 14:25:56 +01:00
Liu Liu
de36ff043e Platform IME: add ImGuiPlatformImeData::InputLineHeight (unused by win32). (#3113) 2022-01-05 13:47:21 +01:00
actboy168
29a8ee0826 Platform IME: add ImGuiPlatformImeData::WantVisible, hide IME when not used. (#2589) 2022-01-05 13:47:21 +01:00
ocornut
2706c9d66e Platform IME: reworked internals to simplify adding new features. 2022-01-05 13:47:20 +01:00
ocornut
89a28209e8 Version 1.87 WIP + Backends: OpenGL3: Fixed a buffer overflow in imgui_impl_opengl3_loader.h init, added in 1.86 (#4468, #4830) 2021-12-26 20:02:02 +01:00
ocornut
512c54bbc0 Version 1.86 2021-12-22 15:31:13 +01:00
ocornut
612b787b0d Menus: fixed top-level menu from not consistently using style.PopupRounding. (#4788)
+ Stack tool default size.
2021-12-21 15:05:10 +01:00
ocornut
0636f9adac InputText: fixed Shift+Delete from not cutting into clipboard. (#4818, #1541) 2021-12-20 19:45:58 +01:00
ocornut
389982eb5a Backends: OpenGL3: Using buffer orphaning + glBufferSubData(), seems to fix leaks with multi-viewports with some Intel HD drivers.. (#4468, #4504, #2981, #3381) 2021-12-15 11:50:00 +01:00
ocornut
48f263336b Menus: fixed closing a menu inside a popup/modal. Fixed menu inside a popup/modal not inhibiting hovering of items in the popup/modal. (#3496, #4797)
Fixed sub-menu items inside a popups from closing the popup (debatable).
2021-12-14 16:54:23 +01:00
ocornut
d7350668d1 Fix OSX warnings + Examples/Apple+GL2 calls super reshape. (#4759, #1873) 2021-12-13 12:31:15 +01:00
xndcn
8a9fe26866 Menus: fixed closing a menu by clicking on its menu-bar item when inside a popup. (#3496, #4797) 2021-12-10 18:58:41 +01:00
ocornut
bdd2a94315 InputTextMultiline: fixed vertical tracking with large values of FramePadding.y. (#3781, #4794) 2021-12-09 11:30:42 +01:00
ocornut
072caa4a90 InputText: fixed incorrect padding when FrameBorder > 0. (#4794, #3781) 2021-12-09 11:25:58 +01:00
ocornut
6e141a9cae Internals: made ScrollbarEx() use ImS64 to facilitate use with larger ranges (not fully tested) + clipper tweaks (#3609, #3962 + https://github.com/ocornut/imgui_club/issues/20)
This does NOT fix all problems with large ranges and floating point precision, it merely attenuate them.
2021-12-06 12:09:38 +01:00
ocornut
eea836135a InputText: fix buffer modifications in callbacks while using resize callback (#4784)
Regressed by 5ac25e7c7 (#4762)
2021-12-05 19:03:40 +01:00
ocornut
aa41f16589 Separator: fixed cover all columns while called inside a table. (#4787, #205) 2021-12-05 18:47:28 +01:00
ocornut
c5db276521 InputText, Nav: fixed tabbing through InputTextMultiline(). (#4761, #3092)
Messy... Broken by 66f0fb9. Added ImGuiItemFlags_NoTabStop to EndGroup() ahead of time (not strictly needed here).
2021-11-30 15:17:18 +01:00
ocornut
9d704d99d3 Internals: wrapped ImQsort() in an inline function + added a define guard. 2021-11-30 12:59:00 +01:00
ocornut
66f0fb986c Inputtext, Nav: fixed using SetKeyboardFocusHere() on InputTextMultiline(). (#4761) 2021-11-29 16:25:45 +01:00
ocornut
65f4be1a10 InputText: Internals: moved "apply_new_text" application code to reduce noise in a future commit (will be for #4714) + removed unused fields.
The move would ideally be no-op. technically we now clear state->Flags before calling ResizeCallback but those are unrelated. The 2 unused fields were incorrectly added by 24ff25981.
2021-11-25 15:12:23 +01:00
ocornut
5ac25e7c7a InputText: fixed ReadOnly flag preventing callbacks from receiving the text buffer. (#4762) 2021-11-25 15:12:08 +01:00
ocornut
f8a806ad9f Tooltips, Internal: (Breaking) swapped parameter order to accomodate for future tooltip api rework. 2021-11-10 17:53:58 +01:00
ocornut
8361ed1f54 Nav: wrap abs<>rel rectangle conversions before we attempt to switch the reference point from window->Pos to window->DC.CursorStartPos. This commit should have no effect.
Current point makes rectangle invalid right after a scroll, for interactive actions it's rarely a problem but e.g. clipper will want to use g.NavID rect rel while scrolling. (#3841)
2021-10-27 12:28:45 +02:00
ocornut
99552420a2 InputText: triple-click avoid scroll + include end of line character. (#2244) 2021-10-25 17:14:00 +02:00
ocornut
126a6f894f InputText: made double-click select word, triple-line select line. Word delimitation logic differs slightly from the one used by CTRL+arrows. (#2244) 2021-10-25 16:34:56 +02:00
ocornut
9c78fc928a Inputs: Mouse: Amend c8e3a01 for tracking multiple clicks, renaming. (#3229) 2021-10-25 14:30:20 +02:00
Chris Savoie
2318c764cf Inputs: Mouse: Add support for tracking multiple clicks more than just double (#3229) 2021-10-25 14:30:17 +02:00
ocornut
e3bd9434b1 1.86 WIP + internals: tweaks table temp data code. 2021-10-14 16:58:14 +02:00
ocornut
55d35d8387 Version 1.85 2021-10-11 19:24:25 +02:00
ocornut
44f801186f SetItemDefaultFocus() use ScrollToRectEx(), don't tab when Alt is held either, TabItemEx() uses ItemAdd's extra_flags, misc comments. 2021-10-08 15:24:54 +02:00
ocornut
ec6ca06898 InputText: Fixed selection rectangle appearing one frame late when selecting all. 2021-10-08 13:00:55 +02:00
ocornut
31d033c9d8 Nav: refactor SetKeyboardFocusHere() into using Nav facility. Fix it for clipped items. (#343, #4079, #2352, #432)
+ Removed references to counter used by previous implementation of SetKeyboardFocus functions (the TabStop ones will be removed after)
2021-10-06 18:42:11 +02:00
ocornut
2de96c4bd5 Stack Tool: Added Stack Tool (ShowStackToolWindow() function and available from Demo and Metrics window). (#4631) 2021-10-06 17:47:27 +02:00
ocornut
8f495e5543 Internal: added ScrollToItem() upcoming replacement to ScrollToBringRectIntoView() + ImGuiScrollFlags (WIP) (#3692, #3208, #2812, #4242, #2900) 2021-09-29 17:13:45 +02:00
Rokas Kupstys
15fe7ba31f ColorPicker: Fix not being able to pick exactly (1.0f, 1.0f, 1.0f) color by dragging toward the edges of the SV square. (#3517)
Old code attempted to mitigate hue/saturation resetting for colors where these components are undefined. Since we now explicitly back up and restore these components this workaround is no longer necessary.
2021-09-21 15:10:07 +02:00
Rokas Kupstys
30546bc0e7 ColorEdit: Fix multiple issues. (#4014)
* Change g.ColorEditLastColor type to ImU32 and store RGB color value.
  - Fixes inability to change hue when saturation is 0. (#4014)
  - Fixes edgecases where lossy color conversion prevent restoration of hue/saturation.
  - Fixes hue value jitter when modifying color using SV square.
* Fix hue resetting to 0 when it is set to 255 by explicitly restoring hue if it is 0 and previous value was 1.
* Further reduce hue jitter by restoring hue when color is modified using SV square.
2021-09-21 15:10:07 +02:00
ocornut
ddddabdccf InputText: amend validation test to allow pushing Activate events remotely. (#4552, #2321) 2021-09-17 16:44:14 +02:00
ocornut
2cffcbdc64 InputText: fix Space key with nav enabled interfering with input text boxes (fix bd6c9e99). made it possible to activate InputText with tweak gamepad button (why not, now that we can cancel) (#4552, #2321) 2021-09-17 16:30:32 +02:00
ocornut
3973de7933 Internals: removed last parameter to IsClippedEx() + fix PVS studio warnings. 2021-09-16 18:07:17 +02:00
ocornut
4f10fe0a27 TreePush: removed arbitrary/weird suppot for TreePush((const char*)NULL) 2021-09-15 12:12:49 +02:00
ocornut
7b8bc864e9 Menus: Fixed vertical alignments of MenuItem() calls within a menu bar. (broken by f8fae022). (#4538) 2021-09-14 11:09:39 +02:00
ocornut
82754561e2 Nav: Fixed a few widgets from not setting reference keyboard/gamepad navigation ID when activated with mouse. 2021-09-13 15:17:54 +02:00
ocornut
17a7084b57 Menus: Fixed crash when navigating left inside a child window inside a sub-menu. (#4510). 2021-09-10 15:37:59 +02:00
ocornut
d9b427cce0 Nav: clarified/renamed NavInputId as NavAcivateInputId, added flags shared by both.
(this commit should have no visible side effect but is designed to introduce the followup commit refactoring SetKeyboardFocusHere into using a Nav request)
2021-09-07 18:10:31 +02:00
ocornut
bd6c9e99fc InputText: Allow cancelling/validating input with gamepad nav events.
Amend 158995f2 (#2321)
2021-09-06 18:47:12 +02:00
ocornut
0a154b30ad Nav, ButtonBehavior: reworked old code which ended up 1) calling SetActiveId repeately and 2) misleadingly set g.NavActivateId (amend af38749e) 2021-09-03 17:27:27 +02:00
ocornut
ade4c15eea Nav: Tidying up, renaming + update AnyRequest flag in NavMoveRequestSubmit(). 2021-09-03 16:35:41 +02:00
ocornut
528104a89b Menus: adjust closing logic to accomodate for varying font size and dpi + remove seemingly redundant use of g.NavActivateId where pressed was enough. 2021-09-03 16:35:27 +02:00
ocornut
3d9d3b49ae Internals: folded ImGuiItemAddFlags into ImGuiItemFlags. ImGuiItemAddFlags_Focusable > ImGuiItemFlags_Inputable. One step in the big nav/tab/focus rework.
Bonus simplified Selectable() handling of its custom disabled flag. (#211)
2021-09-01 14:46:08 +02:00
ocornut
a735a8c084 Nav: storing NavRect in LastItemData. Fix race condition where framed items (Rect != NavRect) calling SetFocusID() would store the wrong NavRectRel until next frame
(haven't dugged in the possible side-effects of that race condition)
2021-09-01 12:12:51 +02:00
ocornut
7b913db1ce Nav: split NavMoveRequest into NavMoveSubmitted + NavMoveScoringItems to allow operation to defer a move request and provide result immediately + fix regular scoring needlesly running during init + some renaming. 2021-08-31 18:19:52 +02:00
Filippo Crocchini
eb6c16d3dd PlotHistogram: Fixed zero-line position when manually specifying min<0 and max>0. (#4349)
+ amended demo tweaks by ocornut
2021-08-31 13:14:43 +02:00
ocornut
7c4ffe490d Menus: added internal's BeginMenuEx() matching MenuItemEx() with icon parameter. (amend f8fae022) 2021-08-30 19:54:42 +02:00
ocornut
ccfb20095e Nav: small refactor of forwarding, clarified that MoveDir only set when RequestActive, removed one indent level in NavUpdatePageUpPageDown(). 2021-08-27 20:48:01 +02:00
ocornut
20a1edef89 Nav: made EndMenuBar() use NavMoveRequestForward() for consistency. Moved forward clearing to NavMoveRequestApplyResult(). Improved/fixed comments. 2021-08-27 17:21:10 +02:00
ocornut
780c1ee265 TextUnformatted: Accept null ranges including (NULL,NULL) without asserting. (#3615) 2021-08-24 19:30:02 +02:00
ocornut
0608887fb5 InputTextMultiline: Fixed label size not being included into window contents rect unless the whole widget is clipped. 2021-08-23 17:07:46 +02:00
ocornut
0649f750b4 Version 1.85 WIP 2021-08-23 15:31:06 +02:00
ocornut
d2ffbd9b86 Version 1.84
Fix PVS Studio false positive //-V1020
Fix missing #ifndef for IMGUI_IMPL_OPENGL_LOADER_CUSTOM path
2021-08-20 18:03:55 +02:00
ocornut
c543d93af1 Expose BeginDisabled()/EndDisabled() in public API. Add to demo. (#211) 2021-08-20 16:34:43 +02:00
ocornut
161b74e871 Fix tabbing in/out of an InputTextMultiline(), broken by 6b8a059. 2021-08-17 20:46:39 +02:00
Oliver 'kfsone' Smith
7e9e1ff1c2 InputText: Fix named filtering flags disabling newline or tabs in multiline inputs (#4409, #4410) 2021-08-17 16:10:11 +02:00
ocornut
e362c5af48 Internals: ColorEdit: renamed some internal masks to match our common coding style.
ImGuiColorEditFlags__DisplayMask > ImGuiColorEditFlags_DisplayMask_, ImGuiColorEditFlags__OptionsDefault > ImGuiColorEditFlags_DefaultOptions_, ImGuiColorEditFlags__DataTypeMask > ImGuiColorEditFlags_DataTypeMask_  etc.
2021-07-26 20:44:59 +02:00
ocornut
90bf996e1a Internals: widgets always read back from g.LastItemData.InFlags (so we can now modify per-item disable state more easily). (#211) 2021-07-19 21:26:34 +02:00
ocornut
6b8a059fc9 Internals: moved LastItem data to a shared structure (instead of one per window)
(should be a no-op as we are restoring things in Begin/End. Toward faciliate backup/restore of LastItemData and favor pulling from here instead of CurrentItemFlags, toward #211)
2021-07-19 21:25:47 +02:00
ocornut
1ad153056a Internals: ItemAdd: set LastItemXXX fields before navigation calls + comments about io.IniFilename (#4294) 2021-07-19 21:24:15 +02:00
ocornut
17ec4f1f6f TestEngine, MenuItem: call IMGUI_TEST_ENGINE_ITEM_INFO() at the right stack level. (amend f8fae02) 2021-07-12 16:42:53 +02:00
ocornut
246ad6c03c Disabled: items more consistently release active id if the active item got disabled. (#211) (amend 2952525) 2021-07-12 15:39:47 +02:00
Rokas Kupstys
5dd1e38b7a Disabled: disabled items set HoveredId, allowing e.g. HoveredIdTimer to function. (#211, #3419) + Menus: fix hovering a disabled menu or menu item not closing other menus.
Rework of https://github.com/rokups/imgui/commit/c24b470
Note that the declared intent of that commit "Prevents window from being dragged if mouse hovers a disabled item." was already fullfilled by a876ad87.
Changes in ButtonBehavior() not needed anymore since ImGuiButtonFlags_Disabled is gone
2021-07-09 19:54:46 +02:00
ocornut
cac869b333 Disabled: don't prevent Selectable() from being selected. (#211) + BeginMenu()/MenuItemEx() uses PushDisabled() the standard way.
ImGuiSelectableFlags_Disabled is now unused by the library and might be marked obsolete later.
2021-07-09 19:54:43 +02:00
ocornut
29525255f3 Disabled items more consistently release active id if the active item got disabled. (#211) 2021-07-09 19:54:41 +02:00
ocornut
ba1c8464ef Internals: Removed ImGuiButtonFlags_Disabled (which had inconsistent behavior) in favor of ImGuiItemFlags_Disabled. Selectable()'s ImGuiSelectableFlags_Disabled now uses the later. (#211) 2021-07-09 19:54:37 +02:00
ocornut
f6682404e1 InputInt/InputFloat: When used with Steps values and _ReadOnly flag, the step button look disabled. (#211) 2021-07-09 19:54:34 +02:00
ocornut
97638bf977 BeginMenu: remove unnecessary call to ItemHoverable() which is already done by the Selectable() call.
Amend 88d7b3de
2021-07-09 18:57:28 +02:00
ocornut
4a100f7f11 Nav: Disabled items are not candidate for default focus. (#211, #787) + simplify handling of ImGuiButtonFlags_PressedOnDragDropHold path. 2021-07-09 18:57:23 +02:00
ocornut
f8fae02270 Menus: rework to allow for an icon column (not yet exposed, but usable via internals) + fix menus being affected by style.SelectableTextAlign (#126) 2021-07-08 15:05:02 +02:00
ocornut
696d3e056e Internals: Menus: Naming offset field + fix spacing/offset computation to handle more offsets. 2021-07-07 20:47:37 +02:00
ocornut
3512f2c2c2 Internals: Menus: minor tidying up + renaming in ImGuiMenuColumns + removing extraneous offset field which is always zero + using smaller types.
sizeof() 36 -> 20
2021-07-07 20:16:55 +02:00
ocornut
20d415e939 FIx static analysers warnings and disable false positives. 2021-06-24 17:15:14 +02:00
ocornut
1965f38e9e ImGuiWindowFlags_UnsavedDocument/ImGuiTabItmeFlags_UnsavedDocument display a dot instead of a '*'. 2021-06-24 14:30:32 +02:00
ocornut
f0c4d609a6 Default window focus scope not 0. Added ImGuiSelectableFlags_SelectOnNav with comments and caveats. (#1861, #4242,)
Focus scope default value: amend 7ee623d9 a5041c88 2ebe08be
2021-06-21 17:47:45 +02:00
ocornut
a15c42d5bd Nav: moved RenderNavHighlight() calls of TreeNode and Selectable out of if (hovered || selected) tests. Should make no difference as NavId currently returns hovered. (#1861, #4242) 2021-06-21 17:38:56 +02:00
Rokas Kupstys
d5828cd988 SplitterBehavior: fix using IsItemHovered() after SplitterBehavior() 2021-06-16 15:42:42 +02:00
ocornut
0cca0d1617 Internals/experimental: BeginComboPreview(), EndComboPreview(). (#4168, #1658)
(amended)
2021-06-15 15:27:28 +02:00
ocornut
060b6ee7d1 Internals: Combo: Extracted into a BeginComboPopup() function. (#4168)
Renamed frame_bb > bb locally.
2021-05-28 17:45:07 +02:00
ocornut
5b4bc985ad Nav, Combo: removed unnecessary window->LastNavIds[] assignment in combo code. + minor renaming. 2021-05-28 17:27:52 +02:00
ocornut
79e18896fe TabBar: Fixed using more than 32 KB-worth of tab names. (#4176) 2021-05-27 12:01:00 +02:00
ocornut
e31d13fa76 Version 1.84 WIP 2021-05-25 13:36:53 +02:00
ocornut
ad5d1a8429 Version 1.83 2021-05-24 17:39:25 +02:00
ocornut
029c83c73e Combos: Changed the combo popup to use a different id to also using a context menu with the default item id. (#4167) 2021-05-24 15:09:39 +02:00
ocornut
5d77b6f274 Docs: update links, sponsors 2021-05-21 15:24:57 +02:00
ocornut
45f5ed52c1 Menus: made MenuItem() in a menu bar reflect the 'selected' argument with a highlight. (#4128) 2021-05-20 15:00:36 +02:00
ocornut
e7e170c534 InputText: Internal renaming to use our own types to clarify code a little bit. 2021-05-18 14:48:54 +02:00
ocornut
26a1bbfe1e InputText: Fixed CTRL+Arrow or OSX double-click leaking the presence of spaces when ImGuiInputTextFlags_Password is used. (#4155, #4156) [@michael-swan] 2021-05-18 14:46:25 +02:00
ocornut
393941ceea Refactor focusable/tabbalbe item registration toward allowing to handle it prior to clipping (not yet the case) (#343, #4079)
Now performed in ItemAdd(). It can't be trivially moved above clipping effectively because it would require us to scroll to be useful, meaning we'd be better off locking the bounding box a frame earlier. Still wip.
As-is this commit has no value for end-user, but it's a reengineering that moves us closer to the solution. + Internals: moved internal flags.
2021-04-30 22:40:02 +02:00
ocornut
9b90639577 Internals: ItemFlags is a shared resource as advertised. Fix Begin/PushItemFlags/End sequence (mostly for consistency) 2021-04-30 21:34:17 +02:00
ocornut
10a1c5b021 TestEngine: fixed wrong flags passed to ItemInfo queries. Was luckily/misleadingly not causing issues as the test-engine flags we tested were upper bits not colliding with the other type.
Moved those flags higher as well. (unrelated to the fix itself)
2021-04-30 19:32:41 +02:00
ocornut
89162a04f4 Fixes for PVS Studio and MSVC static analyzers. Using a macro to suppress single-use MSVC false positives. (#3938, #4073) 2021-04-29 21:20:32 +02:00
ocornut
d28535f351 Fixes for Visual Studio 2019 static analyzers. (#3938, #4073) + two minor edge case were invalid scalar input (e.g. a sign only) would return buffer as modified. 2021-04-29 17:10:27 +02:00
ocornut
2dec7b3301 InputText: Align caret/cursor to pixel coordinates. (#4080) 2021-04-27 13:31:32 +02:00
ocornut
daf97832f1 Internals: Nav: renaming. 2021-04-23 18:39:08 +02:00
ocornut
c283a1da5b Fixed clipping of multi-line value text when label is single-line + Fixed vertical alignment of single-line value text when label is multi-line. (#4004) 2021-04-06 18:35:06 +02:00
Doug Binks
f08566b4d7 InputText: Do not filter private unicode codepoints (e.g. icons) when pasted from clipboard. (#4005) 2021-04-06 12:00:52 +02:00
Chris Ohk
eab3ae473c
Fix warning message C4100 (#3974)
- warning C4100: 'fmt_out_size': unreferenced formal parameter
2021-03-27 17:11:57 +01:00
ocornut
1dcd3a45cc ColorEdit4: Alpha default to 255 (instead of 0) when omitted in hex input. (#3973)
Courtesy of @squadack
2021-03-26 11:34:07 +01:00
ocornut
688e06490e TabBar: Amend previous commit. Fix tab reordering when tab bar has scrolling.
Some tidying up with helpers + honor 16-bit offsets as with other tab bar features (unlikely single reorder can reach that but consistent)
2021-03-25 19:16:24 +01:00
Rokas Kupstys
475c0fcc39 TabBar: Use mouse position instead of hardcoded +1/-1 offset when reordering tabs.
Fixes tab reordering in test engine when using fast mode.
2021-03-25 19:12:49 +01:00
ocornut
a58271c079 Internals: extracted a more reusable BeginViewportSideBar() out of BeginMainMenuBar(). (#3966, #3518)
Complement ca34c81c in docking branch which removed assumption that we can't tell size ahead of Begin().
2021-03-25 16:20:42 +01:00
ocornut
59da01901e Scrolling: Fix scroll tracking with e.g. SetScrollHereX/Y() when WindowPadding < ItemSpacing. Fix scroll snapping on edge of scroll region when both scrollbars are enabled.
CalcNextScrollFromScrollTargetAndClamp() fixed snapping edge calculation missing ScrollbarSizes.y
2021-03-19 16:58:23 +01:00
ocornut
a1a39c632a Version 1.83 WIP 2021-03-16 14:45:30 +01:00
ocornut
4bf646e4b0 Drags, Sliders, Inputs: Specifying a NULL format to Float functions default them to "%.3f" to be consistent with the compile-time default. (#3922) 2021-03-16 12:59:35 +01:00