void Tooltip::setTargetWindow(Window* wnd)
    {
        if (!wnd)
        {
            d_target = wnd;
        }
        else if (wnd != this)
        {
            if (d_target != wnd)
            {
                wnd->getGUIContext().getRootWindow()->addChild(this);
                d_target = wnd;
            }

            // set text to that of the tooltip text of the target
            setText(wnd->getTooltipText());

            // set size and position of the tooltip window.
            sizeSelf();
            positionSelf();
        }

        resetTimer();

        if (d_active)
        {
            WindowEventArgs args(this);
            onTooltipTransition(args);
        }
    }
    void Tooltip::onTextChanged(WindowEventArgs& e)
    {
        // base class processing
        Window::onTextChanged(e);

        // set size and position of the tooltip window to consider new text
        sizeSelf();
        positionSelf();

        // we do not signal we handled it, in case user wants to hear
        // about text changes too.
    }
Example #3
0
    void Tooltip::setTargetWindow(Window* wnd)
    {
        if (!wnd)
        {
            d_target = wnd;
        }
        else if (wnd != this)
        {
            if (d_target != wnd)
            {
                System::getSingleton().getGUISheet()->addChildWindow(this);
                d_target = wnd;
            }

            // set text to that of the tooltip text of the target
            setText(wnd->getTooltipText());

            // set size and potition of the tooltip window.
            sizeSelf();
            positionSelf();
        }

        resetTimer();
    }