From 6c008e6e8c49736d3141665dd7753fa8503bfdf2 Mon Sep 17 00:00:00 2001 From: SpaiR Date: Fri, 3 Jul 2020 16:38:18 +0300 Subject: [PATCH] Update binding to Dear ImGui v1.77 --- .../src/main/java/imgui/ImDrawList.java | 2 +- .../src/main/java/imgui/ImFontAtlas.java | 13 +- imgui-binding/src/main/java/imgui/ImGui.java | 302 ++++++++++++------ .../src/main/java/imgui/ImGuiIO.java | 12 +- .../src/main/java/imgui/ImGuiStyle.java | 18 ++ .../src/main/java/imgui/flag/ImGuiCond.java | 8 +- .../main/java/imgui/flag/ImGuiPopupFlags.java | 46 +++ .../java/imgui/flag/ImGuiTabItemFlags.java | 4 + 8 files changed, 284 insertions(+), 121 deletions(-) create mode 100644 imgui-binding/src/main/java/imgui/flag/ImGuiPopupFlags.java diff --git a/imgui-binding/src/main/java/imgui/ImDrawList.java b/imgui-binding/src/main/java/imgui/ImDrawList.java index 1f69287..47b7d31 100644 --- a/imgui-binding/src/main/java/imgui/ImDrawList.java +++ b/imgui-binding/src/main/java/imgui/ImDrawList.java @@ -377,7 +377,7 @@ public final class ImDrawList { // Advanced: Channels // - Use to split render into layers. By switching channels to can render out-of-order (e.g. submit FG primitives before BG primitives) // - Use to minimize draw calls (e.g. if going back-and-forth between multiple clipping rectangles, prefer to append into separate channels then merge at the end) - // Prefer using your own persistent copy of ImDrawListSplitter as you can stack them. + // Prefer using your own persistent instance of ImDrawListSplitter as you can stack them. // Using the ImDrawList::ChannelsXXXX you cannot stack a split over another. public native void channelsSplit(int count); /* diff --git a/imgui-binding/src/main/java/imgui/ImFontAtlas.java b/imgui-binding/src/main/java/imgui/ImFontAtlas.java index 845cec3..99ca730 100644 --- a/imgui-binding/src/main/java/imgui/ImFontAtlas.java +++ b/imgui-binding/src/main/java/imgui/ImFontAtlas.java @@ -473,18 +473,13 @@ public final class ImFontAtlas implements ImGuiDestroyableStruct { // After calling Build(), you can query the rectangle position and render your pixels. // You can also request your rectangles to be mapped as font glyph (given a font + Unicode point), // so you can render e.g. custom colorful icons and use them as regular glyphs. - // Read docs/FONTS.txt for more details about using colorful icons. + // Read docs/FONTS.md for more details about using colorful icons. + // Note: this API may be redesigned later in order to support multi-monitor varying DPI settings. - /** - * Id needs to be {@code >=} 0x110000. Id {@code >=} 0x80000000 are reserved for ImGui and ImDrawList - */ - public native int addCustomRectRegular(int id, int width, int height); /* - return IM_FONT_ATLAS->AddCustomRectRegular((unsigned int)id, width, height); + public native int addCustomRectRegular(int width, int height); /* + return IM_FONT_ATLAS->AddCustomRectRegular(width, height); */ - /** - * Id needs to be {@code <} 0x110000 to register a rectangle to map into a specific font. - */ public int addCustomRectFontGlyph(final ImFont imFont, final short id, final int width, final int height, final float advanceX) { return nAddCustomRectFontGlyph(imFont.ptr, id, width, height, advanceX); } diff --git a/imgui-binding/src/main/java/imgui/ImGui.java b/imgui-binding/src/main/java/imgui/ImGui.java index 8fc25a8..ff640d6 100644 --- a/imgui-binding/src/main/java/imgui/ImGui.java +++ b/imgui-binding/src/main/java/imgui/ImGui.java @@ -363,6 +363,8 @@ public final class ImGui { // - You may append multiple times to the same window during the same frame. // - Passing 'bool* pOpen != NULL' shows a window-closing widget in the upper-right corner of the window, // which clicking will set the boolean to false when clicked. + // - You may append multiple times to the same window during the same frame by calling Begin()/End() pairs multiple times. + // Some information such as 'flags' or 'p_open' will only be considered by the first call to Begin(). // - Begin() return false to indicate the window is collapsed or fully clipped, so you may early out and omit submitting // anything to the window. Always call a matching End() for each Begin() call, regardless of its return value! // [Important: due to legacy reason, this is inconsistent with most other functions such as BeginMenu/EndMenu, @@ -1065,7 +1067,7 @@ public final class ImGui { // Cursor / Layout // - By "cursor" we mean the current output position. // - The typical widget behavior is to output themselves at the current cursor position, then move the cursor one line down. - // - You can call SameLine() between widgets to undo the last carriage return and output at the right of the preceeding widget. + // - You can call SameLine() between widgets to undo the last carriage return and output at the right of the preceding widget. // - Attention! We currently have inconsistencies between window-local and absolute positions we will aim to fix with future API: // Window-local coordinates: SameLine(), GetCursorPos(), SetCursorPos(), GetCursorStartPos(), GetContentRegionMax(), GetWindowContentRegion*(), PushTextWrapPos() // Absolute coordinate: GetCursorScreenPos(), SetCursorScreenPos(), all ImDrawList:: functions. @@ -3779,135 +3781,54 @@ public final class ImGui { */ // Popups, Modals - // The properties of popups windows are: - // - They block normal mouse hovering detection outside them. (*) - // - Unless modal, they can be closed by clicking anywhere outside them, or by pressing ESCAPE. - // - Their visibility state (~bool) is held internally by imgui instead of being held by the programmer as we are used to with regular Begin() calls. - // User can manipulate the visibility state by calling OpenPopup(). - // - We default to use the right mouse (ImGuiMouseButton_Right=1) for the Popup Context functions. - // (*) You can use IsItemHovered(ImGuiHoveredFlags_AllowWhenBlockedByPopup) to bypass it and detect hovering even when normally blocked by a popup. - // Those three properties are connected. The library needs to hold their visibility state because it can close popups at any time. + // - They block normal mouse hovering detection (and therefore most mouse interactions) behind them. + // - If not modal: they can be closed by clicking anywhere outside them, or by pressing ESCAPE. + // - Their visibility state (~bool) is held internally instead of being held by the programmer as we are used to with regular Begin*() calls. + // - The 3 properties above are related: we need to retain popup visibility state in the library because popups may be closed as any time. + // - You can bypass the hovering restriction by using ImGuiHoveredFlags_AllowWhenBlockedByPopup when calling IsItemHovered() or IsWindowHovered(). + // - IMPORTANT: Popup identifiers are relative to the current ID stack, so OpenPopup and BeginPopup generally needs to be at the same level of the stack. + // This is sometimes leading to confusing mistakes. May rework this in the future. + // Popups: begin/end functions + // - BeginPopup(): query popup state, if open start appending into the window. Call EndPopup() afterwards. ImGuiWindowFlags are forwarded to the window. + // - BeginPopupModal(): block every interactions behind the window, cannot be closed by user, add a dimming background, has a title bar. /** - * Call to mark popup as open (don't call every frame!). - * Popups are closed when user click outside, or if CloseCurrentPopup() is called within a BeginPopup()/EndPopup() block. - * By default, Selectable()/MenuItem() are calling CloseCurrentPopup(). - * Popup identifiers are relative to the current ID-stack (so OpenPopup and BeginPopup needs to be at the same level). - */ - public static native void openPopup(String strId); /* - ImGui::OpenPopup(strId); - */ - - /** - * Return true if the popup is open, and you can start outputting to it. only call EndPopup() if BeginPopup() returns true! + * Return true if the popup is open, and you can start outputting to it. */ public static native boolean beginPopup(String strId); /* return ImGui::BeginPopup(strId); */ /** - * Return true if the popup is open, and you can start outputting to it. only call EndPopup() if BeginPopup() returns true! + * Return true if the popup is open, and you can start outputting to it. */ public static native boolean beginPopup(String strId, int imGuiWindowFlags); /* return ImGui::BeginPopup(strId, imGuiWindowFlags); */ /** - * helper to open and begin popup when clicked on last item. if you can pass a NULL strId only if the previous item had an id. - * If you want to use that on a non-interactive item such as Text() you need to pass in an explicit ID here. read comments in .cpp! - */ - public static native boolean beginPopupContextItem(); /* - return ImGui::BeginPopupContextItem(); - */ - - /** - * helper to open and begin popup when clicked on last item. if you can pass a NULL strId only if the previous item had an id. - * If you want to use that on a non-interactive item such as Text() you need to pass in an explicit ID here. read comments in .cpp! - */ - public static native boolean beginPopupContextItem(String strId); /* - return ImGui::BeginPopupContextItem(strId); - */ - - /** - * helper to open and begin popup when clicked on last item. if you can pass a NULL strId only if the previous item had an id. - * If you want to use that on a non-interactive item such as Text() you need to pass in an explicit ID here. read comments in .cpp! - */ - public static native boolean beginPopupContextItem(String strId, int mouseButton); /* - return ImGui::BeginPopupContextItem(strId, mouseButton); - */ - - /** - * Helper to open and begin popup when clicked on current window. - */ - public static native boolean beginPopupContextWindow(); /* - return ImGui::BeginPopupContextWindow(); - */ - - /** - * Helper to open and begin popup when clicked on current window. - */ - public static native boolean beginPopupContextWindow(String strId); /* - return ImGui::BeginPopupContextWindow(strId); - */ - - /** - * Helper to open and begin popup when clicked on current window. - */ - public static native boolean beginPopupContextWindow(String strId, int mouseButton); /* - return ImGui::BeginPopupContextWindow(strId, mouseButton); - */ - - /** - * Helper to open and begin popup when clicked on current window. - */ - public static native boolean beginPopupContextWindow(String strId, int mouseButton, boolean alsoOverItems); /* - return ImGui::BeginPopupContextWindow(strId, mouseButton, alsoOverItems); - */ - - /** - * Helper to open and begin popup when clicked in void (where there are no imgui windows). - */ - public static native boolean beginPopupContextVoid(); /* - return ImGui::BeginPopupContextVoid(); - */ - - /** - * Helper to open and begin popup when clicked in void (where there are no imgui windows). - */ - public static native boolean beginPopupContextVoid(String strId); /* - return ImGui::BeginPopupContextVoid(strId); - */ - - /** - * Helper to open and begin popup when clicked in void (where there are no imgui windows). - */ - public static native boolean beginPopupContextVoid(String strId, int mouseButton); /* - return ImGui::BeginPopupContextVoid(strId, mouseButton); - */ - - /** - * Modal dialog (regular window with title bar, block interactions behind the modal window, can't close the modal window by clicking outside) + * Return true if the popup is open, and you can start outputting to it. */ public static native boolean beginPopupModal(String name); /* return ImGui::BeginPopupModal(name); */ /** - * Modal dialog (regular window with title bar, block interactions behind the modal window, can't close the modal window by clicking outside) + * Return true if the popup is open, and you can start outputting to it. */ public static boolean beginPopupModal(String name, ImBoolean pOpen) { return nBeginPopupModal(name, pOpen.getData(), 0); } /** - * Modal dialog (regular window with title bar, block interactions behind the modal window, can't close the modal window by clicking outside) + * Return true if the popup is open, and you can start outputting to it. */ public static boolean beginPopupModal(String name, int imGuiWindowFlags) { return nBeginPopupModal(name, imGuiWindowFlags); } /** - * Modal dialog (regular window with title bar, block interactions behind the modal window, can't close the modal window by clicking outside) + * Return true if the popup is open, and you can start outputting to it. */ public static boolean beginPopupModal(String name, ImBoolean pOpen, int imGuiWindowFlags) { return nBeginPopupModal(name, pOpen.getData(), imGuiWindowFlags); @@ -3922,15 +3843,74 @@ public final class ImGui { */ /** - * only call EndPopup() if BeginPopupXXX() returns true! + * Only call EndPopup() if BeginPopupXXX() returns true! */ public static native void endPopup(); /* ImGui::EndPopup(); */ + // Popups: open/close functions + // - OpenPopup(): set popup state to open. ImGuiPopupFlags are available for opening options. + // - If not modal: they can be closed by clicking anywhere outside them, or by pressing ESCAPE. + // - CloseCurrentPopup(): use inside the BeginPopup()/EndPopup() scope to close manually. + // - CloseCurrentPopup() is called by default by Selectable()/MenuItem() when activated (FIXME: need some options). + // - Use ImGuiPopupFlags_NoOpenOverExistingPopup to avoid opening a popup if there's already one at the same level. This is equivalent to e.g. testing for !IsAnyPopupOpen() prior to OpenPopup(). + + /** + * Call to mark popup as open (don't call every frame!). + */ + public static native void openPopup(String strId); /* + ImGui::OpenPopup(strId); + */ + + /** + * Call to mark popup as open (don't call every frame!). + */ + public static native void openPopup(String strId, int imGuiPopupFlags); /* + ImGui::OpenPopup(strId, imGuiPopupFlags); + */ + + /** + * Helper to open popup when clicked on last item. return true when just opened. (note: actually triggers on the mouse _released_ event to be consistent with popup behaviors) + */ + public static native void openPopupContextItem(); /* + ImGui::OpenPopupContextItem(); + */ + + /** + * Helper to open popup when clicked on last item. return true when just opened. (note: actually triggers on the mouse _released_ event to be consistent with popup behaviors) + */ + public static native void openPopupContextItem(String strId); /* + ImGui::OpenPopupContextItem(strId); + */ + + /** + * Helper to open popup when clicked on last item. return true when just opened. (note: actually triggers on the mouse _released_ event to be consistent with popup behaviors) + */ + public static native void openPopupContextItem(int imGuiPopupFlags); /* + ImGui::OpenPopupContextItem(NULL, imGuiPopupFlags); + */ + + /** + * Helper to open popup when clicked on last item. return true when just opened. (note: actually triggers on the mouse _released_ event to be consistent with popup behaviors) + */ + public static native void openPopupContextItem(String strId, int imGuiPopupFlags); /* + ImGui::OpenPopupContextItem(strId, imGuiPopupFlags); + */ + + /** + * Manually close the popup we have begin-ed into. + */ + public static native void closeCurrentPopup(); /* + ImGui::CloseCurrentPopup(); + */ + /** * Helper to open popup when clicked on last item (note: actually triggers on the mouse _released_ event to be consistent with popup behaviors). * return true when just opened. + * + * @deprecated use {@link ImGui#openPopupContextItem()} + * @since 1.77 */ public static native boolean openPopupOnItemClick(); /* return ImGui::OpenPopupOnItemClick(); @@ -3939,6 +3919,9 @@ public final class ImGui { /** * Helper to open popup when clicked on last item (note: actually triggers on the mouse _released_ event to be consistent with popup behaviors). * return true when just opened. + * + * @deprecated use {@link ImGui#openPopupContextItem(String)} + * @since 1.77 */ public static native boolean openPopupOnItemClick(String strId); /* return ImGui::OpenPopupOnItemClick(strId); @@ -3947,23 +3930,135 @@ public final class ImGui { /** * Helper to open popup when clicked on last item (note: actually triggers on the mouse _released_ event to be consistent with popup behaviors). * return true when just opened. + * + * @deprecated use {@link ImGui#openPopupContextItem(String, int)} + * @since 1.77 */ public static native boolean openPopupOnItemClick(String strId, int mouseButton); /* return ImGui::OpenPopupOnItemClick(strId, mouseButton); */ + // Popups: open+begin combined functions helpers + // - Helpers to do OpenPopup+BeginPopup where the Open action is triggered by e.g. hovering an item and right-clicking. + // - They are convenient to easily create context menus, hence the name. + // - IMPORTANT: Notice that BeginPopupContextXXX takes ImGuiPopupFlags just like OpenPopup() and unlike BeginPopup(). For full consistency, we may add ImGuiWindowFlags to the BeginPopupContextXXX functions in the future. + // - We exceptionally default their flags to 1 (== ImGuiPopupFlags_MouseButtonRight) for backward compatibility with older API taking 'int mouse_button = 1' parameter. Passing a mouse button to ImGuiPopupFlags is guaranteed to be legal. + /** - * Return true if the popup is open at the current begin-ed level of the popup stack. + * Open+begin popup when clicked on last item. if you can pass a NULL str_id only if the previous item had an id. + * If you want to use that on a non-interactive item such as Text() you need to pass in an explicit ID here. read comments in .cpp! + */ + public static native boolean beginPopupContextItem(); /* + return ImGui::BeginPopupContextItem(); + */ + + /** + * Open+begin popup when clicked on last item. if you can pass a NULL str_id only if the previous item had an id. + * If you want to use that on a non-interactive item such as Text() you need to pass in an explicit ID here. read comments in .cpp! + */ + public static native boolean beginPopupContextItem(String strId); /* + return ImGui::BeginPopupContextItem(strId); + */ + + /** + * Open+begin popup when clicked on last item. if you can pass a NULL str_id only if the previous item had an id. + * If you want to use that on a non-interactive item such as Text() you need to pass in an explicit ID here. read comments in .cpp! + */ + public static native boolean beginPopupContextItem(int imGuiPopupFlags); /* + return ImGui::BeginPopupContextItem(NULL, imGuiPopupFlags); + */ + + /** + * Open+begin popup when clicked on last item. if you can pass a NULL str_id only if the previous item had an id. + * If you want to use that on a non-interactive item such as Text() you need to pass in an explicit ID here. read comments in .cpp! + */ + public static native boolean beginPopupContextItem(String strId, int imGuiPopupFlags); /* + return ImGui::BeginPopupContextItem(strId, imGuiPopupFlags); + */ + + /** + * Open+begin popup when clicked on current window. + */ + public static native boolean beginPopupContextWindow(); /* + return ImGui::BeginPopupContextWindow(); + */ + + /** + * Open+begin popup when clicked on current window. + */ + public static native boolean beginPopupContextWindow(String strId); /* + return ImGui::BeginPopupContextWindow(strId); + */ + + /** + * Open+begin popup when clicked on current window. + */ + public static native boolean beginPopupContextWindow(int imGuiPopupFlags); /* + return ImGui::BeginPopupContextWindow(NULL, imGuiPopupFlags); + */ + + /** + * Open+begin popup when clicked on current window. + */ + public static native boolean beginPopupContextWindow(String strId, int imGuiPopupFlags); /* + return ImGui::BeginPopupContextWindow(strId, imGuiPopupFlags); + */ + + /** + * Helper to open and begin popup when clicked on current window. + * + * @deprecated use {@link ImGui#beginPopupContextWindow(String, int)} + * @since 1.77 + */ + public static native boolean beginPopupContextWindow(String strId, int mouseButton, boolean alsoOverItems); /* + return ImGui::BeginPopupContextWindow(strId, mouseButton, alsoOverItems); + */ + + /** + * Open+begin popup when clicked in void (where there are no windows). + */ + public static native boolean beginPopupContextVoid(); /* + return ImGui::BeginPopupContextVoid(); + */ + + /** + * Open+begin popup when clicked in void (where there are no windows). + */ + public static native boolean beginPopupContextVoid(String strId); /* + return ImGui::BeginPopupContextVoid(strId); + */ + + /** + * Open+begin popup when clicked in void (where there are no windows). + */ + public static native boolean beginPopupContextVoid(int imGuiPopupFlags); /* + return ImGui::BeginPopupContextVoid(NULL, imGuiPopupFlags); + */ + + /** + * Open+begin popup when clicked in void (where there are no windows). + */ + public static native boolean beginPopupContextVoid(String strId, int imGuiPopupFlags); /* + return ImGui::BeginPopupContextVoid(strId, imGuiPopupFlags); + */ + + // Popups: test function + // - IsPopupOpen(): return true if the popup is open at the current BeginPopup() level of the popup stack. + // - IsPopupOpen() with ImGuiPopupFlags_AnyPopupId: return true if any popup is open at the current BeginPopup() level of the popup stack. + // - IsPopupOpen() with ImGuiPopupFlags_AnyPopupId + ImGuiPopupFlags_AnyPopupLevel: return true if any popup is open. + + /** + * Return true if the popup is open. */ public static native boolean isPopupOpen(String strId); /* return ImGui::IsPopupOpen(strId); */ /** - * Close the popup we have begin-ed into. clicking on a MenuItem or Selectable automatically close the current popup. + * Return true if the popup is open. */ - public static native void closeCurrentPopup(); /* - ImGui::CloseCurrentPopup(); + public static native boolean isPopupOpen(String strId, int imGuiPopupFlags); /* + return ImGui::IsPopupOpen(strId, imGuiPopupFlags); */ // Columns @@ -4266,6 +4361,7 @@ public final class ImGui { // Drag and Drop // - [BETA API] API may evolve! + // - If you stop calling BeginDragDropSource() the payload is preserved however it won't have a preview tooltip (we currently display a fallback "..." tooltip as replacement) private static WeakReference objectPayloadRef = null; private static final byte[] OBJECT_PAYLOAD_PLACEHOLDER_DATA = new byte[1]; diff --git a/imgui-binding/src/main/java/imgui/ImGuiIO.java b/imgui-binding/src/main/java/imgui/ImGuiIO.java index 420f88f..5d868ff 100644 --- a/imgui-binding/src/main/java/imgui/ImGuiIO.java +++ b/imgui-binding/src/main/java/imgui/ImGuiIO.java @@ -546,14 +546,14 @@ public final class ImGuiIO { */ /** - * Mouse position, in pixels. Set to ImVec2(-FLT_MAX,-FLT_MAX) if mouse is unavailable (on another screen, etc.) + * Mouse position, in pixels. Set to ImVec2(-FLT_MAX, -FLT_MAX) if mouse is unavailable (on another screen, etc.) */ public native void getMousePos(ImVec2 dstImVec2); /* Jni::ImVec2Cpy(env, &ImGui::GetIO().MousePos, dstImVec2); */ /** - * Mouse position, in pixels. Set to ImVec2(-FLT_MAX,-FLT_MAX) if mouse is unavailable (on another screen, etc.) + * Mouse position, in pixels. Set to ImVec2(-FLT_MAX, -FLT_MAX) if mouse is unavailable (on another screen, etc.) */ public native void setMousePos(float x, float y); /* ImGui::GetIO().MousePos.x = x; @@ -561,7 +561,7 @@ public final class ImGuiIO { */ /** - * Mouse buttons: 0=left, 1=right, 2=middle + extras. ImGui itself mostly only uses left button (BeginPopupContext** are using right button). + * Mouse buttons: 0=left, 1=right, 2=middle + extras (ImGuiMouseButton_COUNT == 5). Dear ImGui mostly uses left and right buttons. * Others buttons allows us to track if the mouse is being used by your application + available to user as a convenience via IsMouse** API. */ public native void getMouseDown(boolean[] buff); /* @@ -570,7 +570,7 @@ public final class ImGuiIO { */ /** - * Mouse buttons: 0=left, 1=right, 2=middle + extras. ImGui itself mostly only uses left button (BeginPopupContext** are using right button). + * Mouse buttons: 0=left, 1=right, 2=middle + extras (ImGuiMouseButton_COUNT == 5). Dear ImGui mostly uses left and right buttons. * Others buttons allows us to track if the mouse is being used by your application + available to user as a convenience via IsMouse** API. */ public native boolean getMouseDown(int idx); /* @@ -578,7 +578,7 @@ public final class ImGuiIO { */ /** - * Mouse buttons: 0=left, 1=right, 2=middle + extras. ImGui itself mostly only uses left button (BeginPopupContext** are using right button). + * Mouse buttons: 0=left, 1=right, 2=middle + extras (ImGuiMouseButton_COUNT == 5). Dear ImGui mostly uses left and right buttons. * Others buttons allows us to track if the mouse is being used by your application + available to user as a convenience via IsMouse** API. */ public native void setMouseDown(int idx, boolean down); /* @@ -586,7 +586,7 @@ public final class ImGuiIO { */ /** - * Mouse buttons: 0=left, 1=right, 2=middle + extras. ImGui itself mostly only uses left button (BeginPopupContext** are using right button). + * Mouse buttons: 0=left, 1=right, 2=middle + extras (ImGuiMouseButton_COUNT == 5). Dear ImGui mostly uses left and right buttons. * Others buttons allows us to track if the mouse is being used by your application + available to user as a convenience via IsMouse** API. */ public native void setMouseDown(boolean[] mouseDown); /* diff --git a/imgui-binding/src/main/java/imgui/ImGuiStyle.java b/imgui-binding/src/main/java/imgui/ImGuiStyle.java index a812ad4..d1f9e68 100644 --- a/imgui-binding/src/main/java/imgui/ImGuiStyle.java +++ b/imgui-binding/src/main/java/imgui/ImGuiStyle.java @@ -81,6 +81,7 @@ public final class ImGuiStyle implements ImGuiDestroyableStruct { /** * Radius of window corners rounding. Set to 0.0f to have rectangular windows. + * Large values tend to lead to variety of artifacts and are not recommended. */ public native float getWindowRounding(); /* return IMGUI_STYLE->WindowRounding; @@ -88,6 +89,7 @@ public final class ImGuiStyle implements ImGuiDestroyableStruct { /** * Radius of window corners rounding. Set to 0.0f to have rectangular windows. + * Large values tend to lead to variety of artifacts and are not recommended. */ public native void setWindowRounding(float windowRounding); /* IMGUI_STYLE->WindowRounding = windowRounding; @@ -409,6 +411,22 @@ public final class ImGuiStyle implements ImGuiDestroyableStruct { IMGUI_STYLE->TabBorderSize = tabBorderSize; */ + /** + * Minimum width for close button to appears on an unselected tab when hovered. + * Set to 0.0f to always show when hovering, set to FLT_MAX to never show close button unless selected. + */ + public native float getTabMinWidthForUnselectedCloseButton(); /* + return IMGUI_STYLE->TabMinWidthForUnselectedCloseButton; + */ + + /** + * Minimum width for close button to appears on an unselected tab when hovered. + * Set to 0.0f to always show when hovering, set to FLT_MAX to never show close button unless selected. + */ + public native void setTabMinWidthForUnselectedCloseButton(float tabMinWidthForUnselectedCloseButton); /* + IMGUI_STYLE->TabMinWidthForUnselectedCloseButton = tabMinWidthForUnselectedCloseButton; + */ + /** * Side of the color button in the ColorEdit4 widget (left/right). Defaults to ImGuiDir_Right. */ diff --git a/imgui-binding/src/main/java/imgui/flag/ImGuiCond.java b/imgui-binding/src/main/java/imgui/flag/ImGuiCond.java index a82eda0..5e22930 100644 --- a/imgui-binding/src/main/java/imgui/flag/ImGuiCond.java +++ b/imgui-binding/src/main/java/imgui/flag/ImGuiCond.java @@ -10,11 +10,15 @@ public final class ImGuiCond { } /** - * Set the variable + * No condition (always set the variable), same as Always. + */ + public static final int None = 0; + /** + * No condition (always set the variable) */ public static final int Always = 1; /** - * Set the variable once per runtime session (only the first call with succeed) + * Set the variable once per runtime session (only the first call will succeed) */ public static final int Once = 1 << 1; /** diff --git a/imgui-binding/src/main/java/imgui/flag/ImGuiPopupFlags.java b/imgui-binding/src/main/java/imgui/flag/ImGuiPopupFlags.java new file mode 100644 index 0000000..4532cc6 --- /dev/null +++ b/imgui-binding/src/main/java/imgui/flag/ImGuiPopupFlags.java @@ -0,0 +1,46 @@ +package imgui.flag; + +/** + * Flags for OpenPopup*(), BeginPopupContext*(), IsPopupOpen() functions. + * - To be backward compatible with older API which took an 'int mouse_button = 1' argument, we need to treat + * small flags values as a mouse button index, so we encode the mouse button in the first few bits of the flags. + * It is therefore guaranteed to be legal to pass a mouse button index in ImGuiPopupFlags. + * - For the same reason, we exceptionally default the ImGuiPopupFlags argument of BeginPopupContextXXX functions to 1 instead of 0. + */ +public final class ImGuiPopupFlags { + private ImGuiPopupFlags() { + } + + public static final int None = 0; + /** + * For BeginPopupContext*(): open on Left Mouse release. Guaranted to always be == 0 (same as ImGuiMouseButton_Left) + */ + public static final int MouseButtonLeft = 0; + /** + * For BeginPopupContext*(): open on Right Mouse release. Guaranted to always be == 1 (same as ImGuiMouseButton_Right) + */ + public static final int MouseButtonRight = 1; + /** + * For BeginPopupContext*(): open on Middle Mouse release. Guaranted to always be == 2 (same as ImGuiMouseButton_Middle) + */ + public static final int MouseButtonMiddle = 2; + public static final int MouseButtonMask = 0x1F; + public static final int MouseButtonDefault = 1; + /** + * For OpenPopup*(), BeginPopupContext*(): don't open if there's already a popup at the same level of the popup stack + */ + public static final int NoOpenOverExistingPopup = 1 << 5; + /** + * For BeginPopupContextWindow(): don't return true when hovering items, only when hovering empty space + */ + public static final int NoOpenOverItems = 1 << 6; + /** + * For IsPopupOpen(): ignore the ImGuiID parameter and test for any popup. + */ + public static final int AnyPopupId = 1 << 7; + /** + * For IsPopupOpen(): search/test at any level of the popup stack (default test in the current level) + */ + public static final int AnyPopupLevel = 1 << 8; + public static final int AnyPopup = AnyPopupId | AnyPopupLevel; +} diff --git a/imgui-binding/src/main/java/imgui/flag/ImGuiTabItemFlags.java b/imgui-binding/src/main/java/imgui/flag/ImGuiTabItemFlags.java index 26d0fe0..9784ad8 100644 --- a/imgui-binding/src/main/java/imgui/flag/ImGuiTabItemFlags.java +++ b/imgui-binding/src/main/java/imgui/flag/ImGuiTabItemFlags.java @@ -26,4 +26,8 @@ public final class ImGuiTabItemFlags { * Don't call PushID(tab.ID)/PopID() on BeginTabItem()/EndTabItem() */ public static final int NoPushId = 1 << 3; + /** + * Disable tooltip for the given tab + */ + public static final int NoTooltip = 1 << 4; }