-
-
Notifications
You must be signed in to change notification settings - Fork 10.2k
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.
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: