diff options
Diffstat (limited to 'Runtime/IMGUI/GUILabel.cpp')
-rw-r--r-- | Runtime/IMGUI/GUILabel.cpp | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/Runtime/IMGUI/GUILabel.cpp b/Runtime/IMGUI/GUILabel.cpp new file mode 100644 index 0000000..a483a27 --- /dev/null +++ b/Runtime/IMGUI/GUILabel.cpp @@ -0,0 +1,29 @@ +#include "UnityPrefix.h" +#include "Runtime/IMGUI/GUIButton.h" +#include "Runtime/IMGUI/GUIStyle.h" +#include "Runtime/IMGUI/GUIState.h" +#include "Runtime/IMGUI/IMGUIUtils.h" + +namespace IMGUI +{ +void GUILabel (GUIState &state, const Rectf &position, GUIContent &content, GUIStyle &style) +{ + InputEvent &evt (*state.m_CurrentEvent); + + if (evt.type == InputEvent::kRepaint) + { + style.Draw (state, position, content, false, false, false, false); + + // Is inside label AND inside guiclip visible rect (prevents tooltips on labels that are clipped) +#if ENABLE_NEW_EVENT_SYSTEM + if (content.m_Tooltip.length != 0 && position.Contains (evt.touch.pos) && + state.m_CanvasGUIState.m_GUIClipState.GetVisibleRect().Contains(evt.touch.pos)) +#else + if (content.m_Tooltip.length != 0 && position.Contains (evt.mousePosition) && + state.m_CanvasGUIState.m_GUIClipState.GetVisibleRect().Contains(evt.mousePosition)) +#endif + GUIStyle::SetMouseTooltip (state, content.m_Tooltip, position); + } +} + +} // namespace |