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

Method drawLinearSlider

hi_scripting/scripting/api/ScriptingGraphics.cpp:4044–4117  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

4042
4043
4044void ScriptingObjects::ScriptedLookAndFeel::Laf::drawLinearSlider(Graphics &g, int /*x*/, int /*y*/, int width, int height, float /*sliderPos*/, float /*minSliderPos*/, float /*maxSliderPos*/, const Slider::SliderStyle style, Slider &slider)
4045{
4046 if (functionDefined("drawLinearSlider"))
4047 {
4048 auto obj = new DynamicObject();
4049
4050 writeId(obj, &slider);
4051 obj->setProperty("enabled", slider.isEnabled());
4052 obj->setProperty("text", slider.getName());
4053
4054 auto parentPack = slider.findParentComponentOfClass<SliderPack>();
4055
4056
4057
4058 obj->setProperty("area", ApiHelpers::getVarRectangle(slider.getLocalBounds().toFloat()));
4059
4060 obj->setProperty("valueAsText", slider.getTextFromValue(slider.getValue()));
4061
4062 obj->setProperty("valueSuffixString", slider.getTextFromValue(slider.getValue()));
4063 obj->setProperty("suffix", slider.getTextValueSuffix());
4064 obj->setProperty("skew", slider.getSkewFactor());
4065
4066 obj->setProperty("style", style); // Horizontal:2, Vertical:3, Range:9
4067
4068 // Vertical & Horizontal style slider
4069 obj->setProperty("min", slider.getMinimum());
4070 obj->setProperty("max", slider.getMaximum());
4071 obj->setProperty("value", slider.getValue());
4072
4073 NormalisableRange<double> range = NormalisableRange<double>(slider.getMinimum(), slider.getMaximum(), slider.getInterval(), slider.getSkewFactor());
4074 obj->setProperty("valueNormalized", range.convertTo0to1(slider.getValue()));
4075
4076 // Range style slider
4077 double minv = 0.0;
4078 double maxv = 1.0;
4079
4080 if (slider.isTwoValue())
4081 {
4082 minv = slider.getMinValue();
4083 maxv = slider.getMaxValue();
4084 }
4085
4086 obj->setProperty("valueRangeStyleMin", minv);
4087 obj->setProperty("valueRangeStyleMax", maxv);
4088
4089 obj->setProperty("valueRangeStyleMinNormalized", range.convertTo0to1(minv));
4090 obj->setProperty("valueRangeStyleMaxNormalized", range.convertTo0to1(maxv));
4091
4092 obj->setProperty("clicked", slider.isMouseButtonDown());
4093 obj->setProperty("hover", slider.isMouseOver());
4094
4095 setColourOrBlack(obj, "bgColour", slider, HiseColourScheme::ComponentOutlineColourId);
4096 setColourOrBlack(obj, "itemColour1", slider, HiseColourScheme::ComponentFillTopColourId);
4097 setColourOrBlack(obj, "itemColour2", slider, HiseColourScheme::ComponentFillBottomColourId);
4098 setColourOrBlack(obj, "textColour", slider, HiseColourScheme::ComponentTextColourId);
4099
4100 if (parentPack != nullptr)
4101 {

Callers

nothing calls this directly

Calls 15

setColourOrBlackFunction · 0.85
varFunction · 0.85
getLocalBoundsMethod · 0.80
getTextValueSuffixMethod · 0.80
getSkewFactorMethod · 0.80
getIntervalMethod · 0.80
isMouseButtonDownMethod · 0.80
isMouseOverMethod · 0.80
callWithGraphicsMethod · 0.80
getNameMethod · 0.65
getFunction · 0.50
setPropertyMethod · 0.45

Tested by

no test coverage detected