added tooltips

This commit is contained in:
MihailRis
2024-05-24 08:03:05 +03:00
parent 1c45236693
commit eb10904069
10 changed files with 146 additions and 11 deletions
+25 -1
View File
@@ -129,6 +129,14 @@ bool UINode::isResizing() const {
return resizing;
}
void UINode::setTooltip(const std::wstring& text) {
this->tooltip = text;
}
const std::wstring UINode::getTooltip() const {
return tooltip;
}
glm::vec2 UINode::calcPos() const {
if (parent) {
return pos + parent->calcPos() + parent->contentOffset();
@@ -316,7 +324,7 @@ void UINode::setGravity(Gravity gravity) {
}
void UINode::getIndices(
std::shared_ptr<UINode> node,
const std::shared_ptr<UINode> node,
std::unordered_map<std::string, std::shared_ptr<UINode>>& map
) {
const std::string& id = node->getId();
@@ -330,3 +338,19 @@ void UINode::getIndices(
}
}
}
std::shared_ptr<UINode> UINode::find(
const std::shared_ptr<UINode> node,
const std::string& id
) {
if (node->getId() == id) {
return node;
}
if (auto container = std::dynamic_pointer_cast<Container>(node)) {
for (auto subnode : container->getNodes()) {
if (auto found = UINode::find(subnode, id)) {
return found;
}
}
}
return nullptr;
}