Show tooltips with fully qualified ids in Gui

This commit is contained in:
Alexander Bock
2016-06-29 13:47:48 +02:00
parent 9201cd027b
commit c998a856ea
@@ -51,6 +51,8 @@ void renderBoolProperty(Property* prop, const std::string& ownerName) {
BoolProperty::ValueType value = *p;
ImGui::Checkbox(name.c_str(), &value);
if (ImGui::IsItemHovered())
ImGui::SetTooltip(prop->fullyQualifiedIdentifier().c_str());
if (value != p->value())
executeScript(p->fullyQualifiedIdentifier(), value ? "true" : "false");
@@ -66,8 +68,12 @@ void renderOptionProperty(Property* prop, const std::string& ownerName) {
std::vector<OptionProperty::Option> options = p->options();
for (const OptionProperty::Option& o : options) {
ImGui::RadioButton(name.c_str(), &value, o.value);
if (ImGui::IsItemHovered())
ImGui::SetTooltip(prop->fullyQualifiedIdentifier().c_str());
ImGui::SameLine();
ImGui::Text(o.description.c_str());
if (ImGui::IsItemHovered())
ImGui::SetTooltip(prop->fullyQualifiedIdentifier().c_str());
}
if (value != p->value())
executeScript(p->fullyQualifiedIdentifier(), std::to_string(value));
@@ -89,6 +95,8 @@ void renderSelectionProperty(Property* prop, const std::string& ownerName) {
std::string description = options[i].description;
bool selected = std::find(selectedIndices.begin(), selectedIndices.end(), i) != selectedIndices.end();
ImGui::Checkbox(description.c_str(), &selected);
if (ImGui::IsItemHovered())
ImGui::SetTooltip(prop->fullyQualifiedIdentifier().c_str());
if (selected)
newSelectedIndices.push_back(i);
@@ -118,6 +126,8 @@ void renderStringProperty(Property* prop, const std::string& ownerName) {
strcpy(buffer, p->value().c_str());
#endif
ImGui::InputText(name.c_str(), buffer, bufferSize);
if (ImGui::IsItemHovered())
ImGui::SetTooltip(prop->fullyQualifiedIdentifier().c_str());
std::string newValue(buffer);
if (newValue != p->value())
@@ -136,6 +146,8 @@ void renderIntProperty(Property* prop, const std::string& ownerName) {
int max = p->maxValue();
ImGui::SliderInt(name.c_str(), &value, min, max);
if (ImGui::IsItemHovered())
ImGui::SetTooltip(prop->fullyQualifiedIdentifier().c_str());
if (value != p->value())
executeScript(p->fullyQualifiedIdentifier(), std::to_string(value));
@@ -152,6 +164,8 @@ void renderFloatProperty(Property* prop, const std::string& ownerName) {
float min = p->minValue();
float max = p->maxValue();
ImGui::SliderFloat(name.c_str(), &value, min, max);
if (ImGui::IsItemHovered())
ImGui::SetTooltip(prop->fullyQualifiedIdentifier().c_str());
if (value != p->value())
executeScript(p->fullyQualifiedIdentifier(), std::to_string(value));
@@ -173,6 +187,8 @@ void renderVec2Property(Property* prop, const std::string& ownerName) {
min,
max
);
if (ImGui::IsItemHovered())
ImGui::SetTooltip(prop->fullyQualifiedIdentifier().c_str());
if (value != p->value())
executeScript(p->fullyQualifiedIdentifier(),
@@ -196,6 +212,8 @@ void renderVec3Property(Property* prop, const std::string& ownerName) {
min,
max
);
if (ImGui::IsItemHovered())
ImGui::SetTooltip(prop->fullyQualifiedIdentifier().c_str());
if (value != p->value())
executeScript(p->fullyQualifiedIdentifier(),
@@ -223,6 +241,8 @@ void renderVec4Property(Property* prop, const std::string& ownerName) {
min,
max
);
if (ImGui::IsItemHovered())
ImGui::SetTooltip(prop->fullyQualifiedIdentifier().c_str());
if (value != p->value())
executeScript(p->fullyQualifiedIdentifier(),
@@ -241,6 +261,8 @@ void renderTriggerProperty(Property* prop, const std::string& ownerName) {
bool pressed = ImGui::Button(name.c_str());
if (pressed)
executeScript(prop->fullyQualifiedIdentifier(), "nil");
if (ImGui::IsItemHovered())
ImGui::SetTooltip(prop->fullyQualifiedIdentifier().c_str());
ImGui::PopID();
}