From 9fdd6d7e147002f97a4f90a0ca4973e4e5c3544d Mon Sep 17 00:00:00 2001 From: SpaiR Date: Mon, 21 Sep 2020 18:12:17 +0300 Subject: [PATCH] [API] Add internal ImGuiItemFlags api --- .../src/main/java/imgui/internal/ImGui.java | 10 ++++++ .../imgui/internal/flag/ImGuiItemFlags.java | 36 +++++++++++++++++++ 2 files changed, 46 insertions(+) create mode 100644 imgui-binding/src/main/java/imgui/internal/flag/ImGuiItemFlags.java diff --git a/imgui-binding/src/main/java/imgui/internal/ImGui.java b/imgui-binding/src/main/java/imgui/internal/ImGui.java index 5bfec88..945028e 100644 --- a/imgui-binding/src/main/java/imgui/internal/ImGui.java +++ b/imgui-binding/src/main/java/imgui/internal/ImGui.java @@ -11,6 +11,16 @@ public final class ImGui extends imgui.ImGui { #include */ + // Basic Helpers for widget code + + public static native void pushItemFlag(int imGuiItemFlags, boolean enabled); /* + ImGui::PushItemFlag(imGuiItemFlags, enabled); + */ + + public static native void popItemFlag(); /* + ImGui::PopItemFlag(); + */ + // Docking - Builder function needs to be generally called before the node is used/submitted. // - The DockBuilderXXX functions are designed to _eventually_ become a public API, but it is too early to expose it and guarantee stability. // - Do not hold on ImGuiDockNode* pointers! They may be invalidated by any split/merge/remove operation and every frame. diff --git a/imgui-binding/src/main/java/imgui/internal/flag/ImGuiItemFlags.java b/imgui-binding/src/main/java/imgui/internal/flag/ImGuiItemFlags.java new file mode 100644 index 0000000..8579e48 --- /dev/null +++ b/imgui-binding/src/main/java/imgui/internal/flag/ImGuiItemFlags.java @@ -0,0 +1,36 @@ +package imgui.internal.flag; + +/** + * Transient per-window flags, reset at the beginning of the frame. For child window, inherited from parent on first Begin(). + * This is going to be exposed in imgui.h when stabilized enough. + */ +public final class ImGuiItemFlags { + private ImGuiItemFlags() { + } + + public static final int None = 0; + public static final int NoTabStop = 1; + /** + * Button() will return true multiple times based on io.KeyRepeatDelay and io.KeyRepeatRate settings. + */ + public static final int ButtonRepeat = 1 << 1; + /** + * [BETA] Disable interactions but doesn't affect visuals yet. See github.com/ocornut/imgui/issues/211 + */ + public static final int Disabled = 1 << 2; + public static final int NoNav = 1 << 3; + public static final int NoNavDefaultFocus = 1 << 4; + /** + * MenuItem/Selectable() automatically closes current Popup window + */ + public static final int SelectableDontClosePopup = 1 << 5; + /** + * [BETA] Represent a mixed/indeterminate value, generally multi-selection where values differ. + * Currently only supported by Checkbox() (later should support all sorts of widgets) + */ + public static final int MixedValue = 1 << 6; + /** + * [ALPHA] Allow hovering interactions but underlying value is not changed. + */ + public static final int ReadOnly = 1 << 7; +}