-
-
Notifications
You must be signed in to change notification settings - Fork 10.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Icons and Popups on headers. #316
Comments
Jeremie, what do you mean by header line? |
Ah sorry I didn't specify, I meant the title bar of windows from calling |
… the rectangle with the current parameters (#316)
You can already use BeginPopupContextItem() or any You can't directly do that for the title bar but it's easy to replicate the content of BeginPopupContentItem() and adjust it for a custom rectangle.
You'll need to update as I added a third parameter to IsMouseHoveredRect() to ignore the current clipping setting. Otherwise you can do |
For icons you can't really trivially, but you can use various approaches. a) Include icons in your font and use them in your title, see #232 If you need the icons to be interactive then maybe it is a little more work. |
Thanks for the info! The context menu does indeed work on collapsing headers, turns out I only tested on a window and assumed headers worked the same way;) I do indeed want icons to act like buttons; basically I'll be using this for flags I still want to toggle when the window or section is collapsed. I'll get back to you over the weekend for the rest, I'm actually using your library from D. I'll need to fork and update both CIMGUI and derelict-imgui before I can try this code ;) Just as a quick idea, how about splitting both windows and sections into separate begin/end calls for both their header and content, something like this:
Curious to know what you think! |
We can't break the existing API but manipulating the header is basically as simple as changing the clipping rectangle, moving the cursor, doing what you need then restoring the cursor. So that possibly could be turned into a high-level helper but before that we'd need to try low level. This app has been doing their own title bar https://github.com/ApoorvaJ/Papaya |
I can't seem to get the new version of IMGUI to work. The shared library loads fine but nothing appears on the screen. If I downgrade to v1.44 everything works again. |
Please open a new thread. I don't know what "shared library" you are talking about, if it is a concept of cimgui or dimgui wrappers. You can git bisect to try to find a bug, but frankly I don't think any of the changes since 1.44 would have broken something of this nature, so I'd guess maybe some of those wrappers weren't rebuild. |
Just found it, turns out e58f991 added the I'm almost to the point where I can try these samples in D, I'll let you know how it goes. |
Oh I didn't realize the D library had to replicate every data structure. |
Yeah, it is ABI compatible with C but not source compatible. Its most likely that way so there's zero runtime overhead yet the language isn't burdened with legacy C syntax. |
Alright I've got the code for window context menus to work, except no popup is showing. I traced the execution and Is there something I'm missing? |
Hard to say without detailed information. What's your code like? |
Damn I feel stupid hehe; I found my problem while pasting the code here and stripping it of application logic. Turns out I was calling I'll try the icons now and see if I can make them clickable with tooltips. |
Hi Jeremie, I have recently added missing high-level version of ImGui::PushClipRect / ImGui::PopClipRect in imgui_internal.h which may be helpful here. The difference with draw_list->PushClipRect() is that the later would only affect rendering while the earlier also affect how hit tests and widget culling are performed. Have you moved forward with this idea? Let me know if this issue can be closed or if there are other desirable changes. |
Adding this back to my mental list today as I'm looking at tree and collapsing headers. Will see how we may be able to make it easier to add custom icons to a collapsing headers. (See #600) |
This example code works fine if the window is not docked, but fails if the window is docked. Is there a way to handle a right click event on a docked window's tab? |
… if group is renamed. Fixes #640. Group renaming only works if group is UNDOCKED (see ocornut/imgui#316) for now.
Includes my merged PRs and everything in my dev branch. Haven't tested with it yet. Changelog: Test case for clip rect HACK: more recent Windows SDK and VS2017; disable graph Set size to amount of space required Merge pull request ocornut#349 from maksw2/master Merge pull request ocornut#347 from mgerhardy/341 Merge pull request ocornut#348 from mgerhardy/fixed-warning Merge pull request ocornut#346 from mgerhardy/280 Merge pull request ocornut#345 from mgerhardy/322 Merge pull request ocornut#344 from rherilier/fix-gcc-warnings Merge pull request ocornut#336 from rherilier/add-isusingviewmanipulate Merge pull request ocornut#335 from RedSkittleFox/alternative_window Merge pull request ocornut#334 from ocornut/fix-beginchildframe dear imgui update and small fixes Merge pull request ocornut#316 from Batres3/2DSupport Merge pull request ocornut#326 from Sayama3/use-push-pop-id Merge pull request ocornut#328 from georgeto/master Merge pull request ocornut#330 from maritim/master Merge pull request ocornut#331 from GiovanyH/patch-1 Merge pull request ocornut#318 from dougbinks/imgui_math_operators Merge pull request ocornut#312 from kimidaisuki22/master div 0 fixed Merge pull request ocornut#301 from ZingBallyhoo/using-any Merge pull request ocornut#300 from Clog41200/Configurable-limits Merge pull request ocornut#298 from xDUDSSx/fix/rotation_circles Merge pull request ocornut#297 from xDUDSSx/fix/vertical-aspect-scaling Merge pull request ocornut#289 from ComputationalBiomechanicsLab/fix_isusing-ignores-setid Merge pull request ocornut#291 from ocornut/fix_math_operators_include Merge pull request ocornut#282 from MohitSethi99/master Merge pull request ocornut#276 from pthom/virtual_destructors Merge pull request ocornut#271 from idbrii/clip-parent Merge pull request ocornut#270 from idbrii/btn-behaviour Merge pull request ocornut#265 from mgerhardy/pr/fix-minor-formatting Merge pull request ocornut#264 from mgerhardy/pr/div0 Merge pull request ocornut#269 from peter1745/hatched-line-thickness-enhancement Merge pull request ocornut#259 from miyanyan/master Merge branch 'master' of https://github.com/CedricGuillemet/ImGuizmo update dear imgui Merge pull request ocornut#256 from Aidiakapi/patch-1 Merge pull request ocornut#252 from aaronkirkham/master Merge pull request ocornut#249 from rokups/rk/mouse-capture Merge pull request ocornut#246 from mgerhardy/pr/viewmanipulate removed commented code fix click view cube Merge pull request ocornut#231 from mgerhardy/master Merge pull request ocornut#230 from mgerhardy/master Merge pull request ocornut#228 from longod/master Merge pull request ocornut#227 from madeso/master AddBezierCubic Merge pull request ocornut#226 from sherief/master revert culling test commit Merge pull request ocornut#203 from rokups/rk/misc-fixes Merge pull request ocornut#212 from zhaijialong/fix-behind-camera-cull Merge pull request ocornut#209 from VictorFouquet/fix_normalize scale is always local Merge pull request ocornut#202 from pezy/master imguizmo namespace Merge pull request ocornut#194 from JonathanHiggs/vcpkg-example 1.84 WIP Merge pull request ocornut#197 from idbrii/seq-btn-color Merge pull request ocornut#196 from idbrii/seq-big-handles
Hello, I'd like to add more icons to the right of a header line but don't seem to find how.
Also I'd like to show a popup menu using
ImGui::BeginPopupContextItem
when the header line is right-clicked but it doesn't work.Thanks! Loving the library so far :)
The text was updated successfully, but these errors were encountered: