Added TextDisabled(), TextDisabledV() helpers.

This commit is contained in:
ocornut 2015-05-26 21:10:16 +01:00
parent 3a6e6645e6
commit 15113f682e
2 changed files with 19 additions and 1 deletions

View File

@ -4593,6 +4593,21 @@ void ImGui::TextColored(const ImVec4& col, const char* fmt, ...)
va_end(args);
}
void ImGui::TextDisabledV(const char* fmt, va_list args)
{
ImGui::PushStyleColor(ImGuiCol_Text, GImGui->Style.Colors[ImGuiCol_TextDisabled]);
TextV(fmt, args);
ImGui::PopStyleColor();
}
void ImGui::TextDisabled(const char* fmt, ...)
{
va_list args;
va_start(args, fmt);
TextDisabledV(fmt, args);
va_end(args);
}
void ImGui::TextWrappedV(const char* fmt, va_list args)
{
ImGui::PushTextWrapPos(0.0f);
@ -10382,6 +10397,7 @@ void ImGui::ShowTestWindow(bool* opened)
// Using shortcut. You can use PushStyleColor()/PopStyleColor() for more flexibility.
ImGui::TextColored(ImVec4(1.0f,0.0f,1.0f,1.0f), "Pink");
ImGui::TextColored(ImVec4(1.0f,1.0f,0.0f,1.0f), "Yellow");
ImGui::TextDisabled("Disabled");
ImGui::TreePop();
}
@ -10663,7 +10679,7 @@ void ImGui::ShowTestWindow(bool* opened)
static int i2=42;
ImGui::DragInt("drag int", &i1, 1);
ImGui::SameLine();
ImGui::TextColored(ImColor(170,170,170,255), "(?)");
ImGui::TextDisabled("(?)");
if (ImGui::IsItemHovered())
ImGui::SetTooltip("Click and drag to edit value.\nHold SHIFT/ALT for faster/slower edit.\nDouble-click or CTRL+click to input text");

View File

@ -215,6 +215,8 @@ namespace ImGui
IMGUI_API void TextV(const char* fmt, va_list args);
IMGUI_API void TextColored(const ImVec4& col, const char* fmt, ...); // shortcut for PushStyleColor(ImGuiCol_Text, col); Text(fmt, ...); PopStyleColor();
IMGUI_API void TextColoredV(const ImVec4& col, const char* fmt, va_list args);
IMGUI_API void TextDisabled(const char* fmt, ...); // shortcut for PushStyleColor(ImGuiCol_Text, style.Colors[ImGuiCol_TextDisabled]); Text(fmt, ...); PopStyleColor();
IMGUI_API void TextDisabledV(const char* fmt, va_list args);
IMGUI_API void TextWrapped(const char* fmt, ...); // shortcut for PushTextWrapPos(0.0f); Text(fmt, ...); PopTextWrapPos();
IMGUI_API void TextWrappedV(const char* fmt, va_list args);
IMGUI_API void TextUnformatted(const char* text, const char* text_end = NULL); // doesn't require null terminated string if 'text_end' is specified. no copy done to any bounded stack buffer, recommended for long chunks of text