| 3942 | //------------------------------------------------------------------------------ |
| 3943 | |
| 3944 | bool GuiTreeViewCtrl::renderTooltip( const Point2I &hoverPos, const Point2I& cursorPos, const char* tipText ) |
| 3945 | { |
| 3946 | Item* item; |
| 3947 | BitSet32 flags = 0; |
| 3948 | if( _hitTest( cursorPos, item, flags ) && (!item->mTooltip.isEmpty() || mUseInspectorTooltips) ) |
| 3949 | { |
| 3950 | bool render = true; |
| 3951 | |
| 3952 | if( mTooltipOnWidthOnly && !item->hasObjectBasedTooltip() ) |
| 3953 | { |
| 3954 | // Only render tooltip if the item's text is cut off with its |
| 3955 | // parent scroll control, unless there is custom object-based |
| 3956 | // tooltip information. |
| 3957 | GuiScrollCtrl *pScrollParent = dynamic_cast<GuiScrollCtrl*>( getParent() ); |
| 3958 | if ( pScrollParent ) |
| 3959 | { |
| 3960 | Point2I textStart; |
| 3961 | Point2I textExt; |
| 3962 | |
| 3963 | const Point2I pos = globalToLocalCoord(cursorPos); |
| 3964 | textStart.y = pos.y / mCellSize.y; |
| 3965 | textStart.y *= mCellSize.y; |
| 3966 | |
| 3967 | // The following is taken from _hitTest() |
| 3968 | textStart.x = mTabSize * item->mTabLevel; |
| 3969 | S32 image = BmpChild; |
| 3970 | if((image >= 0) && (image < mProfile->mBitmapArrayRects.size())) |
| 3971 | textStart.x += mProfile->mBitmapArrayRects[image].extent.x; |
| 3972 | textStart.x += mTextOffset; |
| 3973 | |
| 3974 | textStart.x += getInspectorItemIconsWidth( item ); |
| 3975 | |
| 3976 | FrameAllocatorMarker txtAlloc; |
| 3977 | U32 bufLen = item->getDisplayTextLength() + 1; |
| 3978 | char *buf = (char*)txtAlloc.alloc(bufLen); |
| 3979 | item->getDisplayText(bufLen, buf); |
| 3980 | textExt.x = mProfile->mFont->getStrWidth(buf); |
| 3981 | textExt.y = mProfile->mFont->getHeight(); |
| 3982 | |
| 3983 | if( pScrollParent->isRectCompletelyVisible(RectI(textStart, textExt)) ) |
| 3984 | render = false; |
| 3985 | } |
| 3986 | } |
| 3987 | |
| 3988 | if( render ) |
| 3989 | { |
| 3990 | if( mUseInspectorTooltips ) |
| 3991 | { |
| 3992 | char buf[2048]; |
| 3993 | item->getTooltipText( sizeof( buf ), buf ); |
| 3994 | tipText = buf; |
| 3995 | } |
| 3996 | else |
| 3997 | { |
| 3998 | tipText = item->mTooltip.c_str(); |
| 3999 | } |
| 4000 | } |
| 4001 | } |
nothing calls this directly
no test coverage detected