From 94b7c9e307e36d7f6f0015d780df2964c024e9e6 Mon Sep 17 00:00:00 2001 From: Emmanuel Durand Date: Mon, 11 May 2015 10:15:22 -0400 Subject: [PATCH 1/2] Input text flags added to InputFloatN and InputIntN --- imgui.cpp | 32 ++++++++++++++++---------------- imgui.h | 12 ++++++------ 2 files changed, 22 insertions(+), 22 deletions(-) diff --git a/imgui.cpp b/imgui.cpp index ca53c4a79..8dc6ac2de 100644 --- a/imgui.cpp +++ b/imgui.cpp @@ -6703,7 +6703,7 @@ bool ImGui::InputText(const char* label, char* buf, size_t buf_size, ImGuiInputT return value_changed; } -static bool InputFloatN(const char* label, float* v, int components, int decimal_precision) +static bool InputFloatN(const char* label, float* v, int components, int decimal_precision, ImGuiInputTextFlags flags) { ImGuiState& g = *GImGui; ImGuiWindow* window = GetCurrentWindow(); @@ -6727,7 +6727,7 @@ static bool InputFloatN(const char* label, float* v, int components, int decimal ImGui::PopItemWidth(); ImGui::PushItemWidth(w_item_last); } - value_changed |= ImGui::InputFloat("##v", &v[i], 0, 0, decimal_precision); + value_changed |= ImGui::InputFloat("##v", &v[i], 0, 0, decimal_precision, flags); ImGui::SameLine(0, (int)style.ItemInnerSpacing.x); ImGui::PopID(); } @@ -6741,22 +6741,22 @@ static bool InputFloatN(const char* label, float* v, int components, int decimal return value_changed; } -bool ImGui::InputFloat2(const char* label, float v[2], int decimal_precision) +bool ImGui::InputFloat2(const char* label, float v[2], int decimal_precision, ImGuiInputTextFlags flags) { - return InputFloatN(label, v, 2, decimal_precision); + return InputFloatN(label, v, 2, decimal_precision, flags); } -bool ImGui::InputFloat3(const char* label, float v[3], int decimal_precision) +bool ImGui::InputFloat3(const char* label, float v[3], int decimal_precision, ImGuiInputTextFlags flags) { - return InputFloatN(label, v, 3, decimal_precision); + return InputFloatN(label, v, 3, decimal_precision, flags); } -bool ImGui::InputFloat4(const char* label, float v[4], int decimal_precision) +bool ImGui::InputFloat4(const char* label, float v[4], int decimal_precision, ImGuiInputTextFlags flags) { - return InputFloatN(label, v, 4, decimal_precision); + return InputFloatN(label, v, 4, decimal_precision, flags); } -static bool InputIntN(const char* label, int* v, int components) +static bool InputIntN(const char* label, int* v, int components, ImGuiInputTextFlags flags) { ImGuiState& g = *GImGui; ImGuiWindow* window = GetCurrentWindow(); @@ -6780,7 +6780,7 @@ static bool InputIntN(const char* label, int* v, int components) ImGui::PopItemWidth(); ImGui::PushItemWidth(w_item_last); } - value_changed |= ImGui::InputInt("##v", &v[i], 0, 0); + value_changed |= ImGui::InputInt("##v", &v[i], 0, 0, flags); ImGui::SameLine(0, (int)style.ItemInnerSpacing.x); ImGui::PopID(); } @@ -6794,19 +6794,19 @@ static bool InputIntN(const char* label, int* v, int components) return value_changed; } -bool ImGui::InputInt2(const char* label, int v[2]) +bool ImGui::InputInt2(const char* label, int v[2], ImGuiInputTextFlags flags) { - return InputIntN(label, v, 2); + return InputIntN(label, v, 2, flags); } -bool ImGui::InputInt3(const char* label, int v[3]) +bool ImGui::InputInt3(const char* label, int v[3], ImGuiInputTextFlags flags) { - return InputIntN(label, v, 3); + return InputIntN(label, v, 3, flags); } -bool ImGui::InputInt4(const char* label, int v[4]) +bool ImGui::InputInt4(const char* label, int v[4], ImGuiInputTextFlags flags) { - return InputIntN(label, v, 4); + return InputIntN(label, v, 4, flags); } static bool Items_ArrayGetter(void* data, int idx, const char** out_text) diff --git a/imgui.h b/imgui.h index 4b2416765..ef9560c26 100644 --- a/imgui.h +++ b/imgui.h @@ -329,13 +329,13 @@ namespace ImGui // Widgets: Input IMGUI_API bool InputText(const char* label, char* buf, size_t buf_size, ImGuiInputTextFlags flags = 0, ImGuiTextEditCallback callback = NULL, void* user_data = NULL); IMGUI_API bool InputFloat(const char* label, float* v, float step = 0.0f, float step_fast = 0.0f, int decimal_precision = -1, ImGuiInputTextFlags extra_flags = 0); - IMGUI_API bool InputFloat2(const char* label, float v[2], int decimal_precision = -1); - IMGUI_API bool InputFloat3(const char* label, float v[3], int decimal_precision = -1); - IMGUI_API bool InputFloat4(const char* label, float v[4], int decimal_precision = -1); + IMGUI_API bool InputFloat2(const char* label, float v[2], int decimal_precision = -1, ImGuiInputTextFlags flags = 0); + IMGUI_API bool InputFloat3(const char* label, float v[3], int decimal_precision = -1, ImGuiInputTextFlags flags = 0); + IMGUI_API bool InputFloat4(const char* label, float v[4], int decimal_precision = -1, ImGuiInputTextFlags flags = 0); IMGUI_API bool InputInt(const char* label, int* v, int step = 1, int step_fast = 100, ImGuiInputTextFlags extra_flags = 0); - IMGUI_API bool InputInt2(const char* label, int v[2]); - IMGUI_API bool InputInt3(const char* label, int v[3]); - IMGUI_API bool InputInt4(const char* label, int v[4]); + IMGUI_API bool InputInt2(const char* label, int v[2], ImGuiInputTextFlags flags = 0); + IMGUI_API bool InputInt3(const char* label, int v[3], ImGuiInputTextFlags flags = 0); + IMGUI_API bool InputInt4(const char* label, int v[4], ImGuiInputTextFlags flags = 0); // Widgets: Trees IMGUI_API bool TreeNode(const char* str_label_id); // if returning 'true' the node is open and the user is responsible for calling TreePop From b3faed610d6f4da89872dd5888e6bae9084d43da Mon Sep 17 00:00:00 2001 From: Emmanuel Durand Date: Mon, 11 May 2015 11:40:08 -0400 Subject: [PATCH 2/2] Renamed flags to extra_flags in last commit --- imgui.cpp | 32 ++++++++++++++++---------------- imgui.h | 12 ++++++------ 2 files changed, 22 insertions(+), 22 deletions(-) diff --git a/imgui.cpp b/imgui.cpp index 8dc6ac2de..f0ee8ec2d 100644 --- a/imgui.cpp +++ b/imgui.cpp @@ -6703,7 +6703,7 @@ bool ImGui::InputText(const char* label, char* buf, size_t buf_size, ImGuiInputT return value_changed; } -static bool InputFloatN(const char* label, float* v, int components, int decimal_precision, ImGuiInputTextFlags flags) +static bool InputFloatN(const char* label, float* v, int components, int decimal_precision, ImGuiInputTextFlags extra_flags) { ImGuiState& g = *GImGui; ImGuiWindow* window = GetCurrentWindow(); @@ -6727,7 +6727,7 @@ static bool InputFloatN(const char* label, float* v, int components, int decimal ImGui::PopItemWidth(); ImGui::PushItemWidth(w_item_last); } - value_changed |= ImGui::InputFloat("##v", &v[i], 0, 0, decimal_precision, flags); + value_changed |= ImGui::InputFloat("##v", &v[i], 0, 0, decimal_precision, extra_flags); ImGui::SameLine(0, (int)style.ItemInnerSpacing.x); ImGui::PopID(); } @@ -6741,22 +6741,22 @@ static bool InputFloatN(const char* label, float* v, int components, int decimal return value_changed; } -bool ImGui::InputFloat2(const char* label, float v[2], int decimal_precision, ImGuiInputTextFlags flags) +bool ImGui::InputFloat2(const char* label, float v[2], int decimal_precision, ImGuiInputTextFlags extra_flags) { - return InputFloatN(label, v, 2, decimal_precision, flags); + return InputFloatN(label, v, 2, decimal_precision, extra_flags); } -bool ImGui::InputFloat3(const char* label, float v[3], int decimal_precision, ImGuiInputTextFlags flags) +bool ImGui::InputFloat3(const char* label, float v[3], int decimal_precision, ImGuiInputTextFlags extra_flags) { - return InputFloatN(label, v, 3, decimal_precision, flags); + return InputFloatN(label, v, 3, decimal_precision, extra_flags); } -bool ImGui::InputFloat4(const char* label, float v[4], int decimal_precision, ImGuiInputTextFlags flags) +bool ImGui::InputFloat4(const char* label, float v[4], int decimal_precision, ImGuiInputTextFlags extra_flags) { - return InputFloatN(label, v, 4, decimal_precision, flags); + return InputFloatN(label, v, 4, decimal_precision, extra_flags); } -static bool InputIntN(const char* label, int* v, int components, ImGuiInputTextFlags flags) +static bool InputIntN(const char* label, int* v, int components, ImGuiInputTextFlags extra_flags) { ImGuiState& g = *GImGui; ImGuiWindow* window = GetCurrentWindow(); @@ -6780,7 +6780,7 @@ static bool InputIntN(const char* label, int* v, int components, ImGuiInputTextF ImGui::PopItemWidth(); ImGui::PushItemWidth(w_item_last); } - value_changed |= ImGui::InputInt("##v", &v[i], 0, 0, flags); + value_changed |= ImGui::InputInt("##v", &v[i], 0, 0, extra_flags); ImGui::SameLine(0, (int)style.ItemInnerSpacing.x); ImGui::PopID(); } @@ -6794,19 +6794,19 @@ static bool InputIntN(const char* label, int* v, int components, ImGuiInputTextF return value_changed; } -bool ImGui::InputInt2(const char* label, int v[2], ImGuiInputTextFlags flags) +bool ImGui::InputInt2(const char* label, int v[2], ImGuiInputTextFlags extra_flags) { - return InputIntN(label, v, 2, flags); + return InputIntN(label, v, 2, extra_flags); } -bool ImGui::InputInt3(const char* label, int v[3], ImGuiInputTextFlags flags) +bool ImGui::InputInt3(const char* label, int v[3], ImGuiInputTextFlags extra_flags) { - return InputIntN(label, v, 3, flags); + return InputIntN(label, v, 3, extra_flags); } -bool ImGui::InputInt4(const char* label, int v[4], ImGuiInputTextFlags flags) +bool ImGui::InputInt4(const char* label, int v[4], ImGuiInputTextFlags extra_flags) { - return InputIntN(label, v, 4, flags); + return InputIntN(label, v, 4, extra_flags); } static bool Items_ArrayGetter(void* data, int idx, const char** out_text) diff --git a/imgui.h b/imgui.h index ef9560c26..d074e4c6a 100644 --- a/imgui.h +++ b/imgui.h @@ -329,13 +329,13 @@ namespace ImGui // Widgets: Input IMGUI_API bool InputText(const char* label, char* buf, size_t buf_size, ImGuiInputTextFlags flags = 0, ImGuiTextEditCallback callback = NULL, void* user_data = NULL); IMGUI_API bool InputFloat(const char* label, float* v, float step = 0.0f, float step_fast = 0.0f, int decimal_precision = -1, ImGuiInputTextFlags extra_flags = 0); - IMGUI_API bool InputFloat2(const char* label, float v[2], int decimal_precision = -1, ImGuiInputTextFlags flags = 0); - IMGUI_API bool InputFloat3(const char* label, float v[3], int decimal_precision = -1, ImGuiInputTextFlags flags = 0); - IMGUI_API bool InputFloat4(const char* label, float v[4], int decimal_precision = -1, ImGuiInputTextFlags flags = 0); + IMGUI_API bool InputFloat2(const char* label, float v[2], int decimal_precision = -1, ImGuiInputTextFlags extra_flags = 0); + IMGUI_API bool InputFloat3(const char* label, float v[3], int decimal_precision = -1, ImGuiInputTextFlags extra_flags = 0); + IMGUI_API bool InputFloat4(const char* label, float v[4], int decimal_precision = -1, ImGuiInputTextFlags extra_flags = 0); IMGUI_API bool InputInt(const char* label, int* v, int step = 1, int step_fast = 100, ImGuiInputTextFlags extra_flags = 0); - IMGUI_API bool InputInt2(const char* label, int v[2], ImGuiInputTextFlags flags = 0); - IMGUI_API bool InputInt3(const char* label, int v[3], ImGuiInputTextFlags flags = 0); - IMGUI_API bool InputInt4(const char* label, int v[4], ImGuiInputTextFlags flags = 0); + IMGUI_API bool InputInt2(const char* label, int v[2], ImGuiInputTextFlags extra_flags = 0); + IMGUI_API bool InputInt3(const char* label, int v[3], ImGuiInputTextFlags extra_flags = 0); + IMGUI_API bool InputInt4(const char* label, int v[4], ImGuiInputTextFlags extra_flags = 0); // Widgets: Trees IMGUI_API bool TreeNode(const char* str_label_id); // if returning 'true' the node is open and the user is responsible for calling TreePop