1 | //************************************ bs::framework - Copyright 2018 Marko Pintera **************************************// |
---|---|
2 | //*********** Licensed under the MIT license. See LICENSE.md for full terms. This notice is not to be removed. ***********// |
3 | #include "GUI/BsGUITooltipManager.h" |
4 | #include "Scene/BsSceneObject.h" |
5 | #include "GUI/BsGUITooltip.h" |
6 | |
7 | namespace bs |
8 | { |
9 | GUITooltipManager::~GUITooltipManager() |
10 | { |
11 | hide(); |
12 | } |
13 | |
14 | void GUITooltipManager::show(const GUIWidget& widget, const Vector2I& position, const String& text) |
15 | { |
16 | hide(); |
17 | |
18 | mTooltipSO = SceneObject::create("Tooltip", SOF_Internal | SOF_Persistent | SOF_DontSave); |
19 | GameObjectHandle<GUITooltip> tooltip = mTooltipSO->addComponent<GUITooltip>(widget, position, text); |
20 | } |
21 | |
22 | void GUITooltipManager::hide() |
23 | { |
24 | if (mTooltipSO != nullptr) |
25 | { |
26 | mTooltipSO->destroy(); |
27 | mTooltipSO = nullptr; |
28 | } |
29 | } |
30 | } |