mirror of
https://github.com/Drezil/imgui.git
synced 2024-11-22 03:47:00 +00:00
Renamed extra_flags to flags in InputXXX parameters.
This commit is contained in:
parent
c738f9ef92
commit
acacd93836
31
imgui.h
31
imgui.h
@ -433,19 +433,20 @@ namespace ImGui
|
||||
|
||||
// Widgets: Input with Keyboard
|
||||
// - If you want to use InputText() with a dynamic string type such as std::string or your own, see misc/cpp/imgui_stdlib.h
|
||||
// - Most of the ImGuiInputTextFlags flags are only useful for InputText() and not for InputFloatX, InputIntX, InputDouble etc.
|
||||
IMGUI_API bool InputText(const char* label, char* buf, size_t buf_size, ImGuiInputTextFlags flags = 0, ImGuiInputTextCallback callback = NULL, void* user_data = NULL);
|
||||
IMGUI_API bool InputTextMultiline(const char* label, char* buf, size_t buf_size, const ImVec2& size = ImVec2(0,0), ImGuiInputTextFlags flags = 0, ImGuiInputTextCallback callback = NULL, void* user_data = NULL);
|
||||
IMGUI_API bool InputFloat(const char* label, float* v, float step = 0.0f, float step_fast = 0.0f, const char* format = "%.3f", ImGuiInputTextFlags extra_flags = 0);
|
||||
IMGUI_API bool InputFloat2(const char* label, float v[2], const char* format = "%.3f", ImGuiInputTextFlags extra_flags = 0);
|
||||
IMGUI_API bool InputFloat3(const char* label, float v[3], const char* format = "%.3f", ImGuiInputTextFlags extra_flags = 0);
|
||||
IMGUI_API bool InputFloat4(const char* label, float v[4], const char* format = "%.3f", 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 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);
|
||||
IMGUI_API bool InputDouble(const char* label, double* v, double step = 0.0f, double step_fast = 0.0f, const char* format = "%.6f", ImGuiInputTextFlags extra_flags = 0);
|
||||
IMGUI_API bool InputScalar(const char* label, ImGuiDataType data_type, void* v, const void* step = NULL, const void* step_fast = NULL, const char* format = NULL, ImGuiInputTextFlags extra_flags = 0);
|
||||
IMGUI_API bool InputScalarN(const char* label, ImGuiDataType data_type, void* v, int components, const void* step = NULL, const void* step_fast = NULL, const char* format = NULL, ImGuiInputTextFlags extra_flags = 0);
|
||||
IMGUI_API bool InputFloat(const char* label, float* v, float step = 0.0f, float step_fast = 0.0f, const char* format = "%.3f", ImGuiInputTextFlags flags = 0);
|
||||
IMGUI_API bool InputFloat2(const char* label, float v[2], const char* format = "%.3f", ImGuiInputTextFlags flags = 0);
|
||||
IMGUI_API bool InputFloat3(const char* label, float v[3], const char* format = "%.3f", ImGuiInputTextFlags flags = 0);
|
||||
IMGUI_API bool InputFloat4(const char* label, float v[4], const char* format = "%.3f", ImGuiInputTextFlags flags = 0);
|
||||
IMGUI_API bool InputInt(const char* label, int* v, int step = 1, int step_fast = 100, ImGuiInputTextFlags 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 InputDouble(const char* label, double* v, double step = 0.0f, double step_fast = 0.0f, const char* format = "%.6f", ImGuiInputTextFlags flags = 0);
|
||||
IMGUI_API bool InputScalar(const char* label, ImGuiDataType data_type, void* v, const void* step = NULL, const void* step_fast = NULL, const char* format = NULL, ImGuiInputTextFlags flags = 0);
|
||||
IMGUI_API bool InputScalarN(const char* label, ImGuiDataType data_type, void* v, int components, const void* step = NULL, const void* step_fast = NULL, const char* format = NULL, ImGuiInputTextFlags flags = 0);
|
||||
|
||||
// Widgets: Color Editor/Picker (tip: the ColorEdit* functions have a little colored preview square that can be left-clicked to open a picker, and right-clicked to open an option menu.)
|
||||
// - Note that in C++ a 'float v[X]' function argument is the _same_ as 'float* v', the array syntax is just a way to document the number of elements that are expected to be accessible. You can the pass the address of a first float element out of a contiguous structure, e.g. &myvector.x
|
||||
@ -1413,10 +1414,10 @@ namespace ImGui
|
||||
// OBSOLETED in 1.63 (from Aug 2018)
|
||||
static inline bool IsItemDeactivatedAfterChange() { return IsItemDeactivatedAfterEdit(); }
|
||||
// OBSOLETED in 1.61 (from Apr 2018)
|
||||
IMGUI_API bool InputFloat(const char* label, float* v, float step, float step_fast, int decimal_precision, ImGuiInputTextFlags extra_flags = 0); // Use the 'const char* format' version instead of 'decimal_precision'!
|
||||
IMGUI_API bool InputFloat2(const char* label, float v[2], int decimal_precision, ImGuiInputTextFlags extra_flags = 0);
|
||||
IMGUI_API bool InputFloat3(const char* label, float v[3], int decimal_precision, ImGuiInputTextFlags extra_flags = 0);
|
||||
IMGUI_API bool InputFloat4(const char* label, float v[4], int decimal_precision, ImGuiInputTextFlags extra_flags = 0);
|
||||
IMGUI_API bool InputFloat(const char* label, float* v, float step, float step_fast, int decimal_precision, ImGuiInputTextFlags flags = 0); // Use the 'const char* format' version instead of 'decimal_precision'!
|
||||
IMGUI_API bool InputFloat2(const char* label, float v[2], int decimal_precision, ImGuiInputTextFlags flags = 0);
|
||||
IMGUI_API bool InputFloat3(const char* label, float v[3], int decimal_precision, ImGuiInputTextFlags flags = 0);
|
||||
IMGUI_API bool InputFloat4(const char* label, float v[4], int decimal_precision, ImGuiInputTextFlags flags = 0);
|
||||
// OBSOLETED in 1.60 (from Dec 2017)
|
||||
static inline bool IsAnyWindowFocused() { return IsWindowFocused(ImGuiFocusedFlags_AnyWindow); }
|
||||
static inline bool IsAnyWindowHovered() { return IsWindowHovered(ImGuiHoveredFlags_AnyWindow); }
|
||||
|
@ -2633,7 +2633,7 @@ bool ImGui::InputScalarAsWidgetReplacement(const ImRect& bb, ImGuiID id, const c
|
||||
return false;
|
||||
}
|
||||
|
||||
bool ImGui::InputScalar(const char* label, ImGuiDataType data_type, void* data_ptr, const void* step, const void* step_fast, const char* format, ImGuiInputTextFlags extra_flags)
|
||||
bool ImGui::InputScalar(const char* label, ImGuiDataType data_type, void* data_ptr, const void* step, const void* step_fast, const char* format, ImGuiInputTextFlags flags)
|
||||
{
|
||||
ImGuiWindow* window = GetCurrentWindow();
|
||||
if (window->SkipItems)
|
||||
@ -2650,9 +2650,9 @@ bool ImGui::InputScalar(const char* label, ImGuiDataType data_type, void* data_p
|
||||
DataTypeFormatString(buf, IM_ARRAYSIZE(buf), data_type, data_ptr, format);
|
||||
|
||||
bool value_changed = false;
|
||||
if ((extra_flags & (ImGuiInputTextFlags_CharsHexadecimal | ImGuiInputTextFlags_CharsScientific)) == 0)
|
||||
extra_flags |= ImGuiInputTextFlags_CharsDecimal;
|
||||
extra_flags |= ImGuiInputTextFlags_AutoSelectAll;
|
||||
if ((flags & (ImGuiInputTextFlags_CharsHexadecimal | ImGuiInputTextFlags_CharsScientific)) == 0)
|
||||
flags |= ImGuiInputTextFlags_CharsDecimal;
|
||||
flags |= ImGuiInputTextFlags_AutoSelectAll;
|
||||
|
||||
if (step != NULL)
|
||||
{
|
||||
@ -2661,13 +2661,13 @@ bool ImGui::InputScalar(const char* label, ImGuiDataType data_type, void* data_p
|
||||
BeginGroup(); // The only purpose of the group here is to allow the caller to query item data e.g. IsItemActive()
|
||||
PushID(label);
|
||||
PushItemWidth(ImMax(1.0f, CalcItemWidth() - (button_size + style.ItemInnerSpacing.x) * 2));
|
||||
if (InputText("", buf, IM_ARRAYSIZE(buf), extra_flags)) // PushId(label) + "" gives us the expected ID from outside point of view
|
||||
if (InputText("", buf, IM_ARRAYSIZE(buf), flags)) // PushId(label) + "" gives us the expected ID from outside point of view
|
||||
value_changed = DataTypeApplyOpFromText(buf, g.InputTextState.InitialText.Data, data_type, data_ptr, format);
|
||||
PopItemWidth();
|
||||
|
||||
// Step buttons
|
||||
ImGuiButtonFlags button_flags = ImGuiButtonFlags_Repeat | ImGuiButtonFlags_DontClosePopups;
|
||||
if (extra_flags & ImGuiInputTextFlags_ReadOnly)
|
||||
if (flags & ImGuiInputTextFlags_ReadOnly)
|
||||
button_flags |= ImGuiButtonFlags_Disabled;
|
||||
SameLine(0, style.ItemInnerSpacing.x);
|
||||
if (ButtonEx("-", ImVec2(button_size, button_size), button_flags))
|
||||
@ -2689,14 +2689,14 @@ bool ImGui::InputScalar(const char* label, ImGuiDataType data_type, void* data_p
|
||||
}
|
||||
else
|
||||
{
|
||||
if (InputText(label, buf, IM_ARRAYSIZE(buf), extra_flags))
|
||||
if (InputText(label, buf, IM_ARRAYSIZE(buf), flags))
|
||||
value_changed = DataTypeApplyOpFromText(buf, g.InputTextState.InitialText.Data, data_type, data_ptr, format);
|
||||
}
|
||||
|
||||
return value_changed;
|
||||
}
|
||||
|
||||
bool ImGui::InputScalarN(const char* label, ImGuiDataType data_type, void* v, int components, const void* step, const void* step_fast, const char* format, ImGuiInputTextFlags extra_flags)
|
||||
bool ImGui::InputScalarN(const char* label, ImGuiDataType data_type, void* v, int components, const void* step, const void* step_fast, const char* format, ImGuiInputTextFlags flags)
|
||||
{
|
||||
ImGuiWindow* window = GetCurrentWindow();
|
||||
if (window->SkipItems)
|
||||
@ -2711,7 +2711,7 @@ bool ImGui::InputScalarN(const char* label, ImGuiDataType data_type, void* v, in
|
||||
for (int i = 0; i < components; i++)
|
||||
{
|
||||
PushID(i);
|
||||
value_changed |= InputScalar("##v", data_type, v, step, step_fast, format, extra_flags);
|
||||
value_changed |= InputScalar("##v", data_type, v, step, step_fast, format, flags);
|
||||
SameLine(0, g.Style.ItemInnerSpacing.x);
|
||||
PopID();
|
||||
PopItemWidth();
|
||||
@ -2724,88 +2724,88 @@ bool ImGui::InputScalarN(const char* label, ImGuiDataType data_type, void* v, in
|
||||
return value_changed;
|
||||
}
|
||||
|
||||
bool ImGui::InputFloat(const char* label, float* v, float step, float step_fast, const char* format, ImGuiInputTextFlags extra_flags)
|
||||
bool ImGui::InputFloat(const char* label, float* v, float step, float step_fast, const char* format, ImGuiInputTextFlags flags)
|
||||
{
|
||||
extra_flags |= ImGuiInputTextFlags_CharsScientific;
|
||||
return InputScalar(label, ImGuiDataType_Float, (void*)v, (void*)(step>0.0f ? &step : NULL), (void*)(step_fast>0.0f ? &step_fast : NULL), format, extra_flags);
|
||||
flags |= ImGuiInputTextFlags_CharsScientific;
|
||||
return InputScalar(label, ImGuiDataType_Float, (void*)v, (void*)(step>0.0f ? &step : NULL), (void*)(step_fast>0.0f ? &step_fast : NULL), format, flags);
|
||||
}
|
||||
|
||||
bool ImGui::InputFloat2(const char* label, float v[2], const char* format, ImGuiInputTextFlags extra_flags)
|
||||
bool ImGui::InputFloat2(const char* label, float v[2], const char* format, ImGuiInputTextFlags flags)
|
||||
{
|
||||
return InputScalarN(label, ImGuiDataType_Float, v, 2, NULL, NULL, format, extra_flags);
|
||||
return InputScalarN(label, ImGuiDataType_Float, v, 2, NULL, NULL, format, flags);
|
||||
}
|
||||
|
||||
bool ImGui::InputFloat3(const char* label, float v[3], const char* format, ImGuiInputTextFlags extra_flags)
|
||||
bool ImGui::InputFloat3(const char* label, float v[3], const char* format, ImGuiInputTextFlags flags)
|
||||
{
|
||||
return InputScalarN(label, ImGuiDataType_Float, v, 3, NULL, NULL, format, extra_flags);
|
||||
return InputScalarN(label, ImGuiDataType_Float, v, 3, NULL, NULL, format, flags);
|
||||
}
|
||||
|
||||
bool ImGui::InputFloat4(const char* label, float v[4], const char* format, ImGuiInputTextFlags extra_flags)
|
||||
bool ImGui::InputFloat4(const char* label, float v[4], const char* format, ImGuiInputTextFlags flags)
|
||||
{
|
||||
return InputScalarN(label, ImGuiDataType_Float, v, 4, NULL, NULL, format, extra_flags);
|
||||
return InputScalarN(label, ImGuiDataType_Float, v, 4, NULL, NULL, format, flags);
|
||||
}
|
||||
|
||||
// Prefer using "const char* format" directly, which is more flexible and consistent with other API.
|
||||
#ifndef IMGUI_DISABLE_OBSOLETE_FUNCTIONS
|
||||
bool ImGui::InputFloat(const char* label, float* v, float step, float step_fast, int decimal_precision, ImGuiInputTextFlags extra_flags)
|
||||
bool ImGui::InputFloat(const char* label, float* v, float step, float step_fast, int decimal_precision, ImGuiInputTextFlags flags)
|
||||
{
|
||||
char format[16] = "%f";
|
||||
if (decimal_precision >= 0)
|
||||
ImFormatString(format, IM_ARRAYSIZE(format), "%%.%df", decimal_precision);
|
||||
return InputFloat(label, v, step, step_fast, format, extra_flags);
|
||||
return InputFloat(label, v, step, step_fast, format, flags);
|
||||
}
|
||||
|
||||
bool ImGui::InputFloat2(const char* label, float v[2], int decimal_precision, ImGuiInputTextFlags extra_flags)
|
||||
bool ImGui::InputFloat2(const char* label, float v[2], int decimal_precision, ImGuiInputTextFlags flags)
|
||||
{
|
||||
char format[16] = "%f";
|
||||
if (decimal_precision >= 0)
|
||||
ImFormatString(format, IM_ARRAYSIZE(format), "%%.%df", decimal_precision);
|
||||
return InputScalarN(label, ImGuiDataType_Float, v, 2, NULL, NULL, format, extra_flags);
|
||||
return InputScalarN(label, ImGuiDataType_Float, v, 2, NULL, NULL, format, flags);
|
||||
}
|
||||
|
||||
bool ImGui::InputFloat3(const char* label, float v[3], int decimal_precision, ImGuiInputTextFlags extra_flags)
|
||||
bool ImGui::InputFloat3(const char* label, float v[3], int decimal_precision, ImGuiInputTextFlags flags)
|
||||
{
|
||||
char format[16] = "%f";
|
||||
if (decimal_precision >= 0)
|
||||
ImFormatString(format, IM_ARRAYSIZE(format), "%%.%df", decimal_precision);
|
||||
return InputScalarN(label, ImGuiDataType_Float, v, 3, NULL, NULL, format, extra_flags);
|
||||
return InputScalarN(label, ImGuiDataType_Float, v, 3, NULL, NULL, format, flags);
|
||||
}
|
||||
|
||||
bool ImGui::InputFloat4(const char* label, float v[4], int decimal_precision, ImGuiInputTextFlags extra_flags)
|
||||
bool ImGui::InputFloat4(const char* label, float v[4], int decimal_precision, ImGuiInputTextFlags flags)
|
||||
{
|
||||
char format[16] = "%f";
|
||||
if (decimal_precision >= 0)
|
||||
ImFormatString(format, IM_ARRAYSIZE(format), "%%.%df", decimal_precision);
|
||||
return InputScalarN(label, ImGuiDataType_Float, v, 4, NULL, NULL, format, extra_flags);
|
||||
return InputScalarN(label, ImGuiDataType_Float, v, 4, NULL, NULL, format, flags);
|
||||
}
|
||||
#endif // IMGUI_DISABLE_OBSOLETE_FUNCTIONS
|
||||
|
||||
bool ImGui::InputInt(const char* label, int* v, int step, int step_fast, ImGuiInputTextFlags extra_flags)
|
||||
bool ImGui::InputInt(const char* label, int* v, int step, int step_fast, ImGuiInputTextFlags flags)
|
||||
{
|
||||
// Hexadecimal input provided as a convenience but the flag name is awkward. Typically you'd use InputText() to parse your own data, if you want to handle prefixes.
|
||||
const char* format = (extra_flags & ImGuiInputTextFlags_CharsHexadecimal) ? "%08X" : "%d";
|
||||
return InputScalar(label, ImGuiDataType_S32, (void*)v, (void*)(step>0 ? &step : NULL), (void*)(step_fast>0 ? &step_fast : NULL), format, extra_flags);
|
||||
const char* format = (flags & ImGuiInputTextFlags_CharsHexadecimal) ? "%08X" : "%d";
|
||||
return InputScalar(label, ImGuiDataType_S32, (void*)v, (void*)(step>0 ? &step : NULL), (void*)(step_fast>0 ? &step_fast : NULL), format, flags);
|
||||
}
|
||||
|
||||
bool ImGui::InputInt2(const char* label, int v[2], ImGuiInputTextFlags extra_flags)
|
||||
bool ImGui::InputInt2(const char* label, int v[2], ImGuiInputTextFlags flags)
|
||||
{
|
||||
return InputScalarN(label, ImGuiDataType_S32, v, 2, NULL, NULL, "%d", extra_flags);
|
||||
return InputScalarN(label, ImGuiDataType_S32, v, 2, NULL, NULL, "%d", flags);
|
||||
}
|
||||
|
||||
bool ImGui::InputInt3(const char* label, int v[3], ImGuiInputTextFlags extra_flags)
|
||||
bool ImGui::InputInt3(const char* label, int v[3], ImGuiInputTextFlags flags)
|
||||
{
|
||||
return InputScalarN(label, ImGuiDataType_S32, v, 3, NULL, NULL, "%d", extra_flags);
|
||||
return InputScalarN(label, ImGuiDataType_S32, v, 3, NULL, NULL, "%d", flags);
|
||||
}
|
||||
|
||||
bool ImGui::InputInt4(const char* label, int v[4], ImGuiInputTextFlags extra_flags)
|
||||
bool ImGui::InputInt4(const char* label, int v[4], ImGuiInputTextFlags flags)
|
||||
{
|
||||
return InputScalarN(label, ImGuiDataType_S32, v, 4, NULL, NULL, "%d", extra_flags);
|
||||
return InputScalarN(label, ImGuiDataType_S32, v, 4, NULL, NULL, "%d", flags);
|
||||
}
|
||||
|
||||
bool ImGui::InputDouble(const char* label, double* v, double step, double step_fast, const char* format, ImGuiInputTextFlags extra_flags)
|
||||
bool ImGui::InputDouble(const char* label, double* v, double step, double step_fast, const char* format, ImGuiInputTextFlags flags)
|
||||
{
|
||||
extra_flags |= ImGuiInputTextFlags_CharsScientific;
|
||||
return InputScalar(label, ImGuiDataType_Double, (void*)v, (void*)(step>0.0 ? &step : NULL), (void*)(step_fast>0.0 ? &step_fast : NULL), format, extra_flags);
|
||||
flags |= ImGuiInputTextFlags_CharsScientific;
|
||||
return InputScalar(label, ImGuiDataType_Double, (void*)v, (void*)(step>0.0 ? &step : NULL), (void*)(step_fast>0.0 ? &step_fast : NULL), format, flags);
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------
|
||||
|
Loading…
Reference in New Issue
Block a user