MCPcopy Create free account
hub / github.com/OpenRCT2/OpenRCT2 / MouseOver

Method MouseOver

src/openrct2-ui/scripting/CustomListView.cpp:449–487  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

447}
448
449void CustomListView::MouseOver(const ScreenCoordsXY& pos, bool isMouseDown)
450{
451 auto hitResult = GetItemIndexAt(pos);
452 if (hitResult)
453 {
454 HighlightedCell = hitResult;
455 if (HighlightedCell != LastHighlightedCell)
456 {
457 if (hitResult->Row != kHeaderRow && OnHighlight.context != nullptr && OnHighlight.IsValid())
458 {
459 auto ctx = OnHighlight.context;
460 JSValue jsRow = JS_NewInt32(ctx, HighlightedCell->Row);
461 JSValue jsColumn = JS_NewInt32(ctx, HighlightedCell->Column);
462 auto& scriptEngine = GetContext()->GetScriptEngine();
463 scriptEngine.ExecutePluginCall(Owner, OnHighlight.callback, { jsRow, jsColumn }, false);
464 }
465 Invalidate();
466 }
467 }
468
469 // Update the header currently held down
470 if (isMouseDown)
471 {
472 if (hitResult && hitResult->Row == kHeaderRow)
473 {
474 ColumnHeaderPressedCurrentState = (hitResult->Column == ColumnHeaderPressed);
475 Invalidate();
476 }
477 IsMouseDown = true;
478 }
479 else
480 {
481 if (LastIsMouseDown)
482 {
483 MouseUp(pos);
484 }
485 IsMouseDown = false;
486 }
487}
488
489void CustomListView::MouseDown(const ScreenCoordsXY& pos)
490{

Callers 2

onScrollMouseDragMethod · 0.80
onScrollMouseOverMethod · 0.80

Calls 4

GetContextFunction · 0.85
ExecutePluginCallMethod · 0.80
InvalidateFunction · 0.50
IsValidMethod · 0.45

Tested by

no test coverage detected