Commit Graph

2233 Commits

Author SHA1 Message Date
omar
b667d5a9e7 Nav: Internals: Renamed ImGuiButtonFlags_NoNavOverride to ImGuiButtonFlags_NoNavFocus + fixed a theorically missing test in ButtonBehavior() (#787) 2017-10-13 13:31:34 +02:00
omar
0371219222 Nav: Internals: Renamed SetActiveIDNoNav -> SetActiveID() and old SetActiveID() -> SetFocusID(), both functions needs to be called when both are desirabled. (#787)
May break code relying on imgui_internal.h, relying on nav and not calling ButtonBehavior().
2017-10-13 13:31:34 +02:00
omar
8b095e483b Internals: Moved SetNavID() and renamed casing to be consistent with stuff exposed in imgui_internal.h 2017-10-13 13:31:34 +02:00
omar
4be967823f Exposed Scrollbar() in imgui_internal.h and removed a bool arg 2017-10-13 13:30:28 +02:00
omar
48498b337d Internals: SetActiveID window cannot be NULL 2017-10-13 13:07:07 +02:00
omar
4548bcb5c9 Nav: commiting shallow bits to reduce noise from working copy/upcoming commit. 2017-10-12 02:09:13 +02:00
omar
17519c313a Nav: Extract part of NavUpdate() into a saner NavUpdateWindowingTarget() (#787) 2017-10-11 20:47:41 +02:00
omar
b05b31e690 Nav: Made NavWindow always refresh from NavId so we can lazily retrieve the window for user functions that don't have it. This is not required by current commit but I'd rather test it earlier. Idea: eventually if we switch to 64-bit identifiers we could reserve e.g. 20 bits to store a simplified window identifier so we can always retrieve a window from an id. (#787) 2017-10-11 20:37:45 +02:00
omar
f0d437dd9c Nav: SetActiveId() uses SetActiveIDNoNav() to avoid duplicating logic. (#787) 2017-10-11 20:29:53 +02:00
omar
2047c58efb Nav: Extract part of NavUpdate() into a saner NavScrollToBringItemIntoView() (#787) 2017-10-11 20:28:16 +02:00
omar
7a14d7dfdc Nav: More consistently drawing a (thin) navigation rectangle hover filled frames such as tree nodes, collapsing header, menus. (#787) 2017-10-11 19:05:36 +02:00
omar
3833f1f7a2 Merge branch 'master' into navigation 2017-10-11 15:38:33 +02:00
omar
43b4a81b3e Rnamed AlignFirstTextHeightToWidgets() to AlignTextToFramePadding(). Kept inline redirection function (will obsolete). 2017-10-11 15:36:57 +02:00
omar
c6e370a77a TreeNode: Added ImGuiTreeNodeFlags_FramePadding flag 2017-10-11 15:16:11 +02:00
omar
69dd895358 Nav: Renaming NavInitDefaultRequest -> NavInitRequest 2017-10-06 15:54:29 -07:00
omar
4d83078885 Nav: Moving code next to its peers 2017-10-06 15:50:32 -07:00
omar
d2975115cd Nav: Caching into g.NavAnyRequest to minimize hot path cost (and so we can add many more request sources) 2017-10-06 15:14:28 -07:00
omar
d91b093be6 Nav: Minor tweaks in NavProcessItem() used by ItemAdd() 2017-10-06 14:56:25 -07:00
omar
c3105919ba Nav: Minor tweaks also toward removing processing from ItemAdd() 2017-10-06 14:51:15 -07:00
omar
d16309ca77 Internal: ItemAdd() minor shallow tweaks 2017-10-06 14:40:53 -07:00
omar
64ce83b9ed Merge branch 'master' into navigation
# Conflicts:
#	imgui.cpp
#	imgui_internal.h
2017-10-06 14:27:29 -07:00
omar
042153d254 Internal: ItemAdd(), IsClippedEx(): removed unnecessary indirection for ID parameter 2017-10-06 14:23:18 -07:00
omar
acb6f12d2c Removed extraneous calls to GetCurrentWindowRead() when we already have a ImGuiContext. Internal RenderXXX functions also don't need to write into the Accessed field at all. 2017-10-06 11:48:07 -07:00
omar
6e1199c603 Merge branch 'master' into navigation 2017-10-06 11:24:58 -07:00
omar
f451785c9e Nav: Shuffled code in ItemAdd() so that NavProcessItem() may have access to LastItemId (will be required by tabbing) 2017-10-06 10:17:01 -07:00
omar
e12cfa9dfd Nav: Minor midying up and comments, 2017-10-06 09:44:50 -07:00
omar
40df7a5155 Nav: Removed possibly redundant test prior to calling NavProcessItem() from ItemAdd() 2017-10-06 09:40:13 -07:00
omar
a77dd02e8a Nav: Moving code next to its peers 2017-10-05 22:06:46 -07:00
omar
f5bd4663dd Nav: Moving the big chunk of code from ItemAdd() to NavProcessItem() 2017-10-05 22:02:13 -07:00
omar
59c6f35bf6 Added ActivateItem(), GetItemID() functions. 2017-10-05 21:34:01 -07:00
omar
80c4e2fe7b Nav: Tidying up activation mechanism so that setting NavActivateId can trigger buttons. 2017-10-05 21:27:08 -07:00
omar
d851775c80 ColorButton: Reduced bordering artefact that would be particularly visible with opaque Col_FrameBg and FrameRounding enabled. 2017-10-05 17:55:27 -07:00
omar
726dcf0dd2 TextUnformatted(): minor tweak 2017-10-05 11:03:38 -07:00
omar
a0d724b450 Made AlignFirstTextHeightToWidgets() saner and faster (still disliking its name very much!) 2017-10-05 11:02:23 -07:00
omar
a3d0755181 Merge branch 'master' into navigation 2017-10-05 10:31:37 -07:00
omar
f326fac64a Nav: Menus and popups now have move request wrap around vertically (using the move request forward thing added recently). (#787) 2017-10-05 10:29:17 -07:00
omar
a8788e51a7 SetKeyboardFocusHere() added assert to prevent passing values smaller than -1 as we may have to outlaw them (I think nobody was using that) 2017-10-05 09:53:07 -07:00
omar
63cd2bf9b1 Removed obsolete comment. 2017-10-05 09:40:06 -07:00
omar
3ddcdcf6e7 Merge branch 'master' into navigation 2017-10-04 18:46:09 -07:00
omar
67ac7da30f Styles: Added ImGuiStyle::ScaleAllSizes(float) helper to make it easier to have application transition to e.g. High DPI with a matching style. 2017-10-04 18:13:57 -07:00
omar
a56b71e866 Nav: Added code to render thin highlight type. (#787) 2017-10-04 10:44:27 -07:00
matiTechno
b36a043bbf typo 2017-10-04 11:09:21 +02:00
omar
6ea90af6b7 Nav: Highlight clipped within host window then extruded out. (#787) 2017-10-03 13:53:17 -07:00
omar
cb4e6c8212 Nav: Selectable(): activating selectable also sets NavId + removed the MouseDelta test (added in 43ee5d73e9, #323) as I don't think it is needed. (#787) 2017-10-03 13:44:48 -07:00
omar
64a51327d3 Nav: Added NavMoveResultParentId internal info to record when the parent/context of a given NavId. Useful for various algorithms (currently looking at range selection stuff) (#787) 2017-10-03 13:25:40 -07:00
omar
74da533c93 Nav: Added NavJustNavigatedId internal info to record when we land on a given item after a navigation request, useful for various algorithms (currently looking at range selection stuff) (#787) 2017-10-03 11:22:38 -07:00
omar
7f58bb03c1 Changed the internal name formatting of child windows to use slashes as separator, more readable. 2017-10-02 16:07:34 -07:00
omar
cbc9730798 Metrics: Draw window bounding boxes when hovering Pos/Size. List all draw layers, trimming empty commands like Render() does. 2017-10-02 16:07:33 -07:00
omar
491edfd8d8 Nav: Fixed a crash introduced yesterday. 2017-09-30 23:46:23 +02:00
omar
0046c618b0 Nav: Allow to collapse tree nodes with NavLeft and open them with NavRight (#787, #1079) 2017-09-30 00:47:07 +02:00
omar
ecd72cc0c7 Nav: Disabled the final axial check when considering candidates in most situations except menubars.
It's definitively undesirable inside Menu as we want to catch nav request failures reliably.
I think it may be considered as an option if we find this desirable i some circumstances. Right now ideally I'd remove it totally but with current scoring setup, without it we can't easily reach the Window Close button. (#787)
2017-09-30 00:26:55 +02:00
omar
88a354585a Nav: It's now possible to navigate sibling of a menu-bar while navigating inside one of their child. If a Left<>Right navigation request fails to find a match we forward the request to the root menu. (#787, #126)
Currently the sibling menu is isn't automatically opened, that's still left to it (and even that can be anoying in Windows when the first menu-item is a child menu)
2017-09-29 23:39:34 +02:00
omar
f4e4c38705 BeginMenu(): fixed logic to distinguish vertical menu from one layed out in a menu bar. Makes MenuItem() in a regular window behave more consistently, and this will be also needed by upcoming menu-navigation changes in the nav branch. (#126, #787) 2017-09-29 23:37:14 +02:00
omar
9912f7eef8 BeginMenu(): fixed logic to distinguish vertical menu from one layed out in a menu bar. Makes MenuItem() in a regular window behave more consistently, and this will be also needed by upcoming menu-navigation changes in the nav branch. (#126, #787) 2017-09-29 22:19:53 +02:00
omar
cf3b21179b Nav: Comments 2017-09-29 20:03:02 +02:00
omar
5a9ebeca9e Nav: Fix typo from 9712a81f85 2017-09-29 19:49:20 +02:00
omar
bfaa426f7f Nav: Minor tidying up (adding local variables to be a little more sane). 2017-09-29 19:48:16 +02:00
omar
8a5a29f0be Nav: Renamed internal field. 2017-09-29 19:28:19 +02:00
omar
9712a81f85 Nav: Rectangle rectangle stored per window and per layer as well. Makes things simpler, allows enable us to visualize more data. 2017-09-29 19:26:03 +02:00
omar
54eb4c485e Nav: Marked misleading/broken code that will never execute. 2017-09-29 19:15:24 +02:00
omar
e3c89aeb10 Nav: Fixed menuitems/selectable on menu layer (layer 1) from storing themselves in wrong layer of LastNavIds when hovered.causing inconsistencies and bugs when hovering menu with mouse then pressing ALT to return to layer 0).
NB: this is not a new bug introduced by the previous commit (which is related to nav layers), bug has been there for a while. (#787)
2017-09-29 18:24:43 +02:00
omar
9737efb2f1 Nav: Store per-window last nav id also per-layer so we can easily query them for menu navigation code. (#787) 2017-09-29 17:58:25 +02:00
omar
8a814487fe Merge branch 'master' into navigation
# Conflicts:
#	imgui.cpp
#	imgui_internal.h
2017-09-29 16:30:43 +02:00
omar
fba9353c60 BeginMenu: Shuffling braces around to clarify flow 2017-09-29 16:29:00 +02:00
omar
cf308f4039 Nav: Fixed SetItemDefaultFocus from stealing default focus when we are initializing default focus for a menu bar layer (#787) 2017-09-29 00:20:51 +02:00
omar
f4398226cc Nav: Support for fallback horizontal scrolling with PadLeft/PadRight (nb: fallback scrolling is only used to navigate windows that have no interactive items). (#787) 2017-09-29 00:01:26 +02:00
omar
30b1d85962 Nav: Commiting some better organized Debug helper because this going to stay for a bit. 2017-09-28 23:48:30 +02:00
omar
1f7f54e196 Removed extraneous test. 2017-09-28 22:00:17 +02:00
omar
df366b230e ColorPicker4: Use nav flag to provide a slighly better experience when using navigation (#787, #346) 2017-09-28 20:22:30 +02:00
omar
2d859dee4e Nav: Added ImGuiItemFlags_NoNav item flag 2017-09-28 19:58:01 +02:00
omar
878fa96896 Nav: Re-arranged ItemAdd() to maximize early out (#787) 2017-09-28 19:57:24 +02:00
omar
dd0855de5c ButtonBehavior: Tidying up. 2017-09-28 19:47:45 +02:00
omar
4b4e455c40 Nav: Internal nenaming 2017-09-28 19:41:30 +02:00
omar
e0a2a832cd Nav: Changed internal flag to NoNavDefaultFocus to be false by allow, and more consistent (#787) 2017-09-28 19:18:41 +02:00
omar
af38749ea1 Nav: Fixed ButtonBehavior mistakenly setting active id when the Activate button is held and we have a new NavId, which affected browsing some popups (#787) 2017-09-28 19:07:52 +02:00
omar
ca4db8c905 Merge branch 'master' into navigation
# Conflicts:
#	imgui.cpp
#	imgui_internal.h
2017-09-28 17:40:25 +02:00
omar
e8f7c83138 Begin: Shallow tweak to minimize diff with nav branch 2017-09-28 17:37:55 +02:00
omar
926c1cf9a4 Merged from Navigation branch: ImGuiItemFlags_SelectableDontClosePopup flag 2017-09-28 17:02:28 +02:00
omar
f99348711b Added VerticalSeparator() entry point in imgui_internal. Seperator() in an horizontal layout context still does that. 2017-09-28 16:41:01 +02:00
omar
9142002121 Separator(): Tweak Logging so that the separator text is aligned according to tree padding. 2017-09-28 16:40:28 +02:00
omar
d394c7ad0b Merge branch 'master' into navigation
# Conflicts:
#	imgui.cpp
#	imgui_internal.h
2017-09-28 15:45:35 +02:00
omar
0106dcbd02 Fixed IsItemHovered() - part of the processing has to be done in ItemAdd() because the widget may alter clipping rectangle temporarily. 2017-09-28 15:43:26 +02:00
omar
2a8eb618dc Nav: Fixed NavDown to open menu from a menu bar (#787) 2017-09-28 00:36:58 +02:00
omar
35f65e05ed Merge branch 'master' into navigation 2017-09-28 00:33:29 +02:00
omar
fafe65a8fc Refactor to move the responsability of SetHovered() to ItemHoverable() - previously IsHovered(). Simpler and the parallel to ItemAdd is clearer with the new name. 2017-09-28 00:21:47 +02:00
omar
2159629e9e Removed another msileading difference between the hovered functions (IsWindowContentHoverable() uses the root window already). Sorry for the commit spam! (making small commit to easily be able to Bisect those in case I make a mistake) 2017-09-28 00:05:35 +02:00
omar
eca74d55c7 IsItemHovered(), IsHovered(): Shallow tweaks, eventually removed all the braces. 2017-09-28 00:05:18 +02:00
omar
2b7d4c713e Internals: Moved IsWindowContentHoverable() in the file 2017-09-27 23:31:03 +02:00
omar
c5a79deb38 IsItemHovered(), IsHovered(): Shallow tweaks to make them more symetrical. Removed one set of braces. 2017-09-27 23:10:46 +02:00
omar
7bcb1d3816 Internals: ButtonBehavior(), IsHovered() moved the responsability of flatten_child higher level to ButtonBehavior() - not super sure about the elegance of this 2017-09-27 22:59:40 +02:00
omar
79ef64430c Nav: Fixed merge cc26db8ec7 2017-09-27 17:27:21 +02:00
omar
cc26db8ec7 Merge branch 'master' into navigation 2017-09-27 17:25:50 +02:00
omar
0adcddac39 IsItemHovered(), ItemAdd(): finishing cleaning up, moved the code to IsItemHovered() so ItemAdd() is more lightweight and the two IsXXXHovered functions are now very similar, making their differences less confusing. 2017-09-27 17:21:50 +02:00
omar
19e22baa06 ItemAdd(): more re-ordering of tests to match IsHovered() + comments 2017-09-27 17:06:07 +02:00
omar
344d48be31 IsItemHovered(), ItemAdd(): Fixed seemingly unnecessary comparaison of root windows, makes IsItemHovered() more consistent with internal IsHovered().
Original test was added in 6e99688fa7 should not have been using RootWindow in the first place.
The difference between public-facing and internal versions would only be noticeable with overlapped child windows, which doesn't really happen anyway
2017-09-27 16:49:25 +02:00
omar
c075786d8b ItemAdd(): re-ordering the tests, submission should now be faster. 2017-09-27 16:29:46 +02:00
omar
99c7622a1b ItemAdd(), not performing computation for IsItemRectHovered() which does them itself, allowing us in the next commit to optimize ItemAdd() and make its logic more consistent with IsHovered(). 2017-09-27 16:20:53 +02:00
omar
e87ad328e4 Moved implementation of Hovered-related functions next to each others + comments, before I attempt to work on them. No functional change here. 2017-09-27 16:07:47 +02:00
omar
869732c456 Nav: Removed unnecessary combo code (that kept the combo arrow highlighted after reverting to mouse controls). (#787) 2017-09-27 12:34:18 +02:00
omar
a2b2e56e8e Merge branch 'master' into navigation 2017-09-27 12:31:12 +02:00
omar
e56eba44fe Fixed not being able to move a window by clicking on one of its child window (#1337, #635), broken by 313d388bba 2017-09-27 12:25:40 +02:00
omar
8374a454da Removed extraneous ImGui:: prefixes. Declared ColorEditOptionsPopup in imgui_internals.h. Tweaked internal signatures. 2017-09-27 11:39:13 +02:00
omar
bbd6d5d5b5 Combo: Cleaned up, removed unnecessary code (looks like this part went untouched for a long time!). 2017-09-27 00:20:09 +02:00
omar
8fd4beddb8 Merge branch 'master' into navigation 2017-09-26 20:28:40 +02:00
omar
9e1ad7295f ImFont: Renamed (supposedly internal) fields (e.g. XAdvance to AdvanceX). Custom text renderers might be affected if they didn't use the GetCharAdvance() helper function. 2017-09-26 20:05:16 +02:00
omar
10bb9524eb ImFont: Renamed ImFont::Glyph to ImFontGlyph (for consistency and so ImFontAtlas types can use it without ordering half of the file). Left a redirection type. 2017-09-26 19:54:30 +02:00
omar
f1a20ec66d Merge branch 'master' into navigation 2017-09-26 16:54:37 +02:00
omar
be03882a15 Separator(): output vertical separator when used in horizontal layout mode, so it works in menu bars. 2017-09-26 15:43:48 +02:00
omar
c7a606ab7e Horizontal layout does the minimum job to be usable internally - not exposed (#97) 2017-09-26 15:42:55 +02:00
omar
728deff56c Comments, debug code (commented), todo list 2017-09-26 15:33:57 +02:00
omar
82748df71a WantCaptureMouse: Tweaked logic so WantCaptureMouse can stay false when e.g. hovering over void while an InputText() is active. (#621) 2017-09-26 01:12:09 +02:00
omar
69d0d33451 Exposed PushMultiItemsWidths() to imgui_internal.h 2017-09-25 22:45:10 +02:00
omar
24f21bd4d4 Merge pull request #1113 from Urmeli0815/ImGuiSelectableFlags_MenuItem
MenuItem: only activate on Release, not on Click (nb: and not on ClickRelease to allow opening menu and selecting something with a single click. Windows seems to behave the same, allowing to click and hold to e.g. Open then move cursor, release on Save and save gets activated)
2017-09-25 22:13:38 +02:00
omar
7e8069dd23 Merge branch 'master' into navigation 2017-09-25 22:08:38 +02:00
omar
c0547d358d Begin: Fixed auto-fit calculation code that predict the presence of ascrollbar so it works in the case size constraints are used. I actually don't need this fix now, but earlier experiment with BeginCombo() required this fix. 2017-09-25 22:04:39 +02:00
omar
4b2781fe87 Begin: Moving some code into a CalcSizeAutoFit() function. 2017-09-25 21:57:42 +02:00
omar
0d56140b4a BeginCombo(): rework internals a little to make it easier to provide custom combo-like elements relying in BeginCombo().
BeginPopupEx() doesn't enforce AlwaysAutoResize flag anymore.
2017-09-25 21:45:34 +02:00
omar
4b82759598 SetNextWindowPos: added a ImVec2 pivot parameter for positioning a given a center, bottom-right position, etc. As a generalization of SetNextWindowPosCenter() which is now obsolete. This will be useful for combo-like popups as well.
Demo: Simple-overlay window uses the SetWindowPos pivot to select a corner to position itself at.
2017-09-25 18:25:43 +02:00
omar
0a55573288 Begin(): Minor tidying up of flow 2017-09-25 15:48:52 +02:00
omar
9f34925b2a Window: Tweaked ApplySizeFullWithConstraint() -> CalcSizeFullWithConstraint() so it can be used without side-effect 2017-09-25 13:23:25 +02:00
omar
0a5fb24f10 Popups: Exposing a little more of popups internals in imgui_internals.h 2017-09-25 12:52:06 +02:00
omar
b9c185402e Nav: minor tidying up NavUpdate() to use a local variables, easier to test replacing g.NavWindow with g NavMoveResultWindow for navigation accross flattened child windows. 2017-09-20 23:58:56 +02:00
omar
113b2467cd Minor bits. Reduce usage of GImGui multiple times in same function. 2017-09-20 23:02:06 +02:00
omar
479e532f18 ColorEdit: fixed weird ternary pattern that makes some compiler warning (fair) 2017-09-18 21:41:49 +02:00
omar
f24b5f71ca Merge branch 'master' into navigation 2017-09-18 15:35:47 +02:00
omar
79ce9b74d5 BeginTooltipEx() internal tweaks 2017-09-18 15:35:00 +02:00
omar
44e8d94aba Merge branch 'master' into navigation 2017-09-18 15:32:31 +02:00
omar
105f3b14e4 Merge branch 'master' into styles 2017-09-18 15:11:51 +02:00
omar
9693fd5351 PushStyleVar/PopStyleVar: internal tweaks 2017-09-18 15:07:22 +02:00
omar
7c9e38f60a Style: Moving code in a function to make incoming diff easier to parse. 2017-09-18 15:06:54 +02:00
omar
709653c330 Merge branch 'master' into styles 2017-09-18 15:03:25 +02:00
omar
6c91a1ef7f Minor comments 2017-09-17 23:35:39 +02:00
omar
052999a6ab More consistently uses "Dear ImGui" 2017-09-15 01:31:41 +02:00
omar
54d30d758f Implicit "Debug" window uses a "Debug##Default" identifier to allow the user creating such window with custom flags 2017-09-12 13:16:27 +02:00
omar
62d7fa4324 Merge branch 'master' into navigation
# Conflicts:
#	imgui.cpp
#	imgui_internal.h
2017-09-06 20:33:39 +02:00
omar
f63c03c464 Internals: moved ButtonRepeat and AllowKeyboardFocus bools/stacks to a generic ItemFlags stack. Merged from Navigation branch. 2017-09-06 20:28:36 +02:00
omar
51fcef0c21 BeginCombo() tweaks, merged from Navigation branch. 2017-09-06 19:31:50 +02:00
omar
5c4fda0fbc Merge branch 'master' into navigation
# Conflicts:
#	imgui.cpp
#	imgui_internal.h
2017-09-06 19:17:51 +02:00
omar
2169bf6895 Fixed WantTextInput from being true when an activated Drag or Slider was previously turned into an InputText(). (#1317) 2017-09-06 17:25:36 +02:00
omar
790605e359 Minor comments + renaming internal fields 2017-09-06 17:20:54 +02:00
Václav Patejdl
e1a7aa41cb Improved ColorPicker hue wheel color interpolation 2017-09-05 16:31:54 +02:00
omar
2600b28f5d Begin(): fixed calling Begin() more than once per frame setting window_just_activated_by_user which in turn would set Appearing to true for that frame. 2017-09-04 13:29:57 +02:00
omar
6400f2900a Begin(): renamed locals. 2017-09-04 13:26:46 +02:00
omar
a9c6a0f6ec Begin(): Removed unnecessary code (at the time of 1.18 commit e9e0e36f98, CursorPos was used to compute SizeContentsFit and this was necessary) 2017-09-04 13:24:45 +02:00
omar
89cae37b49 Begin(): Tidying up some code, should be a no-op. 2017-09-04 13:05:20 +02:00
omar
8fbe8709f9 TODO, minor tweak 2017-09-04 13:03:04 +02:00
omar
e8dbf1c795 Combo: Internally split into BeginCombo(), EndCombo(), toward a more flexible combo api. 2017-09-01 22:10:13 +02:00
omar
5658675e9d Combo: Removed unnecessary ClearActiveId() call (from era where active combo stored an id, now we just use popup functionality) 2017-09-01 21:58:58 +02:00
omar
804ee78731 Added IsWindowAppearing(). 2017-09-01 21:55:59 +02:00
Branimir Karadžić
670d40642f Fixed C4267 conversion from size_t to int. 2017-09-01 14:42:49 +08:00