guiListBoxCtrl.cc 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730
  1. //-----------------------------------------------------------------------------
  2. // Copyright (c) 2013 GarageGames, LLC
  3. //
  4. // Permission is hereby granted, free of charge, to any person obtaining a copy
  5. // of this software and associated documentation files (the "Software"), to
  6. // deal in the Software without restriction, including without limitation the
  7. // rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
  8. // sell copies of the Software, and to permit persons to whom the Software is
  9. // furnished to do so, subject to the following conditions:
  10. //
  11. // The above copyright notice and this permission notice shall be included in
  12. // all copies or substantial portions of the Software.
  13. //
  14. // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  15. // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  16. // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  17. // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  18. // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
  19. // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
  20. // IN THE SOFTWARE.
  21. //-----------------------------------------------------------------------------
  22. #include "gui/guiListBoxCtrl.h"
  23. #include "gui/guiCanvas.h"
  24. #include "guiListBoxCtrl_ScriptBinding.h"
  25. IMPLEMENT_CONOBJECT(GuiListBoxCtrl);
  26. GuiListBoxCtrl::GuiListBoxCtrl()
  27. {
  28. mItems.clear();
  29. mSelectedItems.clear();
  30. mMultipleSelections = true;
  31. mFitParentWidth = true;
  32. mItemSize = Point2I(10,20);
  33. mLastClickItem = NULL;
  34. mIsContainer = false;
  35. mActive = true;
  36. setField("profile", "GuiListBoxProfile");
  37. }
  38. GuiListBoxCtrl::~GuiListBoxCtrl()
  39. {
  40. clearItems();
  41. }
  42. void GuiListBoxCtrl::initPersistFields()
  43. {
  44. Parent::initPersistFields();
  45. addField( "AllowMultipleSelections", TypeBool, Offset( mMultipleSelections, GuiListBoxCtrl) );
  46. addField( "FitParentWidth", TypeBool, Offset( mFitParentWidth, GuiListBoxCtrl) );
  47. }
  48. bool GuiListBoxCtrl::onWake()
  49. {
  50. if( !Parent::onWake() )
  51. return false;
  52. updateSize();
  53. return true;
  54. }
  55. void GuiListBoxCtrl::addObject(SimObject *obj)
  56. {
  57. AssertWarn(0, "GuiListBoxCtrl::addObject: cannot add children to the GuiListBoxCtrl. It is not a container. Child was not added.");
  58. }
  59. #pragma region ItemAccessors
  60. void GuiListBoxCtrl::clearItems()
  61. {
  62. // Free item list allocated memory
  63. while( mItems.size() )
  64. deleteItem( 0 );
  65. // Free our vector lists
  66. mItems.clear();
  67. mSelectedItems.clear();
  68. }
  69. void GuiListBoxCtrl::clearSelection()
  70. {
  71. if( !mSelectedItems.size() )
  72. return;
  73. VectorPtr<LBItem*>::iterator i = mSelectedItems.begin();
  74. for( ; i != mSelectedItems.end(); i++ )
  75. (*i)->isSelected = false;
  76. mSelectedItems.clear();
  77. }
  78. void GuiListBoxCtrl::removeSelection( S32 index )
  79. {
  80. // Range Check
  81. if( index >= mItems.size() || index < 0 )
  82. {
  83. Con::warnf("GuiListBoxCtrl::removeSelection - index out of range!" );
  84. return;
  85. }
  86. removeSelection( mItems[index], index );
  87. }
  88. void GuiListBoxCtrl::removeSelection( LBItem *item, S32 index )
  89. {
  90. if( !mSelectedItems.size() )
  91. return;
  92. if( !item )
  93. return;
  94. for( S32 i = 0 ; i < mSelectedItems.size(); i++ )
  95. {
  96. if( mSelectedItems[i] == item )
  97. {
  98. mSelectedItems.erase( &mSelectedItems[i] );
  99. item->isSelected = false;
  100. Con::executef(this, 3, "onUnSelect", Con::getIntArg( index ), item->itemText);
  101. return;
  102. }
  103. }
  104. }
  105. void GuiListBoxCtrl::addSelection( S32 index )
  106. {
  107. // Range Check
  108. if( index >= mItems.size() || index < 0 )
  109. {
  110. Con::warnf("GuiListBoxCtrl::addSelection- index out of range!" );
  111. return;
  112. }
  113. addSelection( mItems[index], index );
  114. }
  115. void GuiListBoxCtrl::addSelection( LBItem *item, S32 index )
  116. {
  117. if( !mMultipleSelections )
  118. {
  119. if( !mSelectedItems.empty() )
  120. {
  121. LBItem* selItem = mSelectedItems.front();
  122. if( selItem != item )
  123. clearSelection();
  124. else
  125. return;
  126. }
  127. }
  128. else
  129. {
  130. if( !mSelectedItems.empty() )
  131. {
  132. for( S32 i = 0; i < mSelectedItems.size(); i++ )
  133. {
  134. if( mSelectedItems[ i ] == item )
  135. return;
  136. }
  137. }
  138. }
  139. item->isSelected = true;
  140. mSelectedItems.push_front( item );
  141. if(isMethod("onSelect"))
  142. Con::executef(this, 3, "onSelect", Con::getIntArg( index ), item->itemText);
  143. }
  144. S32 GuiListBoxCtrl::getItemIndex( LBItem *item )
  145. {
  146. if( mItems.empty() )
  147. return -1;
  148. // Lookup the index of an item in our list, by the pointer to the item
  149. for( S32 i = 0; i < mItems.size(); i++ )
  150. if( mItems[i] == item )
  151. return i;
  152. return -1;
  153. }
  154. S32 GuiListBoxCtrl::getItemCount()
  155. {
  156. return mItems.size();
  157. }
  158. S32 GuiListBoxCtrl::getSelCount()
  159. {
  160. return mSelectedItems.size();
  161. }
  162. S32 GuiListBoxCtrl::getSelectedItem()
  163. {
  164. if( mSelectedItems.empty() || mItems.empty() )
  165. return -1;
  166. for( S32 i = 0 ; i < mItems.size(); i++ )
  167. if( mItems[i]->isSelected )
  168. return i;
  169. return -1;
  170. }
  171. void GuiListBoxCtrl::getSelectedItems( Vector<S32> &Items )
  172. {
  173. // Clear our return vector
  174. Items.clear();
  175. // If there are no selected items, return an empty vector
  176. if( mSelectedItems.empty() )
  177. return;
  178. for( S32 i = 0; i < mItems.size(); i++ )
  179. if( mItems[i]->isSelected )
  180. Items.push_back( i );
  181. }
  182. S32 GuiListBoxCtrl::findItemText( StringTableEntry text, bool caseSensitive )
  183. {
  184. // Check Proper Arguments
  185. if( !text || !text[0] || text == StringTable->EmptyString )
  186. {
  187. Con::warnf("GuiListBoxCtrl::findItemText - No Text Specified!");
  188. return -1;
  189. }
  190. // Check Items Exist.
  191. if( mItems.empty() )
  192. return -1;
  193. // Lookup the index of an item in our list, by the pointer to the item
  194. for( S32 i = 0; i < mItems.size(); i++ )
  195. {
  196. // Case Sensitive Compare?
  197. if( caseSensitive && ( dStrcmp( mItems[i]->itemText, text ) == 0 ) )
  198. return i;
  199. else if (!caseSensitive && ( dStricmp( mItems[i]->itemText, text ) == 0 ))
  200. return i;
  201. }
  202. // Not Found!
  203. return -1;
  204. }
  205. void GuiListBoxCtrl::setCurSel( S32 index )
  206. {
  207. // Range Check
  208. if( index >= mItems.size() )
  209. {
  210. Con::warnf("GuiListBoxCtrl::setCurSel - index out of range!" );
  211. return;
  212. }
  213. // If index -1 is specified, we clear the selection
  214. if( index == -1 )
  215. {
  216. mSelectedItems.clear();
  217. return;
  218. }
  219. // Add the selection
  220. addSelection( mItems[ index ], index );
  221. }
  222. void GuiListBoxCtrl::setCurSelRange( S32 start, S32 stop )
  223. {
  224. // Verify Selection Range
  225. if( start < 0 )
  226. start = 0;
  227. else if( start > mItems.size() )
  228. start = mItems.size();
  229. if( stop < 0 )
  230. stop = 0;
  231. else if( stop > mItems.size() )
  232. stop = mItems.size();
  233. S32 iterStart = ( start < stop ) ? start : stop;
  234. S32 iterStop = ( start < stop ) ? stop : start;
  235. for( ; iterStart <= iterStop; iterStart++ )
  236. addSelection( mItems[iterStart], iterStart );
  237. }
  238. S32 GuiListBoxCtrl::addItem( StringTableEntry text, void *itemData )
  239. {
  240. // This just calls insert item at the end of the list
  241. return insertItem( mItems.size(), text, itemData );
  242. }
  243. S32 GuiListBoxCtrl::addItemWithColor( StringTableEntry text, ColorF color, void *itemData )
  244. {
  245. // This just calls insert item at the end of the list
  246. return insertItemWithColor( mItems.size(), text, color, itemData );
  247. }
  248. void GuiListBoxCtrl::setItemColor( S32 index, ColorF color )
  249. {
  250. if ((index >= mItems.size()) || index < 0)
  251. {
  252. Con::warnf("GuiListBoxCtrl::setItemColor - invalid index");
  253. return;
  254. }
  255. LBItem* item = mItems[index];
  256. item->hasColor = true;
  257. item->color = color;
  258. }
  259. void GuiListBoxCtrl::clearItemColor(S32 index)
  260. {
  261. if ((index >= mItems.size()) || index < 0)
  262. {
  263. Con::warnf("GuiListBoxCtrl::setItemColor - invalid index");
  264. return;
  265. }
  266. LBItem* item = mItems[index];
  267. item->hasColor = false;
  268. }
  269. void GuiListBoxCtrl::clearAllColors()
  270. {
  271. if (!mSelectedItems.size())
  272. return;
  273. VectorPtr<LBItem*>::iterator i = mSelectedItems.begin();
  274. for (; i != mSelectedItems.end(); i++)
  275. (*i)->hasColor = false;
  276. }
  277. S32 GuiListBoxCtrl::insertItem( S32 index, StringTableEntry text, void *itemData )
  278. {
  279. // If the index is greater than our list size, insert it at the end
  280. if( index >= mItems.size() )
  281. index = mItems.size();
  282. // Sanity checking
  283. if( !text )
  284. {
  285. Con::warnf("GuiListBoxCtrl::insertItem - cannot add NULL string" );
  286. return -1;
  287. }
  288. LBItem *newItem = new LBItem;
  289. if( !newItem )
  290. {
  291. Con::warnf("GuiListBoxCtrl::insertItem - error allocating item memory!" );
  292. return -1;
  293. }
  294. // Assign item data
  295. newItem->itemText = StringTable->insert(text);
  296. newItem->itemData = itemData;
  297. newItem->isSelected = false;
  298. newItem->hasColor = false;
  299. // Add to list
  300. mItems.insert(index);
  301. mItems[index] = newItem;
  302. // Resize our list to fit our items
  303. updateSize();
  304. // Return our index in list (last)
  305. return index;
  306. }
  307. S32 GuiListBoxCtrl::insertItemWithColor( S32 index, StringTableEntry text, ColorF color, void *itemData )
  308. {
  309. // If the index is greater than our list size, insert it at the end
  310. if( index >= mItems.size() )
  311. index = mItems.size();
  312. // Sanity checking
  313. if( !text )
  314. {
  315. Con::warnf("GuiListBoxCtrl::insertItem - cannot add NULL string" );
  316. return -1;
  317. }
  318. if( color == ColorF(-1, -1, -1) )
  319. {
  320. Con::warnf("GuiListBoxCtrl::insertItem - cannot add NULL color" );
  321. return -1;
  322. }
  323. LBItem *newItem = new LBItem;
  324. if( !newItem )
  325. {
  326. Con::warnf("GuiListBoxCtrl::insertItem - error allocating item memory!" );
  327. return -1;
  328. }
  329. // Assign item data
  330. newItem->itemText = StringTable->insert(text);
  331. newItem->itemData = itemData;
  332. newItem->isSelected = false;
  333. newItem->hasColor = true;
  334. newItem->color = color;
  335. // Add to list
  336. mItems.insert(index);
  337. mItems[index] = newItem;
  338. // Resize our list to fit our items
  339. updateSize();
  340. // Return our index in list (last)
  341. return index;
  342. }
  343. void GuiListBoxCtrl::deleteItem( S32 index )
  344. {
  345. // Range Check
  346. if( index >= mItems.size() || index < 0 )
  347. {
  348. Con::warnf("GuiListBoxCtrl::deleteItem - index out of range!" );
  349. return;
  350. }
  351. // Grab our item
  352. LBItem* item = mItems[ index ];
  353. if( !item )
  354. {
  355. Con::warnf("GuiListBoxCtrl::deleteItem - Bad Item Data!" );
  356. return;
  357. }
  358. // Remove it from the selected list.
  359. if( item->isSelected )
  360. {
  361. for( VectorPtr<LBItem*>::iterator i = mSelectedItems.begin(); i != mSelectedItems.end(); i++ )
  362. {
  363. if( item == *i )
  364. {
  365. mSelectedItems.erase_fast( i );
  366. break;
  367. }
  368. }
  369. }
  370. // Remove it from the list
  371. mItems.erase( &mItems[ index ] );
  372. // Free the memory associated with it
  373. delete item;
  374. }
  375. StringTableEntry GuiListBoxCtrl::getItemText( S32 index )
  376. {
  377. // Range Checking
  378. if( index > mItems.size() || index < 0 )
  379. {
  380. Con::warnf( "GuiListBoxCtrl::getItemText - index out of range!" );
  381. return StringTable->EmptyString;
  382. }
  383. return mItems[ index ]->itemText;
  384. }
  385. void GuiListBoxCtrl::setItemText( S32 index, StringTableEntry text )
  386. {
  387. // Sanity Checking
  388. if( !text )
  389. {
  390. Con::warnf("GuiListBoxCtrl::setItemText - Invalid Text Specified!" );
  391. return;
  392. }
  393. // Range Checking
  394. if( index > mItems.size() || index < 0 )
  395. {
  396. Con::warnf( "GuiListBoxCtrl::getItemText - index out of range!" );
  397. return;
  398. }
  399. mItems[ index ]->itemText = StringTable->insert( text );
  400. }
  401. #pragma endregion
  402. #pragma region Sizing
  403. void GuiListBoxCtrl::updateSize()
  404. {
  405. if( !mProfile )
  406. return;
  407. GFont *font = mProfile->mFont;
  408. Point2I contentSize = Point2I(10, font->getHeight() + 2);
  409. if (!mFitParentWidth)
  410. {
  411. // Find the maximum width cell:
  412. S32 maxWidth = 1;
  413. for ( U32 i = 0; i < (U32)mItems.size(); i++ )
  414. {
  415. S32 width = font->getStrWidth( mItems[i]->itemText );
  416. if( width > maxWidth )
  417. maxWidth = width;
  418. }
  419. contentSize.x = maxWidth + 6;
  420. }
  421. mItemSize = this->getOuterExtent(contentSize, NormalState, mProfile);
  422. Point2I newExtent = Point2I(mItemSize.x, mItemSize.y * mItems.size());
  423. //Don't update the extent.x if we are matching our parent's size. We will handle it during rendering.
  424. if (mFitParentWidth)
  425. {
  426. newExtent.x = mBounds.extent.x;
  427. }
  428. resize( mBounds.point, newExtent );
  429. }
  430. void GuiListBoxCtrl::parentResized(const Point2I &oldParentExtent, const Point2I &newParentExtent)
  431. {
  432. Parent::parentResized( oldParentExtent, newParentExtent );
  433. updateSize();
  434. }
  435. #pragma endregion
  436. #pragma region Rendering
  437. void GuiListBoxCtrl::onRender( Point2I offset, const RectI &updateRect )
  438. {
  439. RectI clip = dglGetClipRect();
  440. if (mFitParentWidth && ( mBounds.extent.x != clip.extent.x || mItemSize.x != clip.extent.x))
  441. {
  442. mBounds.extent.x = clip.extent.x;
  443. mItemSize.x = clip.extent.x;
  444. }
  445. for ( S32 i = 0; i < mItems.size(); i++)
  446. {
  447. S32 colorBoxSize = 0;
  448. ColorI boxColor = ColorI(0, 0, 0);
  449. // Only render visible items
  450. if ((i + 1) * mItemSize.y + offset.y < updateRect.point.y)
  451. continue;
  452. // Break out once we're no longer in visible item range
  453. if( i * mItemSize.y + offset.y >= updateRect.point.y + updateRect.extent.y)
  454. break;
  455. RectI itemRect = RectI( offset.x, offset.y + ( i * mItemSize.y ), mItemSize.x, mItemSize.y );
  456. // Render our item
  457. onRenderItem( itemRect, mItems[i] );
  458. }
  459. }
  460. void GuiListBoxCtrl::onRenderItem( RectI &itemRect, LBItem *item )
  461. {
  462. Point2I cursorPt = Point2I(0,0);
  463. GuiCanvas *root = getRoot();
  464. if (root)
  465. {
  466. cursorPt = root->getCursorPos();
  467. }
  468. GuiControlState currentState = GuiControlState::NormalState;
  469. if (!mActive)
  470. currentState = GuiControlState::DisabledState;
  471. else if (item->isSelected)
  472. currentState = GuiControlState::SelectedState;
  473. else if (itemRect.pointInRect(cursorPt))
  474. currentState = GuiControlState::HighlightState;
  475. RectI ctrlRect = applyMargins(itemRect.point, itemRect.extent, currentState, mProfile);
  476. if (!ctrlRect.isValidRect())
  477. {
  478. return;
  479. }
  480. renderUniversalRect(ctrlRect, mProfile, currentState);
  481. //Render Text
  482. dglSetBitmapModulation(mProfile->getFontColor(currentState));
  483. RectI fillRect = applyBorders(ctrlRect.point, ctrlRect.extent, currentState, mProfile);
  484. RectI contentRect = applyPadding(fillRect.point, fillRect.extent, currentState, mProfile);
  485. // Render color box if needed
  486. if (item->hasColor)
  487. {
  488. RectI drawArea = RectI(contentRect.point.x + 1, contentRect.point.y + 1, contentRect.extent.y - 2, contentRect.extent.y - 2);
  489. drawBox(drawArea, ColorI(item->color));
  490. contentRect.point.x += contentRect.extent.y;
  491. contentRect.extent.x -= contentRect.extent.y;
  492. }
  493. renderText(contentRect.point, contentRect.extent, item->itemText, mProfile);
  494. }
  495. void GuiListBoxCtrl::drawBox(RectI &box, ColorI &boxColor)
  496. {
  497. const S32 max = 5;
  498. if (box.extent.x > max)
  499. {
  500. S32 delta = mCeil((box.extent.x - max) / 2);
  501. box.inset(delta, delta);
  502. }
  503. dglDrawRectFill(box, ColorI(0,0,0, 100));
  504. box.inset(1, 1);
  505. dglDrawRectFill(box, boxColor);
  506. }
  507. #pragma endregion
  508. #pragma region InputEvents
  509. void GuiListBoxCtrl::onTouchDragged(const GuiEvent &event)
  510. {
  511. if (!mActive)
  512. {
  513. return;
  514. }
  515. Parent::onTouchDragged(event);
  516. Point2I localPoint = globalToLocalCoord(event.mousePoint);
  517. S32 itemHit = (localPoint.y < 0) ? -1 : (S32)mFloor((F32)localPoint.y / (F32)mItemSize.y);
  518. if (itemHit >= mItems.size() || itemHit == -1)
  519. return;
  520. LBItem *hitItem = mItems[itemHit];
  521. if (hitItem == NULL)
  522. return;
  523. if(isMethod("onTouchDragged"))
  524. Con::executef(this, 3, "onTouchDragged", Con::getIntArg(itemHit), hitItem->itemText);
  525. }
  526. void GuiListBoxCtrl::onTouchDown( const GuiEvent &event )
  527. {
  528. if (!mActive)
  529. {
  530. return;
  531. }
  532. Point2I localPoint = globalToLocalCoord(event.mousePoint);
  533. S32 itemHit = ( localPoint.y < 0 ) ? -1 : (S32)mFloor( (F32)localPoint.y / (F32)mItemSize.y );
  534. if ( itemHit >= mItems.size() || itemHit == -1 )
  535. return;
  536. LBItem *hitItem = mItems[ itemHit ];
  537. if ( hitItem == NULL )
  538. return;
  539. // If we're not a multiple selection listbox, we simply select/unselect an item
  540. if( !mMultipleSelections )
  541. {
  542. // No current selection? Just select the cell and move on
  543. S32 selItem = getSelectedItem();
  544. if ( selItem != itemHit && selItem != -1 )
  545. clearSelection();
  546. // Set the current selection
  547. setCurSel( itemHit );
  548. if( itemHit == selItem && event.mouseClickCount == 2)
  549. {
  550. if(isMethod("onDoubleClick") )
  551. Con::executef( this, 3, "onDoubleClick", Con::getIntArg(itemHit), hitItem->itemText);
  552. }
  553. else if (isMethod("onClick"))
  554. {
  555. Con::executef(this, 3, "onClick", Con::getIntArg(itemHit), hitItem->itemText);
  556. }
  557. // Store the clicked item
  558. mLastClickItem = hitItem;
  559. return;
  560. }
  561. // Deal with multiple selections
  562. if( event.modifier & SI_CTRL)
  563. {
  564. // Ctrl-Click toggles selection
  565. if( hitItem->isSelected )
  566. {
  567. removeSelection( hitItem, itemHit );
  568. // We return here when we deselect an item because we don't store last clicked when we deselect
  569. return;
  570. }
  571. else
  572. addSelection( hitItem, itemHit );
  573. }
  574. else if( event.modifier & SI_SHIFT )
  575. {
  576. if( !mLastClickItem )
  577. addSelection( hitItem, itemHit );
  578. else
  579. setCurSelRange( getItemIndex( mLastClickItem ), itemHit );
  580. }
  581. else
  582. {
  583. if( getSelCount() != 0 )
  584. {
  585. S32 selItem = getSelectedItem();
  586. if( selItem != -1 && mItems[selItem] != hitItem )
  587. clearSelection();
  588. }
  589. addSelection( hitItem, itemHit );
  590. }
  591. if( hitItem == mLastClickItem && event.mouseClickCount == 2)
  592. {
  593. if(isMethod("onDoubleClick") )
  594. Con::executef( this, 3, "onDoubleClick", Con::getIntArg(itemHit), hitItem->itemText);
  595. }
  596. else if (isMethod("onClick"))
  597. {
  598. Con::executef(this, 3, "onClick", Con::getIntArg(itemHit), hitItem->itemText);
  599. }
  600. mLastClickItem = hitItem;
  601. }
  602. #pragma endregion