| 1909 | //------------------------------------------------------------------------------ |
| 1910 | |
| 1911 | bool GuiTreeViewCtrl::_hitTest(const Point2I & pnt, Item* & item, BitSet32 & flags) |
| 1912 | { |
| 1913 | // Initialize some things. |
| 1914 | const Point2I pos = globalToLocalCoord(pnt); |
| 1915 | flags.clear(); |
| 1916 | item = 0; |
| 1917 | |
| 1918 | // get the hit cell |
| 1919 | Point2I cell((pos.x < 0 ? -1 : pos.x / mCellSize.x), |
| 1920 | (pos.y < 0 ? -1 : pos.y / mCellSize.y)); |
| 1921 | |
| 1922 | // valid? |
| 1923 | if((cell.x < 0 || cell.x >= mSize.x) || |
| 1924 | (cell.y < 0 || cell.y >= mSize.y)) |
| 1925 | return false; |
| 1926 | |
| 1927 | flags.set(OnRow); |
| 1928 | |
| 1929 | // Grab the cell. |
| 1930 | if (cell.y >= mVisibleItems.size()) |
| 1931 | return false; //Invalid cell, so don't do anything |
| 1932 | |
| 1933 | item = mVisibleItems[cell.y]; |
| 1934 | |
| 1935 | S32 min = mTabSize * item->mTabLevel; |
| 1936 | |
| 1937 | // left of icon/text? |
| 1938 | if(pos.x < min) |
| 1939 | { |
| 1940 | flags.set(OnIndent); |
| 1941 | return true; |
| 1942 | } |
| 1943 | |
| 1944 | // check image |
| 1945 | S32 image = BmpChild; |
| 1946 | |
| 1947 | if(item->isInspectorData()) |
| 1948 | image = item->isExpanded() ? BmpExp : BmpCon; |
| 1949 | else |
| 1950 | image = item->isExpanded() ? item->getExpandedImage() : item->getNormalImage(); |
| 1951 | |
| 1952 | if((image >= 0) && (image < mProfile->mBitmapArrayRects.size())) |
| 1953 | min += mProfile->mBitmapArrayRects[image].extent.x; |
| 1954 | |
| 1955 | // Is it on the image? |
| 1956 | if(pos.x < min) |
| 1957 | { |
| 1958 | flags.set(OnImage); |
| 1959 | return(true); |
| 1960 | } |
| 1961 | |
| 1962 | // Check the icon. |
| 1963 | min += getInspectorItemIconsWidth( item ); |
| 1964 | |
| 1965 | if ( pos.x < min ) |
| 1966 | { |
| 1967 | flags.set(OnIcon); |
| 1968 | return true; |
nothing calls this directly
no test coverage detected