/// <summary>
        /// Renders the currently visible tooltip.
        /// </summary>
        /// <param name="skin"></param>
        public static void RenderToolTip(Skin.SkinBase skin)
        {
            if (null == g_ToolTip)
            {
                return;
            }
            var canvas = g_ToolTip.GetCanvas();

            canvas.m_ToolTip.Text = g_ToolTip.Tooltip;
            Renderer.RendererBase render = skin.Renderer;

            Point     oldRenderOffset = render.RenderOffset;
            Point     mousePos        = Input.InputHandler.MousePosition;
            Rectangle bounds          = canvas.m_ToolTip.Bounds;

            Rectangle offset = Util.FloatRect(mousePos.X - bounds.Width * 0.5f, mousePos.Y - bounds.Height - 10,
                                              bounds.Width, bounds.Height);

            offset = Util.ClampRectToRect(offset, g_ToolTip.GetCanvas().Bounds);

            //Calculate offset on screen bounds
            render.AddRenderOffset(offset);
            render.EndClip();

            skin.DrawToolTip(canvas.m_ToolTip);
            canvas.m_ToolTip.DoRender(skin);

            render.RenderOffset = oldRenderOffset;
        }
Example #2
0
        /// <summary>
        /// Gets the canvas (root parent) of the control.
        /// </summary>
        /// <returns></returns>
        public virtual Canvas GetCanvas()
        {
            if (m_Parent == null)
            {
                return(null);
            }

            return(m_Parent.GetCanvas());
        }