Demo: Using ImVec2(-FLT_MIN,0.0f) instead of ImVec2(-1.0f,0.0f) where it makes sense. (#2449)

This commit is contained in:
omar 2019-06-21 19:38:33 +02:00
parent 41e2d4b5ae
commit eb3e271c24

View File

@ -968,7 +968,7 @@ static void ShowDemoWindowWidgets()
ImGui::CheckboxFlags("ImGuiInputTextFlags_ReadOnly", (unsigned int*)&flags, ImGuiInputTextFlags_ReadOnly); ImGui::CheckboxFlags("ImGuiInputTextFlags_ReadOnly", (unsigned int*)&flags, ImGuiInputTextFlags_ReadOnly);
ImGui::CheckboxFlags("ImGuiInputTextFlags_AllowTabInput", (unsigned int*)&flags, ImGuiInputTextFlags_AllowTabInput); ImGui::CheckboxFlags("ImGuiInputTextFlags_AllowTabInput", (unsigned int*)&flags, ImGuiInputTextFlags_AllowTabInput);
ImGui::CheckboxFlags("ImGuiInputTextFlags_CtrlEnterForNewLine", (unsigned int*)&flags, ImGuiInputTextFlags_CtrlEnterForNewLine); ImGui::CheckboxFlags("ImGuiInputTextFlags_CtrlEnterForNewLine", (unsigned int*)&flags, ImGuiInputTextFlags_CtrlEnterForNewLine);
ImGui::InputTextMultiline("##source", text, IM_ARRAYSIZE(text), ImVec2(-1.0f, ImGui::GetTextLineHeight() * 16), flags); ImGui::InputTextMultiline("##source", text, IM_ARRAYSIZE(text), ImVec2(-FLT_MIN, ImGui::GetTextLineHeight() * 16), flags);
ImGui::TreePop(); ImGui::TreePop();
} }
@ -1024,7 +1024,7 @@ static void ShowDemoWindowWidgets()
static ImVector<char> my_str; static ImVector<char> my_str;
if (my_str.empty()) if (my_str.empty())
my_str.push_back(0); my_str.push_back(0);
Funcs::MyInputTextMultiline("##MyStr", &my_str, ImVec2(-1.0f, ImGui::GetTextLineHeight() * 16)); Funcs::MyInputTextMultiline("##MyStr", &my_str, ImVec2(-FLT_MIN, ImGui::GetTextLineHeight() * 16));
ImGui::Text("Data: %p\nSize: %d\nCapacity: %d", (void*)my_str.begin(), my_str.size(), my_str.capacity()); ImGui::Text("Data: %p\nSize: %d\nCapacity: %d", (void*)my_str.begin(), my_str.size(), my_str.capacity());
ImGui::TreePop(); ImGui::TreePop();
} }
@ -1085,7 +1085,8 @@ static void ShowDemoWindowWidgets()
if (progress <= -0.1f) { progress = -0.1f; progress_dir *= -1.0f; } if (progress <= -0.1f) { progress = -0.1f; progress_dir *= -1.0f; }
} }
// Typically we would use ImVec2(-1.0f,0.0f) to use all available width, or ImVec2(width,0.0f) for a specified width. ImVec2(0.0f,0.0f) uses ItemWidth. // Typically we would use ImVec2(-1.0f,0.0f) or ImVec2(-FLT_MIN,0.0f) to use all available width,
// or ImVec2(width,0.0f) for a specified width. ImVec2(0.0f,0.0f) uses ItemWidth.
ImGui::ProgressBar(progress, ImVec2(0.0f,0.0f)); ImGui::ProgressBar(progress, ImVec2(0.0f,0.0f));
ImGui::SameLine(0.0f, ImGui::GetStyle().ItemInnerSpacing.x); ImGui::SameLine(0.0f, ImGui::GetStyle().ItemInnerSpacing.x);
ImGui::Text("Progress Bar"); ImGui::Text("Progress Bar");
@ -1727,7 +1728,7 @@ static void ShowDemoWindowLayout()
{ {
char buf[32]; char buf[32];
sprintf(buf, "%03d", i); sprintf(buf, "%03d", i);
ImGui::Button(buf, ImVec2(-1.0f, 0.0f)); ImGui::Button(buf, ImVec2(-FLT_MIN, 0.0f));
ImGui::NextColumn(); ImGui::NextColumn();
} }
ImGui::EndChild(); ImGui::EndChild();
@ -2519,7 +2520,7 @@ static void ShowDemoWindowColumns()
char label[32]; char label[32];
sprintf(label, "Item %d", n); sprintf(label, "Item %d", n);
if (ImGui::Selectable(label)) {} if (ImGui::Selectable(label)) {}
//if (ImGui::Button(label, ImVec2(-1,0))) {} //if (ImGui::Button(label, ImVec2(-FLT_MIN,0.0f))) {}
ImGui::NextColumn(); ImGui::NextColumn();
} }
ImGui::Columns(1); ImGui::Columns(1);
@ -2570,7 +2571,7 @@ static void ShowDemoWindowColumns()
ImGui::Text("Width %.2f", ImGui::GetColumnWidth()); ImGui::Text("Width %.2f", ImGui::GetColumnWidth());
ImGui::Text("Offset %.2f", ImGui::GetColumnOffset()); ImGui::Text("Offset %.2f", ImGui::GetColumnOffset());
ImGui::Text("Long text that is likely to clip"); ImGui::Text("Long text that is likely to clip");
ImGui::Button("Button", ImVec2(-1.0f, 0.0f)); ImGui::Button("Button", ImVec2(-FLT_MIN, 0.0f));
ImGui::NextColumn(); ImGui::NextColumn();
} }
ImGui::Columns(1); ImGui::Columns(1);