Skip to content

Commit

Permalink
♻️ Use ImGui::SetItemTooltip()
Browse files Browse the repository at this point in the history
  • Loading branch information
JulesFouchy committed Sep 4, 2023
1 parent 86496df commit c0cdcac
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 25 deletions.
5 changes: 2 additions & 3 deletions src/GradientWidget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
#include "imgui_draw.hpp"
#include "internal.hpp"
#include "maybe_disabled.hpp"
#include "tooltip.hpp"

namespace ImGG {

Expand Down Expand Up @@ -61,15 +60,15 @@ static auto delete_button(const bool disable, const char* reason_for_disabling,
b |= settings.minus_button_widget();
});
if (!disable && should_show_tooltip)
tooltip("Removes the selected mark.\nYou can also middle click on it,\nor drag it down.");
ImGui::SetItemTooltip("%s", "Removes the selected mark.\nYou can also middle click on it,\nor drag it down.");
return b;
}

static auto add_button(const bool should_show_tooltip, Settings const& settings) -> bool
{
bool const b = settings.plus_button_widget();
if (should_show_tooltip)
tooltip("Add a mark here\nor click on the gradient to choose its position.");
ImGui::SetItemTooltip("%s", "Add a mark here\nor click on the gradient to choose its position.");
return b;
}

Expand Down
5 changes: 2 additions & 3 deletions src/extra_widgets.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
#include <imgui.h>
#include <array>
#include "imgui_internal.hpp"
#include "tooltip.hpp"

namespace ImGG {

Expand Down Expand Up @@ -40,7 +39,7 @@ static auto selector_with_tooltip(
}
if (should_show_tooltip)
{
tooltip(tooltips[n]);
ImGui::SetItemTooltip("%s", tooltips[n]);
}
}
ImGui::EndCombo();
Expand All @@ -60,7 +59,7 @@ auto random_mode_widget(
);
if (should_show_tooltip)
{
tooltip("The new marks will use a random color instead of keeping the one the gradient had at that position.");
ImGui::SetItemTooltip("%s", "The new marks will use a random color instead of keeping the one the gradient had at that position.");
}
return modified;
}
Expand Down
4 changes: 2 additions & 2 deletions src/maybe_disabled.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#include "maybe_disabled.hpp"
#include "tooltip.hpp"
#include <imgui.h>

namespace ImGG {

Expand All @@ -18,7 +18,7 @@ void maybe_disabled(

ImGui::EndDisabled();
ImGui::EndGroup();
tooltip(reason_to_disable);
ImGui::SetItemTooltip("%s", reason_to_disable);
}
else
{
Expand Down
17 changes: 0 additions & 17 deletions src/tooltip.hpp

This file was deleted.

0 comments on commit c0cdcac

Please sign in to comment.