MCPcopy Create free account
hub / github.com/christophhart/HISE / setMouseCursor

Method setMouseCursor

hi_scripting/scripting/api/ScriptingApiContent.cpp:4693–4732  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

4691}
4692
4693void ScriptingApi::Content::ScriptPanel::setMouseCursor(var pathIcon, var colour, var hitPoint)
4694 {
4695 getCursorUpdater().enableLockFreeUpdate(getScriptProcessor()->getMainController_()->getGlobalUIUpdater());
4696
4697 if (auto po = dynamic_cast<ScriptingObjects::PathObject*>(pathIcon.getObject()))
4698 {
4699 mouseCursorPath.path = po->getPath();
4700 mouseCursorPath.c = ScriptingApi::Content::Helpers::getCleanedObjectColour(colour);
4701
4702 if (auto ar = hitPoint.getArray())
4703 {
4704 if (ar->size() == 2)
4705 {
4706 mouseCursorPath.hitPoint = Point<float>((float)((*ar)[0]), (float)((*ar)[1]));
4707
4708 if (!Rectangle<float>(0.0f, 0.0f, 1.0f, 1.0f).contains(mouseCursorPath.hitPoint))
4709 reportScriptError("hitPoint must be within [0, 0, 1, 1] area");
4710
4711 }
4712 else
4713 reportScriptError("hitPoint must be a [x, y] array");
4714 }
4715 else
4716 reportScriptError("hitPoint must be a [x, y] array");
4717 }
4718 else if (pathIcon.isString())
4719 {
4720 auto r = Result::ok();
4721
4722 auto standardCursor = ApiHelpers::getMouseCursorFromString(pathIcon.toString(), &r);
4723 mouseCursorPath = MouseCursorInfo(standardCursor);
4724
4725 if(r.failed())
4726 reportScriptError(r.getErrorMessage());
4727 }
4728 else
4729 reportScriptError("pathIcon is not a path");
4730
4731 getCursorUpdater().sendMessage(sendNotificationAsync, mouseCursorPath);
4732}
4733
4734Rectangle<int> ScriptingApi::Content::ScriptPanel::getBoundsForImage() const
4735{

Callers 10

checkMiddleMouseDragMethod · 0.80
setCSSMethod · 0.80
setEditEnabledMethod · 0.80
SliderWrapperMethod · 0.80
ComboBoxWrapperMethod · 0.80
ButtonWrapperMethod · 0.80
cursorChangedMethod · 0.80
CSSLafMethod · 0.80
LoginFormComponentMethod · 0.80

Calls 14

MouseCursorInfoClass · 0.85
enableLockFreeUpdateMethod · 0.80
getMainController_Method · 0.80
getGlobalUIUpdaterMethod · 0.45
getObjectMethod · 0.45
getPathMethod · 0.45
getArrayMethod · 0.45
sizeMethod · 0.45
containsMethod · 0.45
isStringMethod · 0.45
toStringMethod · 0.45
failedMethod · 0.45

Tested by

no test coverage detected