|
|
@ -1262,37 +1262,6 @@ namespace ImGuiNET |
|
|
|
float ret = ImGuiNative.igCalcItemWidth(); |
|
|
|
float ret = ImGuiNative.igCalcItemWidth(); |
|
|
|
return ret; |
|
|
|
return ret; |
|
|
|
} |
|
|
|
} |
|
|
|
public static Vector2 CalcTextSize(string text) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
Vector2 __retval; |
|
|
|
|
|
|
|
byte* native_text; |
|
|
|
|
|
|
|
int text_byteCount = 0; |
|
|
|
|
|
|
|
if (text != null) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
text_byteCount = Encoding.UTF8.GetByteCount(text); |
|
|
|
|
|
|
|
if (text_byteCount > Util.StackAllocationSizeLimit) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
native_text = Util.Allocate(text_byteCount + 1); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
else |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
byte* native_text_stackBytes = stackalloc byte[text_byteCount + 1]; |
|
|
|
|
|
|
|
native_text = native_text_stackBytes; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
int native_text_offset = Util.GetUtf8(text, native_text, text_byteCount); |
|
|
|
|
|
|
|
native_text[native_text_offset] = 0; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
else { native_text = null; } |
|
|
|
|
|
|
|
byte* native_text_end = null; |
|
|
|
|
|
|
|
byte hide_text_after_double_hash = 0; |
|
|
|
|
|
|
|
float wrap_width = -1.0f; |
|
|
|
|
|
|
|
ImGuiNative.igCalcTextSize(&__retval, native_text, native_text_end, hide_text_after_double_hash, wrap_width); |
|
|
|
|
|
|
|
if (text_byteCount > Util.StackAllocationSizeLimit) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
Util.Free(native_text); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
return __retval; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
public static void CaptureKeyboardFromApp() |
|
|
|
public static void CaptureKeyboardFromApp() |
|
|
|
{ |
|
|
|
{ |
|
|
|
byte want_capture_keyboard_value = 1; |
|
|
|
byte want_capture_keyboard_value = 1; |
|
|
@ -8305,297 +8274,6 @@ namespace ImGuiNET |
|
|
|
} |
|
|
|
} |
|
|
|
return ret != 0; |
|
|
|
return ret != 0; |
|
|
|
} |
|
|
|
} |
|
|
|
public static bool InputTextWithHint(string label, string hint, string buf, uint buf_size) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
byte* native_label; |
|
|
|
|
|
|
|
int label_byteCount = 0; |
|
|
|
|
|
|
|
if (label != null) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
label_byteCount = Encoding.UTF8.GetByteCount(label); |
|
|
|
|
|
|
|
if (label_byteCount > Util.StackAllocationSizeLimit) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
native_label = Util.Allocate(label_byteCount + 1); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
else |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
byte* native_label_stackBytes = stackalloc byte[label_byteCount + 1]; |
|
|
|
|
|
|
|
native_label = native_label_stackBytes; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
int native_label_offset = Util.GetUtf8(label, native_label, label_byteCount); |
|
|
|
|
|
|
|
native_label[native_label_offset] = 0; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
else { native_label = null; } |
|
|
|
|
|
|
|
byte* native_hint; |
|
|
|
|
|
|
|
int hint_byteCount = 0; |
|
|
|
|
|
|
|
if (hint != null) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
hint_byteCount = Encoding.UTF8.GetByteCount(hint); |
|
|
|
|
|
|
|
if (hint_byteCount > Util.StackAllocationSizeLimit) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
native_hint = Util.Allocate(hint_byteCount + 1); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
else |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
byte* native_hint_stackBytes = stackalloc byte[hint_byteCount + 1]; |
|
|
|
|
|
|
|
native_hint = native_hint_stackBytes; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
int native_hint_offset = Util.GetUtf8(hint, native_hint, hint_byteCount); |
|
|
|
|
|
|
|
native_hint[native_hint_offset] = 0; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
else { native_hint = null; } |
|
|
|
|
|
|
|
byte* native_buf; |
|
|
|
|
|
|
|
int buf_byteCount = 0; |
|
|
|
|
|
|
|
if (buf != null) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
buf_byteCount = Encoding.UTF8.GetByteCount(buf); |
|
|
|
|
|
|
|
if (buf_byteCount > Util.StackAllocationSizeLimit) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
native_buf = Util.Allocate(buf_byteCount + 1); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
else |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
byte* native_buf_stackBytes = stackalloc byte[buf_byteCount + 1]; |
|
|
|
|
|
|
|
native_buf = native_buf_stackBytes; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
int native_buf_offset = Util.GetUtf8(buf, native_buf, buf_byteCount); |
|
|
|
|
|
|
|
native_buf[native_buf_offset] = 0; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
else { native_buf = null; } |
|
|
|
|
|
|
|
ImGuiInputTextFlags flags = (ImGuiInputTextFlags)0; |
|
|
|
|
|
|
|
ImGuiInputTextCallback callback = null; |
|
|
|
|
|
|
|
void* user_data = null; |
|
|
|
|
|
|
|
byte ret = ImGuiNative.igInputTextWithHint(native_label, native_hint, native_buf, buf_size, flags, callback, user_data); |
|
|
|
|
|
|
|
if (label_byteCount > Util.StackAllocationSizeLimit) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
Util.Free(native_label); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
if (hint_byteCount > Util.StackAllocationSizeLimit) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
Util.Free(native_hint); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
if (buf_byteCount > Util.StackAllocationSizeLimit) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
Util.Free(native_buf); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
return ret != 0; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
public static bool InputTextWithHint(string label, string hint, string buf, uint buf_size, ImGuiInputTextFlags flags) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
byte* native_label; |
|
|
|
|
|
|
|
int label_byteCount = 0; |
|
|
|
|
|
|
|
if (label != null) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
label_byteCount = Encoding.UTF8.GetByteCount(label); |
|
|
|
|
|
|
|
if (label_byteCount > Util.StackAllocationSizeLimit) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
native_label = Util.Allocate(label_byteCount + 1); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
else |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
byte* native_label_stackBytes = stackalloc byte[label_byteCount + 1]; |
|
|
|
|
|
|
|
native_label = native_label_stackBytes; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
int native_label_offset = Util.GetUtf8(label, native_label, label_byteCount); |
|
|
|
|
|
|
|
native_label[native_label_offset] = 0; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
else { native_label = null; } |
|
|
|
|
|
|
|
byte* native_hint; |
|
|
|
|
|
|
|
int hint_byteCount = 0; |
|
|
|
|
|
|
|
if (hint != null) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
hint_byteCount = Encoding.UTF8.GetByteCount(hint); |
|
|
|
|
|
|
|
if (hint_byteCount > Util.StackAllocationSizeLimit) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
native_hint = Util.Allocate(hint_byteCount + 1); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
else |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
byte* native_hint_stackBytes = stackalloc byte[hint_byteCount + 1]; |
|
|
|
|
|
|
|
native_hint = native_hint_stackBytes; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
int native_hint_offset = Util.GetUtf8(hint, native_hint, hint_byteCount); |
|
|
|
|
|
|
|
native_hint[native_hint_offset] = 0; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
else { native_hint = null; } |
|
|
|
|
|
|
|
byte* native_buf; |
|
|
|
|
|
|
|
int buf_byteCount = 0; |
|
|
|
|
|
|
|
if (buf != null) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
buf_byteCount = Encoding.UTF8.GetByteCount(buf); |
|
|
|
|
|
|
|
if (buf_byteCount > Util.StackAllocationSizeLimit) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
native_buf = Util.Allocate(buf_byteCount + 1); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
else |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
byte* native_buf_stackBytes = stackalloc byte[buf_byteCount + 1]; |
|
|
|
|
|
|
|
native_buf = native_buf_stackBytes; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
int native_buf_offset = Util.GetUtf8(buf, native_buf, buf_byteCount); |
|
|
|
|
|
|
|
native_buf[native_buf_offset] = 0; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
else { native_buf = null; } |
|
|
|
|
|
|
|
ImGuiInputTextCallback callback = null; |
|
|
|
|
|
|
|
void* user_data = null; |
|
|
|
|
|
|
|
byte ret = ImGuiNative.igInputTextWithHint(native_label, native_hint, native_buf, buf_size, flags, callback, user_data); |
|
|
|
|
|
|
|
if (label_byteCount > Util.StackAllocationSizeLimit) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
Util.Free(native_label); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
if (hint_byteCount > Util.StackAllocationSizeLimit) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
Util.Free(native_hint); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
if (buf_byteCount > Util.StackAllocationSizeLimit) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
Util.Free(native_buf); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
return ret != 0; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
public static bool InputTextWithHint(string label, string hint, string buf, uint buf_size, ImGuiInputTextFlags flags, ImGuiInputTextCallback callback) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
byte* native_label; |
|
|
|
|
|
|
|
int label_byteCount = 0; |
|
|
|
|
|
|
|
if (label != null) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
label_byteCount = Encoding.UTF8.GetByteCount(label); |
|
|
|
|
|
|
|
if (label_byteCount > Util.StackAllocationSizeLimit) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
native_label = Util.Allocate(label_byteCount + 1); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
else |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
byte* native_label_stackBytes = stackalloc byte[label_byteCount + 1]; |
|
|
|
|
|
|
|
native_label = native_label_stackBytes; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
int native_label_offset = Util.GetUtf8(label, native_label, label_byteCount); |
|
|
|
|
|
|
|
native_label[native_label_offset] = 0; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
else { native_label = null; } |
|
|
|
|
|
|
|
byte* native_hint; |
|
|
|
|
|
|
|
int hint_byteCount = 0; |
|
|
|
|
|
|
|
if (hint != null) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
hint_byteCount = Encoding.UTF8.GetByteCount(hint); |
|
|
|
|
|
|
|
if (hint_byteCount > Util.StackAllocationSizeLimit) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
native_hint = Util.Allocate(hint_byteCount + 1); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
else |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
byte* native_hint_stackBytes = stackalloc byte[hint_byteCount + 1]; |
|
|
|
|
|
|
|
native_hint = native_hint_stackBytes; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
int native_hint_offset = Util.GetUtf8(hint, native_hint, hint_byteCount); |
|
|
|
|
|
|
|
native_hint[native_hint_offset] = 0; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
else { native_hint = null; } |
|
|
|
|
|
|
|
byte* native_buf; |
|
|
|
|
|
|
|
int buf_byteCount = 0; |
|
|
|
|
|
|
|
if (buf != null) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
buf_byteCount = Encoding.UTF8.GetByteCount(buf); |
|
|
|
|
|
|
|
if (buf_byteCount > Util.StackAllocationSizeLimit) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
native_buf = Util.Allocate(buf_byteCount + 1); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
else |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
byte* native_buf_stackBytes = stackalloc byte[buf_byteCount + 1]; |
|
|
|
|
|
|
|
native_buf = native_buf_stackBytes; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
int native_buf_offset = Util.GetUtf8(buf, native_buf, buf_byteCount); |
|
|
|
|
|
|
|
native_buf[native_buf_offset] = 0; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
else { native_buf = null; } |
|
|
|
|
|
|
|
void* user_data = null; |
|
|
|
|
|
|
|
byte ret = ImGuiNative.igInputTextWithHint(native_label, native_hint, native_buf, buf_size, flags, callback, user_data); |
|
|
|
|
|
|
|
if (label_byteCount > Util.StackAllocationSizeLimit) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
Util.Free(native_label); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
if (hint_byteCount > Util.StackAllocationSizeLimit) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
Util.Free(native_hint); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
if (buf_byteCount > Util.StackAllocationSizeLimit) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
Util.Free(native_buf); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
return ret != 0; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
public static bool InputTextWithHint(string label, string hint, string buf, uint buf_size, ImGuiInputTextFlags flags, ImGuiInputTextCallback callback, IntPtr user_data) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
byte* native_label; |
|
|
|
|
|
|
|
int label_byteCount = 0; |
|
|
|
|
|
|
|
if (label != null) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
label_byteCount = Encoding.UTF8.GetByteCount(label); |
|
|
|
|
|
|
|
if (label_byteCount > Util.StackAllocationSizeLimit) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
native_label = Util.Allocate(label_byteCount + 1); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
else |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
byte* native_label_stackBytes = stackalloc byte[label_byteCount + 1]; |
|
|
|
|
|
|
|
native_label = native_label_stackBytes; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
int native_label_offset = Util.GetUtf8(label, native_label, label_byteCount); |
|
|
|
|
|
|
|
native_label[native_label_offset] = 0; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
else { native_label = null; } |
|
|
|
|
|
|
|
byte* native_hint; |
|
|
|
|
|
|
|
int hint_byteCount = 0; |
|
|
|
|
|
|
|
if (hint != null) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
hint_byteCount = Encoding.UTF8.GetByteCount(hint); |
|
|
|
|
|
|
|
if (hint_byteCount > Util.StackAllocationSizeLimit) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
native_hint = Util.Allocate(hint_byteCount + 1); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
else |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
byte* native_hint_stackBytes = stackalloc byte[hint_byteCount + 1]; |
|
|
|
|
|
|
|
native_hint = native_hint_stackBytes; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
int native_hint_offset = Util.GetUtf8(hint, native_hint, hint_byteCount); |
|
|
|
|
|
|
|
native_hint[native_hint_offset] = 0; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
else { native_hint = null; } |
|
|
|
|
|
|
|
byte* native_buf; |
|
|
|
|
|
|
|
int buf_byteCount = 0; |
|
|
|
|
|
|
|
if (buf != null) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
buf_byteCount = Encoding.UTF8.GetByteCount(buf); |
|
|
|
|
|
|
|
if (buf_byteCount > Util.StackAllocationSizeLimit) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
native_buf = Util.Allocate(buf_byteCount + 1); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
else |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
byte* native_buf_stackBytes = stackalloc byte[buf_byteCount + 1]; |
|
|
|
|
|
|
|
native_buf = native_buf_stackBytes; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
int native_buf_offset = Util.GetUtf8(buf, native_buf, buf_byteCount); |
|
|
|
|
|
|
|
native_buf[native_buf_offset] = 0; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
else { native_buf = null; } |
|
|
|
|
|
|
|
void* native_user_data = (void*)user_data.ToPointer(); |
|
|
|
|
|
|
|
byte ret = ImGuiNative.igInputTextWithHint(native_label, native_hint, native_buf, buf_size, flags, callback, native_user_data); |
|
|
|
|
|
|
|
if (label_byteCount > Util.StackAllocationSizeLimit) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
Util.Free(native_label); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
if (hint_byteCount > Util.StackAllocationSizeLimit) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
Util.Free(native_hint); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
if (buf_byteCount > Util.StackAllocationSizeLimit) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
Util.Free(native_buf); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
return ret != 0; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
public static bool InvisibleButton(string str_id, Vector2 size) |
|
|
|
public static bool InvisibleButton(string str_id, Vector2 size) |
|
|
|
{ |
|
|
|
{ |
|
|
|
byte* native_str_id; |
|
|
|
byte* native_str_id; |
|
|
|