MCPcopy Create free account
hub / github.com/GarageGames/Torque3D / _hitTest

Method _hitTest

Engine/source/gui/controls/guiTreeViewCtrl.cpp:1911–1985  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1909//------------------------------------------------------------------------------
1910
1911bool 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;

Callers

nothing calls this directly

Calls 11

isInspectorDataMethod · 0.80
getExpandedImageMethod · 0.80
getNormalImageMethod · 0.80
getDisplayTextLengthMethod · 0.80
getDisplayTextMethod · 0.80
getStrWidthMethod · 0.80
clearMethod · 0.45
setMethod · 0.45
sizeMethod · 0.45
isExpandedMethod · 0.45
allocMethod · 0.45

Tested by

no test coverage detected